-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[gdb/symtab] Prefer def over decl (inter-CU case, with context)
This is a follow-up patch on "[PATCH][gdb/symtab] Prefer def over decl (inter-CU case)" ( https://sourceware.org/pipermail/gdb-patches/2020-April/167489.html ). Consider the test-case from that patch. It contains a decl and def of var a in different CUs, and tests whether var a can be printed using the def, even if the decl is found first. However, the test-case does this in a contextless environment, so if we add to the test-case like this to set the context to the CU containing main: ... gdb_test "p a" { = \{1, 2\}} + +if ![runto_main] then { + fail "can't run to main" + return 0 +} + +gdb_test "p a" { = \{1, 2\}} ... then the second test fails, because the decl is found in the context. Fix this by preferring defs over decls in lookup_global_symbol. Build and reg-tested on x86_64-linux. gdb/ChangeLog: 2020-04-23 Tom de Vries <[email protected]> * symtab.c (lookup_global_symbol): Prefer def over decl. gdb/testsuite/ChangeLog: 2020-04-23 Tom de Vries <[email protected]> * gdb.base/decl-before-def.exp: Run to main and print a again.
- Loading branch information
Showing
4 changed files
with
26 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
2020-04-23 Tom de Vries <[email protected]> | ||
|
||
* symtab.c (lookup_global_symbol): Prefer def over decl. | ||
|
||
2020-04-23 Tom de Vries <[email protected]> | ||
|
||
PR symtab/25807 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
2020-04-23 Tom de Vries <[email protected]> | ||
|
||
* gdb.base/decl-before-def.exp: Run to main and print a again. | ||
|
||
2020-04-23 Tom de Vries <[email protected]> | ||
|
||
* gdb.base/decl-before-def-decl.c: New test. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters