This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR backtrace/9786


This patch prevents the assertion error reported in:

http://sourceware.org/bugzilla/show_bug.cgi?id=9786

Output from "info frame" after connecting to a remote target now looks like:

    (gdb) info frame
    Stack level 0, frame at 0x0:
     eip = 0xb7f7d810; saved eip none
     Outermost frame: unwinder did not report frame ID
     Arglist at unknown address.
     Locals at unknown address, Previous frame's sp in esp

With native targets "info frame" works as before and there are no regressions
in the testsuite.  I don't understand the last line of output but I think
this is better than having Gdb throw an assertion error.

-- 
Nick                                           http://www.inet.net.nz/~nickrob


2009-02-23  Nick Roberts  <nickrob@snap.net.nz>

	PR backtrace/9786
	* stack.c (frame_info): Avoid assertion error when there
        is no saved pc.


--- stack.c	12 Feb 2009 19:33:27 +1300	1.185
+++ stack.c	23 Feb 2009 00:09:02 +1300	
@@ -894,6 +894,7 @@ frame_info (char *addr_exp, int from_tty
   int selected_frame_p;
   struct gdbarch *gdbarch;
   struct cleanup *back_to = make_cleanup (null_cleanup, NULL);
+  struct value *value;
 
   fi = parse_frame_specification_1 (addr_exp, "No stack.", &selected_frame_p);
   gdbarch = get_frame_arch (fi);
@@ -976,7 +977,12 @@ frame_info (char *addr_exp, int from_tty
   puts_filtered ("; ");
   wrap_here ("    ");
   printf_filtered ("saved %s ", pc_regname);
-  fputs_filtered (paddress (frame_pc_unwind (fi)), gdb_stdout);
+  value = frame_unwind_register_value (fi, gdbarch_pc_regnum (gdbarch));
+  if (VALUE_LVAL (value)  == lval_register
+      && !(frame_id_p (VALUE_FRAME_ID (value))))
+    printf_filtered ("none");
+  else
+    fputs_filtered (paddress (frame_pc_unwind (fi)), gdb_stdout);
   printf_filtered ("\n");
 
   if (calling_frame_info == NULL)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]