gdb/
authorPedro Alves <palves@redhat.com>
Mon, 14 Feb 2011 19:19:18 +0000 (19:19 +0000)
committerPedro Alves <palves@redhat.com>
Mon, 14 Feb 2011 19:19:18 +0000 (19:19 +0000)
* memrange.c (compare_mem_ranges): Mention sort order in
describing comment.
(normalize_mem_ranges): Add comment.  Fix ra->length calculation.
* tracepoint.c (traceframe_available_memory): Extend comment to
mention what happens to RESULT when the target does not support
the query.

gdb/ChangeLog
gdb/memrange.c
gdb/tracepoint.c

index 03b16fdd028462258d4339088a24b6daa9f68e31..523220c7356a9ee39ad4477dc81f68947771a23d 100644 (file)
@@ -1,3 +1,12 @@
+2011-02-14  Pedro Alves  <pedro@codesourcery.com>
+
+       * memrange.c (compare_mem_ranges): Mention sort order in
+       describing comment.
+       (normalize_mem_ranges): Add comment.  Fix ra->length calculation.
+       * tracepoint.c (traceframe_available_memory): Extend comment to
+       mention what happens to RESULT when the target does not support
+       the query.
+
 2011-02-14  Pedro Alves  <pedro@codesourcery.com>
            Jan Kratochvil  <jan.kratochvil@redhat.com>
 
index 4ffe6bdd6dda5d2035cebee3d70222e9fbc44553..dcacff665eb6d56befa26cb1b9b273bb3da8ecc3 100644 (file)
@@ -31,7 +31,8 @@ mem_ranges_overlap (CORE_ADDR start1, int len1,
   return (l < h);
 }
 
-/* qsort comparison function, that compares mem_ranges.  */
+/* qsort comparison function, that compares mem_ranges.  Ranges are
+   sorted in ascending START order.  */
 
 static int
 compare_mem_ranges (const void *ap, const void *bp)
@@ -50,6 +51,10 @@ compare_mem_ranges (const void *ap, const void *bp)
 void
 normalize_mem_ranges (VEC(mem_range_s) *ranges)
 {
+  /* This function must not use any VEC operation on RANGES that
+     reallocates the memory block as that invalidates the RANGES
+     pointer, which callers expect to remain valid.  */
+
   if (!VEC_empty (mem_range_s, ranges))
     {
       struct mem_range *ra, *rb;
@@ -68,7 +73,8 @@ normalize_mem_ranges (VEC(mem_range_s) *ranges)
             merge them.  */
          if (rb->start <= ra->start + ra->length)
            {
-             ra->length = (rb->start + rb->length) - ra->start;
+             ra->length = max (ra->length,
+                               (rb->start - ra->start) + rb->length);
              continue;         /* next b, same a */
            }
          a++;                  /* next a */
index 3eae9376bd04c4a1f9d3df54defe3c5a6b19b4ce..4389f12048dc71686f59786680552a4c293aafd5 100644 (file)
@@ -4635,10 +4635,11 @@ get_traceframe_info (void)
   return traceframe_info;
 }
 
-/* Return in RESULT, the set of collected memory in the current
-   traceframe, found within the LEN bytes range starting at MEMADDR.
-   Returns true if the target supports the query, otherwise returns
-   false.  */
+/* If the target supports the query, return in RESULT the set of
+   collected memory in the current traceframe, found within the LEN
+   bytes range starting at MEMADDR.  Returns true if the target
+   supports the query, otherwise returns false, and RESULT is left
+   undefined.  */
 
 int
 traceframe_available_memory (VEC(mem_range_s) **result,
This page took 0.079962 seconds and 4 git commands to generate.