From: Jason Molenda <jason-swarelist@molenda.com>
To: gdb-patches@sources.redhat.com
Cc: jjohnstn@redhat.com
Subject: PATCH: Fix MI stack frame output for synthetic frames
Date: Fri, 08 Nov 2002 14:22:00 -0000 [thread overview]
Message-ID: <20021108142248.A65720@molenda.com> (raw)
[-- 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;
}
next reply other threads:[~2002-11-08 22:22 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-08 14:22 Jason Molenda [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20021108142248.A65720@molenda.com \
--to=jason-swarelist@molenda.com \
--cc=gdb-patches@sources.redhat.com \
--cc=jjohnstn@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox