1 http://sourceware.org/ml/gdb-patches/2011-08/msg00283.html
2 Subject: [patch] TUI: Permit stepi on stripped code
6 nick <cinolt> on #gdb@freenode complained one cannot stepi on stripped binary.
8 echo -e '#include<unistd.h>\nint main(void){return alarm(0);}'|gcc -Wall -s -x c -;./gdbtui ./a.out -nx -ex 'layout asm' -ex 'b alarm' -ex r -ex fini
10 0x7ffff7ae25c0 <alarm> mov $0x25,%eax
11 -------------------------------------------------
15 No function contains program counter for selected frame.
19 That is the window still displays stale content, stepi does not work at all.
21 #0 throw_verror (error=GENERIC_ERROR, fmt=0xe73d20 "No function contains program counter for selected frame.", ap=0x7fffdbd3b0a8) at exceptions.c:400
22 #1 in error (string=0xe73d20 "No function contains program counter for selected frame.") at utils.c:780
23 #2 in tui_show_frame_info (fi=0x3eca1e0) at ./tui/tui-stack.c:383
24 #3 in tui_selected_frame_level_changed_hook (level=0) at ./tui/tui-hooks.c:218
25 #4 in select_frame (fi=0x3eca1e0) at frame.c:1396
26 #5 in restore_selected_frame (a_frame_id=..., frame_level=0) at thread.c:1049
27 #6 in do_restore_current_thread_cleanup (arg=0x456dca0) at thread.c:1116
28 #7 in do_my_cleanups (pmy_chain=0x1c865f0, old_chain=0x456de90) at utils.c:515
29 #8 in do_cleanups (old_chain=0x456de90) at utils.c:497
30 #9 in insert_breakpoint_locations () at breakpoint.c:2021
31 #10 in insert_breakpoints () at breakpoint.c:1919
32 #11 in proceed (addr=18446744073709551615, siggnal=TARGET_SIGNAL_DEFAULT, step=1) at infrun.c:2156
33 #12 in step_once (skip_subroutines=0, single_inst=1, count=1, thread=-1) at infcmd.c:1068
34 #13 in step_1 (skip_subroutines=0, single_inst=1, count_string=0x0) at infcmd.c:903
35 #14 in stepi_command (count_string=0x0, from_tty=1) at infcmd.c:839
37 With the fix stepi works and the window correctly displays:
39 -------------------------------------------------
41 I haven't found any TUI testsuite.
43 I will check it in (after regression testing(?)) in some time.
51 2011-08-14 Jan Kratochvil <jan.kratochvil@redhat.com>
53 Fix TUI stepi on code without symbols.
54 * tui/tui-stack.c (tui_show_frame_info): Remove error, set LOW for
57 --- a/gdb/tui/tui-stack.c
58 +++ b/gdb/tui/tui-stack.c
59 @@ -380,8 +380,11 @@ tui_show_frame_info (struct frame_info *fi)
61 if (find_pc_partial_function (get_frame_pc (fi), (char **) NULL,
62 &low, (CORE_ADDR) 0) == 0)
63 - error (_("No function contains program "
64 - "counter for selected frame."));
66 + /* There is no symbol available for current PC. There is no
67 + safe way how to "disassemble backwards". */
68 + low = get_frame_pc (fi);
71 low = tui_get_low_disassembly_address (get_frame_arch (fi),
72 low, get_frame_pc (fi));