This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] stack.c: Always set current_source_{symtab,line}
Keith Seitz writes:
> On Thu, 29 Aug 2002, Elena Zannoni wrote:
>
> > Seems an ok patch, but do you have an example command sequence
> > before/after that shows where things go wrong? I am having a bit of a
> > hard time visualizing the interaction.
>
> Sure. From the interpreter branch I've been using. [Sorry, I had the
> sequence wrong. The problem is with the "list" command, not "break". We
> had to do something similar in Insight, aka print_frame_info_listing_hook.
> If this patch gets approved, I can whack that hook (from Insight, at
> least).]
>
The tui uses it as well. Would it be feasible to clean that up too?
Ok, I am going to be a PITA: does this odd behavior occur with non-mi
gdb? I am not clear on why it is happening only with mi. Or at
least I don't see it in regular gdb.
Elena
> (I've removed all the event notifications to facilitate reading)
>
> Without patch:
> $ ./gdb -nx -q -i=mi gdb
> (gdb)
> -break-insert main
> ^done
> (gdb)
> -exec-run
> ^running
> (gdb)
> *stopped,reason="breakpoint-hit",bkptno="1",thread-id="0",frame={addr="0x08075006",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbffff544"}],file="../../src/gdb/main.c",line="743"}
> (gdb)
> -break-insert catcher
> =breakpoint-create,number="2"
> ^done
> (gdb)
> -exec-continue
> ^running
> (gdb)
> *stopped,reason="breakpoint-hit",bkptno="2",thread-id="0",frame={addr="0x080fa8d9",func="catcher",args=[{name="func",value="0x80faad0
> <do_catch_errors>"},{name="func_uiout",value="0x829bb60"},{name="func_args",value="0xbffff4a8"},{name="func_val",value="0xbffff4b4"},{name="func_caught",value="0xbffff4b0"},{name="errstring",value="0x8226f20
> \"\""},{name="mask",value="6"}],file="../../src/gdb/top.c",line="401"}
> (gdb)
> -interpreter-exec console "list"
> ~"734\t catch_errors (captured_command_loop, 0, \"\", RETURN_MASK_ALL);\n"
> ~"735\t }\n"
> ~"736\t /* No exit -- exit is through quit_command. */\n"
> ~"737\t}\n"
> ~"738\t\n"
> ~"739\tint\n"
> ~"740\tmain (int argc, char **argv)\n"
> ~"741\t{\n"
> ~"742\t struct captured_main_args args;\n"
> ~"743\t args.argc = argc;\n"
> ^done
> (gdb)
>
> Note that we stopped in catcher(), but when we asked the console for a
> "list", it returned main().
>
> With patch:
> $ ./gdb -nx -q -i=mi gdb
> (gdb)
> -break-insert main
> ^done
> (gdb)
> -exec-run
> ^running
> (gdb)
> *stopped,reason="breakpoint-hit",bkptno="1",thread-id="0",frame={addr="0x08075006",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbfffe744"}],file="../../src/gdb/main.c",line="743"}
> (gdb)
> -break-insert catcher
> ^done
> (gdb)
> -exec-continue
> ^running
> (gdb)
> *stopped,reason="breakpoint-hit",bkptno="2",thread-id="0",frame={addr="0x080fa8e9",func="catcher",args=[{name="func",value="0x80faae0
> <do_catch_errors>"},{name="func_uiout",value="0x829bb80"},{name="func_args",value="0xbfffe6a8"},{name="func_val",value="0xbfffe6b4"},{name="func_caught",value="0xbfffe6b0"},{name="errstring",value="0x8226f40
> \"\""},{name="mask",value="6"}],file="../../src/gdb/top.c",line="401"}
> (gdb)
> -interpreter-exec console list
> ~"401\t saved_error_pre_print = error_pre_print;\n"
> ~"402\t saved_quit_pre_print = quit_pre_print;\n"
> ~"403\t\n"
> ~"404\t if (mask & RETURN_MASK_ERROR)\n"
> ~"405\t error_pre_print = errstring;\n"
> ~"406\t if (mask & RETURN_MASK_QUIT)\n"
> ~"407\t quit_pre_print = errstring;\n"
> ~"408\t\n"
> ~"409\t /* Override the global ``struct ui_out'' builder. */\n"
> ~"410\t\n"
> ^done
> (gdb)
>
> Now we get the proper source listing from the console.
>
> Keith
>