From 0745a748dd31d92e9ffcf6fa3cddcddac88b6525 Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Mon, 27 Jul 1998 23:13:22 +0000 Subject: [PATCH] Mon Jul 27 16:11:42 1998 Michael Snyder * tracepoint.c (remote_set_transparent_ranges): new function. Send the start and end addresses of all loadable read-only sections down to the trace target, so that it can treat them as "transparent" (ie. don't care if they were collected or not). --- gdb/ChangeLog | 7 +++++++ gdb/tracepoint.c | 46 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 06decce159b..dbe44faa00d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +Mon Jul 27 16:11:42 1998 Michael Snyder + + * tracepoint.c (remote_set_transparent_ranges): new function. + Send the start and end addresses of all loadable read-only + sections down to the trace target, so that it can treat them + as "transparent" (ie. don't care if they were collected or not). + Mon Jul 27 15:38:07 1998 Mark Alexander * mn10300-tdep.c (mn10300_analyze_prologue): Undo previous fix diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 42898c482ea..f85ac540b9a 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -1616,9 +1616,50 @@ add_aexpr(collect, aexpr) collect->next_aexpr_elt++; } - static char target_buf[2048]; +/* Set "transparent" memory ranges + + Allow trace mechanism to treat text-like sections + (and perhaps all read-only sections) transparently, + i.e. don't reject memory requests from these address ranges + just because they haven't been collected. */ + +static void +remote_set_transparent_ranges (void) +{ + extern bfd *exec_bfd; + asection *s; + bfd_size_type size; + bfd_vma lma; + int anysecs = 0; + + if (!exec_bfd) + return; /* no information to give. */ + + strcpy (target_buf, "QTro"); + for (s = exec_bfd->sections; s; s = s->next) + { + char tmp[40]; + + if ((s->flags & SEC_LOAD) == 0 || + /* (s->flags & SEC_CODE) == 0 || */ + (s->flags & SEC_READONLY) == 0) + continue; + + anysecs = 1; + lma = s->lma; + size = bfd_get_section_size_before_reloc (s); + sprintf (tmp, ":%x,%x", lma, lma + size); + strcat (target_buf, tmp); + } + if (anysecs) + { + putpkt (target_buf); + getpkt (target_buf, 0); + } +} + /* tstart command: Tell target to clear any previous trace experiment. @@ -1707,6 +1748,9 @@ trace_start_command (args, from_tty) do_cleanups (old_chain); } } + /* Tell target to treat text-like sections as transparent */ + remote_set_transparent_ranges (); + /* Now insert traps and begin collecting data */ putpkt ("QTStart"); remote_get_noisy_reply (target_buf); if (strcmp (target_buf, "OK"))