Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* PATCH: Fix MI stack frame output for synthetic frames
@ 2002-11-08 14:22 Jason Molenda
  2002-11-08 14:38 ` Andrew Cagney
  0 siblings, 1 reply; 24+ messages in thread
From: Jason Molenda @ 2002-11-08 14:22 UTC (permalink / raw)
  To: gdb-patches; +Cc: jjohnstn

[-- Attachment #1: Type: text/plain, Size: 3466 bytes --]

Hi all,

We've recently found a little problem with the current gdb in MI
mode with synthesized frames on the stack (a gdb call dummy or a
stack handler).  Until last month, print_frame_info_base() would
print information about these frames to stdout via printf_unfiltered;
the reply to -stack-list-frames would have a FRAME tuple for level
0, skip level 1 (assuming that's the synthesized frame), then a
FRAME tuple for level 2 and so on.

With Jeff's change a month ago -
http://sources.redhat.com/ml/gdb-patches/2002-09/msg00777.html

a LEVEL field is being output, but no other parts of the FRAME tuple.
(the FRAME tuple is a named tuple ("frame") with fields ADDR, FUNC,
ARGS, and LINE if those are all available).  The output now looks like

~"<signal handler called>\n"
stack=[frame={level="0",addr=...,func=...},level="1",frame={level="2",addr=...},...]

I've attached a patch to emit a TUPLE with a func name of "<signal
handler called>" or "<function called from gdb>" and to include
the ADDR field.  I also took the opportunity to remove some code that'd
been #if 0'ed since the original import on to sources.redhat.com in 1999.
It's probably easier to read the new code than the patch -- I'll list the
new code below and attach the patch.

2002-11-08  Jason Molenda  (jmolenda@apple.com)
      
        * stack.c (print_frame_info_base): Emit full FRAME tuple for
        gdb call dummy and signal handler synthetic stack frames; send
        stack frame name through UI instead of stdout.

Jason

PS- Jeff, I saw you doing some tuple/list cleanup recently.  The
one place I fixed on the Apple but the FSF doesn't have correct is
the CHILDREN list from -var-list-children; it should be a list,
but it's currently output as a tuple.  I'd be willing to submit a
patch to the code and the testsuite if you're interested.

PPS- I should add that this test causes no regressions and doesn't
change the CLI output.  I wrote a test file to explicitly cover
these synthesized frames in CLI and MI modes, but it would take a
little reworking to handle the FSF style MI output.




static void
print_frame_info_base (struct frame_info *fi, int level, int source, int args)
{
  struct symtab_and_line sal;
  int source_print;
  int location_print;
  struct cleanup *uiout_cleanup;

  if (frame_in_dummy (fi) || fi->signal_handler_caller)
    {
      annotate_frame_begin (level == -1 ? 0 : level, fi->pc);
      uiout_cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "frame");

      /* Do this regardless of SOURCE because we don't have any source
         to list for this frame.  */
      if (level >= 0)
        {
          ui_out_text (uiout, "#");
          ui_out_field_fmt_int (uiout, 2, ui_left, "level", level);
        }
      if (ui_out_is_mi_like_p (uiout))
        {
          annotate_frame_address ();
          ui_out_field_core_addr (uiout, "addr", fi->pc);
          annotate_frame_address_end ();
        }
    }
  if (frame_in_dummy (fi))
    {
      annotate_function_call ();
      ui_out_field_string (uiout, "func", "<function called from gdb>");
      ui_out_text (uiout, "\n");
      annotate_frame_end ();
      do_cleanups (uiout_cleanup);
      return;
    }
  if (fi->signal_handler_caller)
    {
      annotate_signal_handler_caller ();
      ui_out_field_string (uiout, "func", "<signal handler called>");
      ui_out_text (uiout, "\n");
      annotate_frame_end ();
      do_cleanups (uiout_cleanup);
      return;
    }





[-- Attachment #2: pa.txt --]
[-- Type: text/plain, Size: 3102 bytes --]

2002-11-08  Jason Molenda  (jmolenda@apple.com)

        * stack.c (print_frame_info_base): Emit full FRAME tuple for
        gdb call dummy and signal handler synthetic stack frames; send
        stack frame name through UI instead of stdout.

Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.46
diff -u -p -r1.46 stack.c
--- stack.c	3 Oct 2002 22:34:58 -0000	1.46
+++ stack.c	8 Nov 2002 22:02:49 -0000
@@ -332,28 +332,12 @@ print_frame_info_base (struct frame_info
   struct symtab_and_line sal;
   int source_print;
   int location_print;
+  struct cleanup *uiout_cleanup;
 
-#if 0
-  char buf[MAX_REGISTER_RAW_SIZE];
-  CORE_ADDR sp;
-
-  /* On the 68k, this spends too much time in m68k_find_saved_regs.  */
-
-  /* Get the value of SP_REGNUM relative to the frame.  */
-  get_saved_register (buf, (int *) NULL, (CORE_ADDR *) NULL,
-		    FRAME_INFO_ID (fi), SP_REGNUM, (enum lval_type *) NULL);
-  sp = extract_address (buf, REGISTER_RAW_SIZE (SP_REGNUM));
-
-  /* This is not a perfect test, because if a function alloca's some
-     memory, puts some code there, and then jumps into it, then the test
-     will succeed even though there is no call dummy.  Probably best is
-     to check for a bp_call_dummy breakpoint.  */
-  if (PC_IN_CALL_DUMMY (fi->pc, sp, fi->frame))
-#else
-  if (frame_in_dummy (fi))
-#endif
+  if (frame_in_dummy (fi) || fi->signal_handler_caller)
     {
       annotate_frame_begin (level == -1 ? 0 : level, fi->pc);
+      uiout_cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
 
       /* Do this regardless of SOURCE because we don't have any source
          to list for this frame.  */
@@ -362,25 +346,29 @@ print_frame_info_base (struct frame_info
           ui_out_text (uiout, "#");
           ui_out_field_fmt_int (uiout, 2, ui_left, "level", level);
         }
+      if (ui_out_is_mi_like_p (uiout))
+        {
+          annotate_frame_address ();
+          ui_out_field_core_addr (uiout, "addr", fi->pc);
+          annotate_frame_address_end ();
+        }
+    }
+  if (frame_in_dummy (fi))
+    {
       annotate_function_call ();
-      printf_filtered ("<function called from gdb>\n");
+      ui_out_field_string (uiout, "func", "<function called from gdb>");
+      ui_out_text (uiout, "\n");
       annotate_frame_end ();
+      do_cleanups (uiout_cleanup);
       return;
     }
   if (fi->signal_handler_caller)
     {
-      annotate_frame_begin (level == -1 ? 0 : level, fi->pc);
-
-      /* Do this regardless of SOURCE because we don't have any source
-         to list for this frame.  */
-      if (level >= 0)
-        {
-          ui_out_text (uiout, "#");
-          ui_out_field_fmt_int (uiout, 2, ui_left, "level", level);
-        }
       annotate_signal_handler_caller ();
-      printf_filtered ("<signal handler called>\n");
+      ui_out_field_string (uiout, "func", "<signal handler called>");
+      ui_out_text (uiout, "\n");
       annotate_frame_end ();
+      do_cleanups (uiout_cleanup);
       return;
     }
 

^ permalink raw reply	[flat|nested] 24+ messages in thread
* Re: Fix committed for mi-syn-frames fails (was: Re: PATCH RFA: Fix MI stack frame output for synthetic frames)
@ 2003-02-06 17:10 Michael Elizabeth Chastain
  0 siblings, 0 replies; 24+ messages in thread
From: Michael Elizabeth Chastain @ 2003-02-06 17:10 UTC (permalink / raw)
  To: jason-swarelist; +Cc: gdb-patches

> I've commited this.  mi-syn-frames.exp passes with gcc 3.2 and
> gcc 2.96 with stabs and DWARF 2.

It's all PASS all the time in my test bed now.  Good job.

Michael C


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2003-02-06 18:27 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-08 14:22 PATCH: Fix MI stack frame output for synthetic frames Jason Molenda
2002-11-08 14:38 ` Andrew Cagney
2002-11-08 14:46   ` Jason Molenda
2002-11-08 15:56     ` Andrew Cagney
2002-11-09  0:47   ` PATCH RFA: " Jason Molenda
2002-11-09  2:13     ` Jason Molenda
2002-11-15 11:16     ` Ping on two MI patches Jason Molenda
2003-02-02  5:52     ` PATCH RFA: Fix MI stack frame output for synthetic frames Andrew Cagney
2003-02-02 17:38       ` Mark Kettenis
2003-02-02 18:23         ` Andrew Cagney
2003-02-02 20:51           ` Mark Kettenis
2003-02-03 18:15       ` David Carlton
2003-02-03 18:27         ` Jason Molenda
2003-02-03 18:34           ` Daniel Jacobowitz
2003-02-04  8:09             ` Jason Molenda
2003-02-05  8:28               ` Jason Molenda
2003-02-05 13:59                 ` Daniel Jacobowitz
2003-02-05 14:54                   ` Elena Zannoni
2003-02-06  6:28                     ` Fix committed for mi-syn-frames fails (was: Re: PATCH RFA: Fix MI stack frame output for synthetic frames) Jason Molenda
2003-02-06  6:31                       ` Jason Molenda
2003-02-06 17:01                       ` David Carlton
2003-02-06 18:21                       ` Andrew Cagney
2003-02-06 18:27                         ` Jason Molenda
2003-02-06 17:10 Michael Elizabeth Chastain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox