summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPedro Alves <pedro@codesourcery.com>2011-02-14 19:19:17 +0000
committerPedro Alves <pedro@codesourcery.com>2011-02-14 19:19:17 +0000
commit13b12c7db22468a021db59ab5e96222bf6059af6 (patch)
tree6650f8d3aa6a5e071eeaf85e8e9b1b64c79f9e22 /gdb
parent1bfca6ddda2288b13f40035768abb998c7f20a3e (diff)
downloadgdb-13b12c7db22468a021db59ab5e96222bf6059af6.tar.gz
gdb/
* 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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/memrange.c10
-rw-r--r--gdb/tracepoint.c9
3 files changed, 22 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 03b16fdd028..523220c7356 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,4 +1,13 @@
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>
* value.c (mark_value_bytes_unavailable): Fix indexing the `bef'
diff --git a/gdb/memrange.c b/gdb/memrange.c
index 4ffe6bdd6dd..dcacff665eb 100644
--- a/gdb/memrange.c
+++ b/gdb/memrange.c
@@ -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 */
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 3eae9376bd0..4389f12048d 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -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,