aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2025-01-20 11:06:21 -0700
committerTom Tromey <tom@tromey.com>2025-09-10 16:05:27 -0600
commit3c238e032f52df2eecbb10382995eda206fc9947 (patch)
tree13f3302407b3c64475616ed1b436777e594a1e55 /gdb
parent53e6563141335737904685f7dac9ea0618c36319 (diff)
downloadbinutils-3c238e032f52df2eecbb10382995eda206fc9947.zip
binutils-3c238e032f52df2eecbb10382995eda206fc9947.tar.gz
binutils-3c238e032f52df2eecbb10382995eda206fc9947.tar.bz2
Put all CTF symbols in global scope
The new approach to searching (solely via the quick API) is more sensitive to discrepancies between the partial and full readers. In CTF, there is some disagreement about which scope to use. CTF doesn't seem to really distinguish between the file and global scope, so this patch takes the simple approach of putting all CTF symbols into the global scope. This changes one test as well. It seems to me that the behavior here is arbitrary and the test is making unwarranted assumptions. Acked-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ctfread.c6
-rw-r--r--gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp4
2 files changed, 5 insertions, 5 deletions
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index 76de16c..4761b36 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -516,7 +516,7 @@ new_symbol (struct ctf_context *ccp, struct type *type, ctf_id_t tid)
break;
}
- add_symbol_to_list (sym, ccp->builder->get_file_symbols ());
+ add_symbol_to_list (sym, ccp->builder->get_global_symbols ());
}
return sym;
@@ -1171,7 +1171,7 @@ ctf_add_var_cb (const char *name, ctf_id_t id, void *arg)
sym->set_domain (VAR_DOMAIN);
sym->set_loc_class_index (LOC_OPTIMIZED_OUT);
sym->compute_and_set_names (name, false, ccp->of->per_bfd);
- add_symbol_to_list (sym, ccp->builder->get_file_symbols ());
+ add_symbol_to_list (sym, ccp->builder->get_global_symbols ());
break;
default:
complaint (_("ctf_add_var_cb: kind unsupported (%d)"), kind);
@@ -1510,7 +1510,7 @@ ctf_psymtab_type_cb (ctf_id_t tid, void *arg)
ccp->pst->add_psymbol (name, false,
domain, loc_class, section,
- psymbol_placement::STATIC,
+ psymbol_placement::GLOBAL,
unrelocated_addr (0),
language_c, ccp->partial_symtabs, ccp->of);
diff --git a/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp b/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp
index 922729f..2a0e999 100644
--- a/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp
+++ b/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp
@@ -37,6 +37,6 @@ gdb_test_no_output "set always-read-ctf on"
gdb_load $binfile
# Same thing with struct and union.
-gdb_test "ptype struct A" "type = struct A \{\[\r\n\]+\[ \t\]+struct B \\*foo;\[\r\n\]+\}.*" "ptype structure A"
-gdb_test "ptype struct B" "type = struct B \{\[\r\n\]+\[ \t\]+struct B \\*next;\[\r\n\]+\}.*" "ptype structure B"
+gdb_test "ptype struct A" "type = struct A \{\[\r\n\]+\[ \t\]+long a;\[\r\n\]+\[ \t\]+struct B \\*foo;\[\r\n\]+\}.*" "ptype structure A"
+gdb_test "ptype struct B" "type = struct B \{\[\r\n\]+\[ \t\]+int foo;\[\r\n\]+\[ \t\]+struct A \\*bar;\[\r\n\]+\}.*" "ptype structure B"
gdb_test "ptype struct C" "type = struct C \{\[\r\n\]+\[ \t\]+struct B \\*foo;\[\r\n\]+\[ \t\]+int b;\[\r\n\]+\}.*" "ptype structure C"