]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: display a symbol more often in multi-file list output
authorAndrew Burgess <aburgess@redhat.com>
Mon, 17 Nov 2025 14:08:57 +0000 (14:08 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Fri, 5 Dec 2025 10:40:14 +0000 (10:40 +0000)
commit71458a6da11f8afe3f39b47656d9fe5237561c26
treed974f190db297837621f2b6b2f577efa2fc05656
parent89525e4ffdf79caefd146dcff8ecd801af7576ae
gdb: display a symbol more often in multi-file list output

I noticed that when a command line 'list foo.c:10' displays multiple
files, the symbol would always be shown as "???", e.g.:

  file: "/tmp/foo.c", line number: 10, symbol: "???"

this is because, when the symtab_and_line is created for the
'foo.c:10', the pc and symbol are never filled in.

In this commit, I propose that, when we decide that the above header
line needs to be printed, we should attempt to lookup a symbol for the
relevant line, and if one is found, we can use that.

The symbol lookup is done by first calling find_pc_for_line, and then
using find_symbol_for_pc to find a suitable symbol.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/cli/cli-cmds.c
gdb/testsuite/gdb.base/list-multi-source.exp