aboutsummaryrefslogtreecommitdiff
path: root/gdb/make-target-delegates.py
diff options
context:
space:
mode:
authorStephan Rohr <stephan.rohr@intel.com>2024-08-03 02:07:42 -0700
committerAndrew Burgess <aburgess@redhat.com>2024-08-09 11:29:51 +0100
commit49e607f511c1fab82a0116990a72d1915c74bb4a (patch)
tree83b07e844b9a8bd1c0b9635dcf63664d7863639d /gdb/make-target-delegates.py
parent7dd0dfbde7ee31167a3b2e192a575493d26b7b0a (diff)
downloadgdb-49e607f511c1fab82a0116990a72d1915c74bb4a.zip
gdb-49e607f511c1fab82a0116990a72d1915c74bb4a.tar.gz
gdb-49e607f511c1fab82a0116990a72d1915c74bb4a.tar.bz2
gdb: adjust the default place of 'list' to main's prologue
The 'list' command prints around the 'main' function if the current source location is not set. The prologue of 'main' is skipped and the first real line of 'main' is offset by 'lines_to_print - 1'. This is incorrect, the location should be defaulted to main's prologue without applying offsets (similar to 'list main'). Printing around the selected line is then done in 'list_around_line'. The patch also fixes an issue if the list command is used before the program is started. For example, with the following code: 26 static void attribute ((used)) ambiguous_fun (void) {} 27 28 static int attribute ((used)) ambiguous_var; 29 30 31 32 33 34 35 36 37 38 int 39 main (void) 40 { 41 return 0; 42 } GDB offsets the relevant line by 'lines_to_print - 1' and then by another 'lines_to_print / 2' and prints: (gdb) list 27 28 static int attribute ((used)) ambiguous_var; 29 30 31 32 33 34 35 36 With this patch, GDB correctly prints: 37 38 int 39 main (void) 40 { 41 return 0; 42 } Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/make-target-delegates.py')
0 files changed, 0 insertions, 0 deletions