From dba09041c7c7ac429ebc414c10a9d8ce8472f265 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 18 Mar 2011 18:47:56 +0000 Subject: [PATCH] gdb/ * tracepoint.c (set_traceframe_context): Handle unavailable PC gracefully. --- gdb/ChangeLog | 5 +++++ gdb/tracepoint.c | 32 +++++++++++++++----------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 285af638060..388e5d6b5a5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2011-03-18 Pedro Alves + + * tracepoint.c (set_traceframe_context): Handle unavailable PC + gracefully. + 2011-03-18 Pedro Alves * frame.h (frame_unwind_caller_pc_if_available): Declare. diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index c9997c60ebf..3ae35d07692 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -268,27 +268,25 @@ set_traceframe_context (struct frame_info *trace_frame) { CORE_ADDR trace_pc; - if (trace_frame == NULL) /* Cease debugging any trace buffers. */ + /* Save as globals for internal use. */ + if (trace_frame != NULL + && get_frame_pc_if_available (trace_frame, &trace_pc)) + { + traceframe_sal = find_pc_line (trace_pc, 0); + traceframe_fun = find_pc_function (trace_pc); + + /* Save linenumber as "$trace_line", a debugger variable visible to + users. */ + set_internalvar_integer (lookup_internalvar ("trace_line"), + traceframe_sal.line); + } + else { - traceframe_fun = 0; - traceframe_sal.pc = traceframe_sal.line = 0; - traceframe_sal.symtab = NULL; - clear_internalvar (lookup_internalvar ("trace_func")); - clear_internalvar (lookup_internalvar ("trace_file")); + init_sal (&traceframe_sal); + traceframe_fun = NULL; set_internalvar_integer (lookup_internalvar ("trace_line"), -1); - return; } - /* Save as globals for internal use. */ - trace_pc = get_frame_pc (trace_frame); - traceframe_sal = find_pc_line (trace_pc, 0); - traceframe_fun = find_pc_function (trace_pc); - - /* Save linenumber as "$trace_line", a debugger variable visible to - users. */ - set_internalvar_integer (lookup_internalvar ("trace_line"), - traceframe_sal.line); - /* Save func name as "$trace_func", a debugger variable visible to users. */ if (traceframe_fun == NULL -- 2.30.2