From c677110ca3e0383459baf38dd158607ca6d1ebb1 Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Wed, 3 Dec 1997 20:03:46 +0000 Subject: [PATCH] Wed Dec 3 12:00:42 1997 Michael Snyder (msnyder@cleaver.cygnus.com) * tracepoint.c (finish_tfind_command): call do_display so that auto-displays are updated by tfind. Also, keep track of frame and current-function so that tfind behaves like stepping (only show the stack frame if we step into a new function or return). --- gdb/ChangeLog | 7 +++++ gdb/tracepoint.c | 76 +++++++++++++++++++++++++++++++++++------------- 2 files changed, 62 insertions(+), 21 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9edf6f848d..8ac9c2bd13 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +Wed Dec 3 12:00:42 1997 Michael Snyder (msnyder@cleaver.cygnus.com) + + * tracepoint.c (finish_tfind_command): call do_display so that + auto-displays are updated by tfind. Also, keep track of frame + and current-function so that tfind behaves like stepping (only + show the stack frame if we step into a new function or return). + Wed Dec 3 14:14:58 1997 David Taylor * sol-thread.c: additional support for debugging threaded core diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 5276fcc7d3..4de163a7b0 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -1611,11 +1611,20 @@ trace_status_command (args, from_tty) /* Worker function for the various flavors of the tfind command */ static void -finish_tfind_command (reply, from_tty) - char *reply; +finish_tfind_command (msg, from_tty) + char *msg; int from_tty; { int target_frameno = -1, target_tracept = -1; + CORE_ADDR old_frame_addr; + struct symbol *old_func; + char *reply; + + old_frame_addr = FRAME_FP (get_current_frame ()); + old_func = find_pc_function (read_pc ()); + + putpkt (msg); + reply = remote_get_noisy_reply (msg); while (reply && *reply) switch (*reply) { @@ -1651,6 +1660,8 @@ finish_tfind_command (reply, from_tty) printf_filtered ("End of trace buffer.\n"); /* The following will not recurse, since it's special-cased */ trace_find_command ("-1", from_tty); + reply = NULL; /* break out of loop, + (avoid recursive nonsense) */ } } break; @@ -1673,10 +1684,24 @@ finish_tfind_command (reply, from_tty) select_frame (get_current_frame (), 0); set_traceframe_num (target_frameno); set_tracepoint_num (target_tracept); - set_traceframe_context ((get_current_frame ())->pc); + if (target_frameno == -1) + set_traceframe_context (-1); + else + set_traceframe_context (read_pc ()); if (from_tty) - print_stack_frame (selected_frame, selected_frame_level, 1); + { + int source_only; + + if (old_frame_addr == FRAME_FP (get_current_frame ()) && + old_func == find_pc_function (read_pc ())) + source_only = -1; + else + source_only = 1; + + print_stack_frame (selected_frame, selected_frame_level, source_only); + do_displays (); + } } /* trace_find_command takes a trace frame number n, @@ -1722,37 +1747,26 @@ trace_find_command (args, from_tty) frameno = traceframe_number - 1; } -#if 0 - else if (0 == strcasecmp (args, "start")) - frameno = 0; - else if (0 == strcasecmp (args, "none") || - 0 == strcasecmp (args, "end")) - frameno = -1; -#endif else frameno = parse_and_eval_address (args); sprintf (target_buf, "QTFrame:%x", frameno); +#if 0 putpkt (target_buf); tmp = remote_get_noisy_reply (target_buf); if (frameno == -1) /* end trace debugging */ { /* hopefully the stub has complied! */ - if (0 != strcmp (tmp, "F-1")) + if (0 != strcmp (tmp, "OK")) error ("Bogus response from target: %s", tmp); - flush_cached_frames (); - registers_changed (); - select_frame (get_current_frame (), 0); - set_traceframe_num (-1); - set_tracepoint_num (-1); - set_traceframe_context (-1); - - if (from_tty) - print_stack_frame (selected_frame, selected_frame_level, 1); + finish_tfind_command (NULL, from_tty); } else finish_tfind_command (tmp, from_tty); +#else + finish_tfind_command (target_buf, from_tty); +#endif } else error ("Trace can only be run on remote targets."); @@ -1803,10 +1817,14 @@ trace_find_pc_command (args, from_tty) pc = parse_and_eval_address (args); sprintf (target_buf, "QTFrame:pc:%x", pc); +#if 0 putpkt (target_buf); tmp = remote_get_noisy_reply (target_buf); finish_tfind_command (tmp, from_tty); +#else + finish_tfind_command (target_buf, from_tty); +#endif } else error ("Trace can only be run on remote targets."); @@ -1832,10 +1850,14 @@ trace_find_tracepoint_command (args, from_tty) tdp = parse_and_eval_address (args); sprintf (target_buf, "QTFrame:tdp:%x", tdp); +#if 0 putpkt (target_buf); tmp = remote_get_noisy_reply (target_buf); finish_tfind_command (tmp, from_tty); +#else + finish_tfind_command (target_buf, from_tty); +#endif } else error ("Trace can only be run on remote targets."); @@ -1930,10 +1952,14 @@ trace_find_line_command (args, from_tty) sprintf (target_buf, "QTFrame:range:%x:%x", start_pc, end_pc - 1); else /* find OUTSIDE OF range of CURRENT line */ sprintf (target_buf, "QTFrame:outside:%x:%x", start_pc, end_pc - 1); +#if 0 putpkt (target_buf); tmp = remote_get_noisy_reply (target_buf); finish_tfind_command (tmp, from_tty); +#else + finish_tfind_command (target_buf, from_tty); +#endif do_cleanups (old_chain); } else @@ -1973,10 +1999,14 @@ trace_find_range_command (args, from_tty) } sprintf (target_buf, "QTFrame:range:%x:%x", start, stop); +#if 0 putpkt (target_buf); tmp = remote_get_noisy_reply (target_buf); finish_tfind_command (tmp, from_tty); +#else + finish_tfind_command (target_buf, from_tty); +#endif } else error ("Trace can only be run on remote targets."); @@ -2015,10 +2045,14 @@ trace_find_outside_command (args, from_tty) } sprintf (target_buf, "QTFrame:outside:%x:%x", start, stop); +#if 0 putpkt (target_buf); tmp = remote_get_noisy_reply (target_buf); finish_tfind_command (tmp, from_tty); +#else + finish_tfind_command (target_buf, from_tty); +#endif } else error ("Trace can only be run on remote targets.");