* [PATCH][gdb/symtab] Find filename in shared psymtab
@ 2020-04-08 11:03 Tom de Vries
2020-04-08 11:11 ` Tom de Vries
0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2020-04-08 11:03 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
Hi,
When running test-case gdb.ada/dgopt.exp with target board
unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects and gcc-8, gcc-9 or
gcc-10, and the tentative fix for PR25700 (
https://sourceware.org/pipermail/gdb-patches/2020-April/167451.html ), we run
into this regression:
...
(gdb) list x.adb:16, 16^M
No source file named x.adb.^M
(gdb) FAIL: gdb.ada/dgopt.exp: list x.adb:16, 16
...
The reason for the failure is that without the tentative fix for PR25700, we
have an unshared psymtab:
...
{ psymtab gdb.ada/dgopt/x.adb ((struct partial_symtab *) $hex)^M
readin no^M
fullname (null)^M
text addresses 0x0 -- 0x0^M
psymtabs_addrmap_supported yes^M
globals (none)^M
statics (none)^M
dependencies (none)^M
}^M
...
and a shared psymtab (with user field set):
...
{ psymtab gdb.ada/dgopt/x.adb ((struct partial_symtab *) $hex)^M
readin no^M
fullname (null)^M
text addresses 0x0 -- 0x0^M
psymtabs_addrmap_supported yes^M
globals (none)^M
statics (none)^M
user <artificial>@0x159a ((struct partial_symtab *) 0x37b57c0)^M
dependencies (none)^M
}^M
...
The tentative fix for PR25700 removes the unshared psymtab.
Then when trying to find a psymtab matching x.adb in
psym_map_symtabs_matching_filename, we run into this continue for the shared
psymtab:
...
for (partial_symtab *pst : require_partial_symbols (objfile, true))
{
/* We can skip shared psymtabs here, because any file name will be
attached to the unshared psymtab. */
if (pst->user != NULL)
continue;
...
and consequently cannot find the file.
Fix this by not skipping the shared symtab in
psym_map_symtabs_matching_filename.
Build and reg-tested on x86_64-linux.
The test-case passes on master, starts failing with the tentative patch for
PR25700, and passes again with this patch.
OK for trunk?
Thanks,
- Tom
[gdb/symtab] Find filename in shared psymtab
---
gdb/psymtab.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index d952f453d9..5e4e7d116f 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -157,17 +157,15 @@ psym_map_symtabs_matching_filename
for (partial_symtab *pst : require_partial_symbols (objfile, true))
{
- /* We can skip shared psymtabs here, because any file name will be
- attached to the unshared psymtab. */
- if (pst->user != NULL)
- continue;
-
/* Anonymous psymtabs don't have a file name. */
if (pst->anonymous)
continue;
if (compare_filenames_for_search (pst->filename, name))
{
+ while (pst->user)
+ pst = pst->user;
+
if (partial_map_expand_apply (objfile, name, real_path,
pst, callback))
return true;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][gdb/symtab] Find filename in shared psymtab
2020-04-08 11:03 [PATCH][gdb/symtab] Find filename in shared psymtab Tom de Vries
@ 2020-04-08 11:11 ` Tom de Vries
2020-04-22 6:25 ` Tom de Vries
0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2020-04-08 11:11 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
[-- Attachment #1: Type: text/plain, Size: 2120 bytes --]
On 08-04-2020 13:03, Tom de Vries wrote:
> Hi,
>
> When running test-case gdb.ada/dgopt.exp with target board
> unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects and gcc-8, gcc-9 or
> gcc-10, and the tentative fix for PR25700 (
> https://sourceware.org/pipermail/gdb-patches/2020-April/167451.html ), we run
> into this regression:
> ...
> (gdb) list x.adb:16, 16^M
> No source file named x.adb.^M
> (gdb) FAIL: gdb.ada/dgopt.exp: list x.adb:16, 16
> ...
>
> The reason for the failure is that without the tentative fix for PR25700, we
> have an unshared psymtab:
> ...
> { psymtab gdb.ada/dgopt/x.adb ((struct partial_symtab *) $hex)^M
> readin no^M
> fullname (null)^M
> text addresses 0x0 -- 0x0^M
> psymtabs_addrmap_supported yes^M
> globals (none)^M
> statics (none)^M
> dependencies (none)^M
> }^M
> ...
> and a shared psymtab (with user field set):
> ...
> { psymtab gdb.ada/dgopt/x.adb ((struct partial_symtab *) $hex)^M
> readin no^M
> fullname (null)^M
> text addresses 0x0 -- 0x0^M
> psymtabs_addrmap_supported yes^M
> globals (none)^M
> statics (none)^M
> user <artificial>@0x159a ((struct partial_symtab *) 0x37b57c0)^M
> dependencies (none)^M
> }^M
> ...
>
> The tentative fix for PR25700 removes the unshared psymtab.
>
> Then when trying to find a psymtab matching x.adb in
> psym_map_symtabs_matching_filename, we run into this continue for the shared
> psymtab:
> ...
> for (partial_symtab *pst : require_partial_symbols (objfile, true))
> {
> /* We can skip shared psymtabs here, because any file name will be
> attached to the unshared psymtab. */
> if (pst->user != NULL)
> continue;
> ...
> and consequently cannot find the file.
>
> Fix this by not skipping the shared symtab in
> psym_map_symtabs_matching_filename.
>
> Build and reg-tested on x86_64-linux.
>
> The test-case passes on master, starts failing with the tentative patch for
> PR25700, and passes again with this patch.
>
Oops, now actually with test-case, and ChangeLog entries added.
OK for trunk?
Thanks,
- Tom
[-- Attachment #2: 0004-gdb-symtab-Find-filename-in-shared-psymtab.patch --]
[-- Type: text/x-patch, Size: 3711 bytes --]
[gdb/symtab] Find filename in shared psymtab
When running test-case gdb.ada/dgopt.exp with target board
unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects and gcc-8, gcc-9 or
gcc-10, and the tentative fix for PR25700 (
https://sourceware.org/pipermail/gdb-patches/2020-April/167451.html ), we run
into this regression:
...
(gdb) list x.adb:16, 16^M
No source file named x.adb.^M
(gdb) FAIL: gdb.ada/dgopt.exp: list x.adb:16, 16
...
The reason for the failure is that without the tentative fix for PR25700, we
have an unshared psymtab:
...
{ psymtab gdb.ada/dgopt/x.adb ((struct partial_symtab *) $hex)^M
readin no^M
fullname (null)^M
text addresses 0x0 -- 0x0^M
psymtabs_addrmap_supported yes^M
globals (none)^M
statics (none)^M
dependencies (none)^M
}^M
...
and a shared psymtab (with user field set):
...
{ psymtab gdb.ada/dgopt/x.adb ((struct partial_symtab *) $hex)^M
readin no^M
fullname (null)^M
text addresses 0x0 -- 0x0^M
psymtabs_addrmap_supported yes^M
globals (none)^M
statics (none)^M
user <artificial>@0x159a ((struct partial_symtab *) 0x37b57c0)^M
dependencies (none)^M
}^M
...
The tentative fix for PR25700 removes the unshared psymtab.
Then when trying to find a psymtab matching x.adb in
psym_map_symtabs_matching_filename, we run into this continue for the shared
psymtab:
...
for (partial_symtab *pst : require_partial_symbols (objfile, true))
{
/* We can skip shared psymtabs here, because any file name will be
attached to the unshared psymtab. */
if (pst->user != NULL)
continue;
...
and consequently cannot find the file.
Fix this by not skipping the shared symtab in
psym_map_symtabs_matching_filename.
Build and reg-tested on x86_64-linux.
The test-case passes on master, starts failing with the tentative patch for
PR25700, and passes again with this patch.
gdb/ChangeLog:
2020-04-08 Tom de Vries <tdevries@suse.de>
PR symtab/25801
* psymtab.c (psym_map_symtabs_matching_filename): Don't skip shared
symtabs.
gdb/testsuite/ChangeLog:
2020-04-08 Tom de Vries <tdevries@suse.de>
PR symtab/25801
* gdb.dwarf2/imported-unit.exp: Test that we can get imported_unit.c
in "info source" output.
---
gdb/psymtab.c | 8 +++-----
gdb/testsuite/gdb.dwarf2/imported-unit.exp | 6 ++++++
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index d952f453d9..5e4e7d116f 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -157,17 +157,15 @@ psym_map_symtabs_matching_filename
for (partial_symtab *pst : require_partial_symbols (objfile, true))
{
- /* We can skip shared psymtabs here, because any file name will be
- attached to the unshared psymtab. */
- if (pst->user != NULL)
- continue;
-
/* Anonymous psymtabs don't have a file name. */
if (pst->anonymous)
continue;
if (compare_filenames_for_search (pst->filename, name))
{
+ while (pst->user)
+ pst = pst->user;
+
if (partial_map_expand_apply (objfile, name, real_path,
pst, callback))
return true;
diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit.exp b/gdb/testsuite/gdb.dwarf2/imported-unit.exp
index d7b3d4c539..32a9abf620 100644
--- a/gdb/testsuite/gdb.dwarf2/imported-unit.exp
+++ b/gdb/testsuite/gdb.dwarf2/imported-unit.exp
@@ -186,6 +186,12 @@ if { $psymtabs_p } {
unsupported $test
}
+gdb_test "l imported_unit.c:1" \
+ "1\timported_unit.c: No such file or directory\."
+
+gdb_test "info source" "\r\nCurrent source file is imported_unit.c\r\n.*" \
+ "info source for imported_unit.c"
+
# Sanity check
gdb_test "ptype main" "= int \\(void\\)"
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][gdb/symtab] Find filename in shared psymtab
2020-04-08 11:11 ` Tom de Vries
@ 2020-04-22 6:25 ` Tom de Vries
0 siblings, 0 replies; 3+ messages in thread
From: Tom de Vries @ 2020-04-22 6:25 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
On 08-04-2020 13:11, Tom de Vries wrote:
> On 08-04-2020 13:03, Tom de Vries wrote:
>> Hi,
>>
>> When running test-case gdb.ada/dgopt.exp with target board
>> unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects and gcc-8, gcc-9 or
>> gcc-10, and the tentative fix for PR25700 (
>> https://sourceware.org/pipermail/gdb-patches/2020-April/167451.html ), we run
>> into this regression:
>> ...
>> (gdb) list x.adb:16, 16^M
>> No source file named x.adb.^M
>> (gdb) FAIL: gdb.ada/dgopt.exp: list x.adb:16, 16
>> ...
>>
>> The reason for the failure is that without the tentative fix for PR25700, we
>> have an unshared psymtab:
>> ...
>> { psymtab gdb.ada/dgopt/x.adb ((struct partial_symtab *) $hex)^M
>> readin no^M
>> fullname (null)^M
>> text addresses 0x0 -- 0x0^M
>> psymtabs_addrmap_supported yes^M
>> globals (none)^M
>> statics (none)^M
>> dependencies (none)^M
>> }^M
>> ...
>> and a shared psymtab (with user field set):
>> ...
>> { psymtab gdb.ada/dgopt/x.adb ((struct partial_symtab *) $hex)^M
>> readin no^M
>> fullname (null)^M
>> text addresses 0x0 -- 0x0^M
>> psymtabs_addrmap_supported yes^M
>> globals (none)^M
>> statics (none)^M
>> user <artificial>@0x159a ((struct partial_symtab *) 0x37b57c0)^M
>> dependencies (none)^M
>> }^M
>> ...
>>
>> The tentative fix for PR25700 removes the unshared psymtab.
>>
>> Then when trying to find a psymtab matching x.adb in
>> psym_map_symtabs_matching_filename, we run into this continue for the shared
>> psymtab:
>> ...
>> for (partial_symtab *pst : require_partial_symbols (objfile, true))
>> {
>> /* We can skip shared psymtabs here, because any file name will be
>> attached to the unshared psymtab. */
>> if (pst->user != NULL)
>> continue;
>> ...
>> and consequently cannot find the file.
>>
>> Fix this by not skipping the shared symtab in
>> psym_map_symtabs_matching_filename.
>>
>> Build and reg-tested on x86_64-linux.
>>
>> The test-case passes on master, starts failing with the tentative patch for
>> PR25700, and passes again with this patch.
>>
>
> Oops, now actually with test-case, and ChangeLog entries added.
>
> OK for trunk?
Committed (
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=eea9e35758138f83e8c44e0e5a5e47e351f8f31a
).
Thanks,
- Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-22 6:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-08 11:03 [PATCH][gdb/symtab] Find filename in shared psymtab Tom de Vries
2020-04-08 11:11 ` Tom de Vries
2020-04-22 6:25 ` Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).