Age | Commit message (Collapse) | Author | Files | Lines |
|
gdb/ChangeLog:
PR c++/18141
* cp-namespace.c (cp_search_static_and_baseclasses): Always look for
klass in VAR_DOMAIN.
|
|
This commit introduces a new inline common function "startswith"
which takes two string arguments and returns nonzero if the first
string starts with the second. It also updates the 295 places
where this logic was written out longhand to use the new function.
gdb/ChangeLog:
* common/common-utils.h (startswith): New inline function.
All places where this logic was used updated to use the above.
|
|
This patch renames symbols that happen to have names which are
reserved keywords in C++.
Most of this was generated with Tromey's cxx-conversion.el script.
Some places where later hand massaged a bit, to fix formatting, etc.
And this was rebased several times meanwhile, along with re-running
the script, so re-running the script from scratch probably does not
result in the exact same output. I don't think that matters anyway.
gdb/
2015-02-27 Tom Tromey <tromey@redhat.com>
Pedro Alves <palves@redhat.com>
Rename symbols whose names are reserved C++ keywords throughout.
gdb/gdbserver/
2015-02-27 Tom Tromey <tromey@redhat.com>
Pedro Alves <palves@redhat.com>
Rename symbols whose names are reserved C++ keywords throughout.
|
|
This patch addresses two issues.
The basic problem is that "(anonymous namespace)" doesn't get entered
into the symbol table because when dwarf2read.c:new_symbol_full is called
the DIE has no name (dwarf2_name returns NULL).
PR 17976: ptype '(anonymous namespace)' should work like any namespace
PR 17821: perf issue looking up (anonymous namespace)
bash$ gdb monster-program
(gdb) mt set per on
(gdb) mt set symbol-cache-size 0
(gdb) break (anonymous namespace)::foo
Before:
Command execution time: 3.266289 (cpu), 6.169030 (wall)
Space used: 811429888 (+12910592 for this command)
After:
Command execution time: 1.264076 (cpu), 4.057408 (wall)
Space used: 798781440 (+0 for this command)
gdb/ChangeLog:
PR c++/17976, symtab/17821
* cp-namespace.c (cp_search_static_and_baseclasses): New parameter
is_in_anonymous. All callers updated.
(find_symbol_in_baseclass): Ditto.
(cp_lookup_nested_symbol_1): Ditto. Don't search all static blocks
for symbols in an anonymous namespace.
* dwarf2read.c (namespace_name): Don't call dwarf2_name, fetch
DW_AT_name directly.
(dwarf2_name): Convert missing namespace name to
CP_ANONYMOUS_NAMESPACE_STR.
gdeb/testsuite/ChangeLog:
* gdb.cp/anon-ns.exp: Add test for ptype '(anonymous namespace)'.
|
|
gdb/ChangeLog:
* cp-namespace.c (cp_basic_lookup_symbol): Rename parameter
anonymous_namespace to is_in_anonymous for consistency with the rest
of the file.
(cp_lookup_bare_symbol): Fix typo in comment.
(cp_search_static_and_baseclasses): Ditto.
(search_symbol_list): Use vertical space in comment better.
(reset_directive_searched): Ditto. Fix typo.
(cp_lookup_nested_symbol_1): Clarify contents of NESTED_NAME parameter.
|
|
gdb/ChangeLog:
Update year range in copyright notice of all files.
|
|
gdb/ChangeLog:
* ada-lang.c (user_select_syms): Only fetch symtab if symbol is
objfile-owned.
(cache_symbol): Ignore symbols that are not objfile-owned.
* block.c (block_objfile): New function.
(block_gdbarch): New function.
* block.h (block_objfile): Declare.
(block_gdbarch): Declare.
* c-exp.y (classify_name): Remove call to
language_lookup_primitive_type. No longer necessary.
* gdbtypes.c (lookup_typename): Call lookup_symbol_in_language.
Remove call to language_lookup_primitive_type. No longer necessary.
* guile/scm-symbol.c (syscm_gdbarch_data_key): New static global.
(syscm_gdbarch_data): New struct.
(syscm_init_arch_symbols): New function.
(syscm_get_symbol_map): Renamed from syscm_objfile_symbol_map.
All callers updated. Handle symbols owned by arches.
(gdbscm_symbol_symtab): Handle symbols owned by arches.
(gdbscm_initialize_symbols): Initialize syscm_gdbarch_data_key.
* language.c (language_lookup_primitive_type_1): New function.
(language_lookup_primitive_type): Call it.
(language_alloc_type_symbol): New function.
(language_init_primitive_type_symbols): New function.
(language_lookup_primitive_type_as_symbol): New function.
* language.h (struct language_arch_info) <primitive_type_symbols>:
New member.
(language_lookup_primitive_type): Add function comment.
(language_lookup_primitive_type_as_symbol): Declare.
* printcmd.c (address_info): Handle arch-owned symbols.
* python/py-symbol.c (sympy_get_symtab): Ditto.
(set_symbol): Ditto.
(sympy_dealloc): Ditto.
* symmisc.c (print_symbol): Ditto.
* symtab.c (fixup_symbol_section): Ditto.
(lookup_symbol_aux): Initialize block_found.
(basic_lookup_symbol_nonlocal): Try looking up the symbol as a
primitive type.
(initialize_objfile_symbol_1): New function.
(initialize_objfile_symbol): Call it.
(allocate_symbol): Call it.
(allocate_template_symbol): Call it.
(symbol_objfile): Assert symbol is objfile-owned.
(symbol_arch, symbol_symtab, symbol_set_symtab): Ditto.
* symtab.h (struct symbol) <owner>: Replaces member "symtab".
(struct symbol) <is_objfile_owned>: New member.
(SYMBOL_OBJFILE_OWNED): New macro.
* cp-namespace.c (cp_lookup_bare_symbol): New arg langdef.
All callers updated. Try to find the symbol as a primitive type.
(lookup_namespace_scope): New arg langdef. All callers updated.
Call cp_lookup_bare_symbol directly for simple bare symbols.
|
|
gdb/ChangeLog:
* language.h (struct language_defn) <la_lookup_symbol_nonlocal>:
New arg language_defn. All uses updated.
|
|
gdb/ChangeLog:
* symtab.h (SYMBOL_SYMTAB): Delete
(SYMBOL_OBJFILE): Delete.
(symbol_symtab, symbol_set_symtab): Declare.
(symbol_objfile, symbol_arch): Declare.
* symtab.c (symbol_symtab): Replaces SYMBOL_SYMTAB. All uses updated.
All references to symbol->symtab redirected through here.
(symbol_set_symtab): New function. All assignments to SYMBOL_SYMTAB
redirected through here.
(symbol_arch): New function.
(symbol_objfile): New function. Replaces SYMBOL_OBJFILE.
All uses updated.
* cp-namespace.c (cp_lookup_symbol_imports_or_template): Call
symbol_arch.
* findvar.c (default_read_var_value): Call symbol_arch.
* guile/scm-frame.c (gdbscm_frame_block): Call symbol_objfile.
* jv-lang.c (add_class_symtab_symbol): Call symbol_arch.
* printcmd.c (address_info): Call symbol_arch.
* tracepoint.c (scope_info): Call symbol_arch.
|
|
gdb/ChangeLog:
* cp-namespace.c (cp_lookup_symbol_via_all_imports): New function.
(cp_lookup_symbol_namespace): Call it.
(cp_lookup_symbol_nonlocal): Ditto.
|
|
gdb/ChangeLog:
* cp-namespace.c (cp_lookup_symbol_via_imports): New arg
"search_scope_first". All callers updated.
|
|
gdb/ChangeLog:
* cp-namespace.c (cp_lookup_nested_symbol_1): New function.
(cp_basic_lookup_symbol): Renamed from lookup_symbol_file. Delete
arg "search". All callers updated.
(cp_lookup_bare_symbol): New function.
(cp_search_static_and_baseclasses): New function.
(cp_lookup_symbol_in_namespace): Rewrite, move more logic here.
(find_symbol_in_baseclass): Simplify, call cp_lookup_nested_symbol_1.
(cp_lookup_nested_symbol): Ditto.
|
|
gdb/ChangeLog:
* cp-namespace.c (cp_lookup_symbol_in_namespace): Simplify.
|
|
gdb/ChangeLog:
* cp-namespace.c: Whitespace cleanup.
|
|
gdb/ChangeLog:
New parameter "debug symbol-lookup".
* NEWS: Mention it.
* cp-namespace.c (cp_lookup_symbol_imports_or_template): Add debug
output.
(cp_lookup_symbol_namespace, cp_lookup_symbol_nonlocal): Ditto.
(cp_lookup_nested_symbol): Ditto.
* language.c (language_lookup_primitive_type_by_name): Add debug
output.
* minsyms.c (lookup_minimal_symbol): Add debug output.
* objfiles.c (objfile_debug_name): Moved here, and renamed ...
* symfile-debug.c (debug_objfile_name): ... from here. All callers
updated.
* objfiles.h (objfile_debug_name): Declare.
* symtab.h (symbol_lookup_debug): Declare.
* symtab.c (symbol_lookup_debug): New global.
(lookup_language_this): Add debug output.
(lookup_symbol_aux, lookup_symbol_in_block): Ditto.
(lookup_symbol_in_objfile_symtabs, lookup_symbol_via_quick_fns): Ditto.
(lookup_symbol_in_static_block, lookup_symbol_in_objfile): Ditto.
(_initialize_symtab): Add new parameter "debug symbol-lookup".
gdb/doc/ChangeLog:
* gdb.texinfo (Debugging Output): Document "debug symbol-lookup".
|
|
gdb/ChangeLog:
* cp-namespace.c (cp_lookup_symbol_via_imports): Renamed from
cp_lookup_symbol_imports. All callers updated.
|
|
gdb/ChangeLog:
* cp-namespace.c (cp_find_type_baseclass_by_name): Renamed from
find_type_baseclass_by_name. All callers updated.
|
|
gdb/ChangeLog:
* cp-support.h (cp_is_in_anonymous): Renamed from cp_is_anonymous.
All callers updated. Rename arg "namespace" to "symbol_name".
|
|
gdb/ChangeLog:
* cp-namespace.c (cp_lookup_nested_symbol): Fix comments.
|
|
gdb/ChangeLog:
* cp-namespace.c (cp_lookup_symbol_nonlocal): Move definition,
closer to its subroutines.
|
|
gdb/ChangeLog:
* cp-namespace.c (lookup_symbol_file): Move next to only caller.
|
|
gdb/ChangeLog:
* cp-namespace.c (cp_lookup_symbol_imports): Make static.
* cp-support.c (cp_lookup_symbol_imports): Delete.
|
|
gdb/ChangeLog:
* cp-namespace.c (cp_lookup_symbol_nonlocal): Fix comment.
|
|
gdb/ChangeLog:
* cp-namespace.c (cp_lookup_symbol_imports_or_template): Use
SYMBOL_OBJFILE.
* findvar.c (default_read_var_value): Ditto.
* jv-lang.c (add_class_symtab_symbol): Ditto.
* parse.c (operator_check_standard): Ditto.
* printcmd.c (address_info): Ditto.
* symtab.c (fixup_symbol_section): Ditto.
(skip_prologue_sal): Ditto.
* tracepoint.c (scope_info): Ditto.
* valops.c (find_function_in_inferior): Ditto.
* guile/scm-symbol.c (syscm_eq_symbol_smob): Ditto.
* python/py-symbol.c (set_symbol): Ditto.
|
|
gdb/ChangeLog:
* symtab.c (lookup_global_symbol): Renamed from lookup_symbol_global.
All callers updated.
* symtab.h (lookup_global_symbol): Update decl.
(lookup_static_symbol): Move decl to better location.
|
|
gdb/ChangeLog:
* symtab.c (lookup_symbol_in_block): Renamed from
lookup_symbol_aux_block. All callers updated.
|
|
and lookup_static_symbol_aux to lookup_static_symbol.
gdb/ChangeLog:
* symtab.c (lookup_static_symbol): Renamed from
lookup_static_symbol_aux. All callers updated.
(lookup_symbol_in_static_block): Renamed from lookup_symbol_static.
All callers updated.
|
|
This commit includes gdb_assert.h in common-defs.h and removes all
other inclusions.
gdb/
2014-08-07 Gary Benson <gbenson@redhat.com>
* common/common-defs.h: Include gdb_assert.h.
* aarch64-tdep.c: Do not include gdb_assert.h.
* addrmap.c: Likewise.
* aix-thread.c: Likewise.
* alpha-linux-tdep.c: Likewise.
* alpha-mdebug-tdep.c: Likewise.
* alphanbsd-tdep.c: Likewise.
* amd64-nat.c: Likewise.
* amd64-tdep.c: Likewise.
* amd64bsd-nat.c: Likewise.
* amd64fbsd-nat.c: Likewise.
* amd64fbsd-tdep.c: Likewise.
* amd64nbsd-nat.c: Likewise.
* amd64nbsd-tdep.c: Likewise.
* amd64obsd-nat.c: Likewise.
* amd64obsd-tdep.c: Likewise.
* arch-utils.c: Likewise.
* arm-tdep.c: Likewise.
* armbsd-tdep.c: Likewise.
* auxv.c: Likewise.
* bcache.c: Likewise.
* bfin-tdep.c: Likewise.
* blockframe.c: Likewise.
* breakpoint.c: Likewise.
* bsd-kvm.c: Likewise.
* bsd-uthread.c: Likewise.
* buildsym.c: Likewise.
* c-exp.y: Likewise.
* c-lang.c: Likewise.
* charset.c: Likewise.
* cleanups.c: Likewise.
* cli-out.c: Likewise.
* cli/cli-decode.c: Likewise.
* cli/cli-dump.c: Likewise.
* cli/cli-logging.c: Likewise.
* cli/cli-script.c: Likewise.
* cli/cli-utils.c: Likewise.
* coffread.c: Likewise.
* common/common-utils.c: Likewise.
* common/queue.h: Likewise.
* common/signals.c: Likewise.
* common/vec.h: Likewise.
* complaints.c: Likewise.
* completer.c: Likewise.
* corelow.c: Likewise.
* cp-abi.c: Likewise.
* cp-name-parser.y: Likewise.
* cp-namespace.c: Likewise.
* cp-support.c: Likewise.
* cris-tdep.c: Likewise.
* dbxread.c: Likewise.
* dictionary.c: Likewise.
* doublest.c: Likewise.
* dsrec.c: Likewise.
* dummy-frame.c: Likewise.
* dwarf2-frame-tailcall.c: Likewise.
* dwarf2-frame.c: Likewise.
* dwarf2expr.c: Likewise.
* dwarf2loc.c: Likewise.
* dwarf2read.c: Likewise.
* eval.c: Likewise.
* event-loop.c: Likewise.
* exceptions.c: Likewise.
* expprint.c: Likewise.
* f-valprint.c: Likewise.
* fbsd-nat.c: Likewise.
* findvar.c: Likewise.
* frame-unwind.c: Likewise.
* frame.c: Likewise.
* frv-tdep.c: Likewise.
* gcore.c: Likewise.
* gdb-dlfcn.c: Likewise.
* gdb_bfd.c: Likewise.
* gdbarch.c: Likewise.
* gdbarch.sh: Likewise.
* gdbtypes.c: Likewise.
* gnu-nat.c: Likewise.
* gnu-v3-abi.c: Likewise.
* go-lang.c: Likewise.
* guile/scm-exception.c: Likewise.
* guile/scm-gsmob.c: Likewise.
* guile/scm-lazy-string.c: Likewise.
* guile/scm-math.c: Likewise.
* guile/scm-pretty-print.c: Likewise.
* guile/scm-safe-call.c: Likewise.
* guile/scm-utils.c: Likewise.
* guile/scm-value.c: Likewise.
* h8300-tdep.c: Likewise.
* hppa-hpux-nat.c: Likewise.
* hppa-tdep.c: Likewise.
* hppanbsd-tdep.c: Likewise.
* hppaobsd-tdep.c: Likewise.
* i386-darwin-nat.c: Likewise.
* i386-darwin-tdep.c: Likewise.
* i386-nto-tdep.c: Likewise.
* i386-tdep.c: Likewise.
* i386bsd-nat.c: Likewise.
* i386fbsd-tdep.c: Likewise.
* i386gnu-nat.c: Likewise.
* i386nbsd-tdep.c: Likewise.
* i386obsd-tdep.c: Likewise.
* i387-tdep.c: Likewise.
* ia64-libunwind-tdep.c: Likewise.
* ia64-tdep.c: Likewise.
* inf-ptrace.c: Likewise.
* inf-ttrace.c: Likewise.
* infcall.c: Likewise.
* infcmd.c: Likewise.
* infrun.c: Likewise.
* inline-frame.c: Likewise.
* interps.c: Likewise.
* jv-lang.c: Likewise.
* jv-typeprint.c: Likewise.
* linux-fork.c: Likewise.
* linux-nat.c: Likewise.
* linux-thread-db.c: Likewise.
* m32c-tdep.c: Likewise.
* m32r-linux-nat.c: Likewise.
* m32r-tdep.c: Likewise.
* m68k-tdep.c: Likewise.
* m68kbsd-nat.c: Likewise.
* m68kbsd-tdep.c: Likewise.
* m88k-tdep.c: Likewise.
* machoread.c: Likewise.
* macroexp.c: Likewise.
* macrotab.c: Likewise.
* maint.c: Likewise.
* mdebugread.c: Likewise.
* memory-map.c: Likewise.
* mep-tdep.c: Likewise.
* mi/mi-common.c: Likewise.
* microblaze-tdep.c: Likewise.
* mingw-hdep.c: Likewise.
* mips-linux-nat.c: Likewise.
* mips-linux-tdep.c: Likewise.
* mips-tdep.c: Likewise.
* mips64obsd-tdep.c: Likewise.
* mipsnbsd-tdep.c: Likewise.
* mn10300-linux-tdep.c: Likewise.
* mn10300-tdep.c: Likewise.
* moxie-tdep.c: Likewise.
* mt-tdep.c: Likewise.
* nat/linux-btrace.c: Likewise.
* nat/linux-osdata.c: Likewise.
* nat/linux-ptrace.c: Likewise.
* nat/mips-linux-watch.c: Likewise.
* nios2-linux-tdep.c: Likewise.
* nios2-tdep.c: Likewise.
* objc-lang.c: Likewise.
* objfiles.c: Likewise.
* obsd-nat.c: Likewise.
* opencl-lang.c: Likewise.
* osabi.c: Likewise.
* parse.c: Likewise.
* ppc-linux-nat.c: Likewise.
* ppc-sysv-tdep.c: Likewise.
* ppcfbsd-nat.c: Likewise.
* ppcfbsd-tdep.c: Likewise.
* ppcnbsd-nat.c: Likewise.
* ppcnbsd-tdep.c: Likewise.
* ppcobsd-nat.c: Likewise.
* ppcobsd-tdep.c: Likewise.
* printcmd.c: Likewise.
* procfs.c: Likewise.
* prologue-value.c: Likewise.
* psymtab.c: Likewise.
* python/py-lazy-string.c: Likewise.
* python/py-value.c: Likewise.
* regcache.c: Likewise.
* reggroups.c: Likewise.
* registry.c: Likewise.
* remote-sim.c: Likewise.
* remote.c: Likewise.
* rs6000-aix-tdep.c: Likewise.
* rs6000-tdep.c: Likewise.
* s390-linux-tdep.c: Likewise.
* score-tdep.c: Likewise.
* ser-base.c: Likewise.
* ser-mingw.c: Likewise.
* sh-tdep.c: Likewise.
* sh64-tdep.c: Likewise.
* solib-darwin.c: Likewise.
* solib-spu.c: Likewise.
* solib-svr4.c: Likewise.
* source.c: Likewise.
* sparc-nat.c: Likewise.
* sparc-sol2-tdep.c: Likewise.
* sparc-tdep.c: Likewise.
* sparc64-sol2-tdep.c: Likewise.
* sparc64-tdep.c: Likewise.
* sparc64fbsd-tdep.c: Likewise.
* sparc64nbsd-tdep.c: Likewise.
* sparc64obsd-tdep.c: Likewise.
* sparcnbsd-tdep.c: Likewise.
* sparcobsd-tdep.c: Likewise.
* spu-multiarch.c: Likewise.
* spu-tdep.c: Likewise.
* stabsread.c: Likewise.
* stack.c: Likewise.
* symfile.c: Likewise.
* symtab.c: Likewise.
* target-descriptions.c: Likewise.
* target-memory.c: Likewise.
* target.c: Likewise.
* tic6x-linux-tdep.c: Likewise.
* tic6x-tdep.c: Likewise.
* tilegx-linux-nat.c: Likewise.
* tilegx-tdep.c: Likewise.
* top.c: Likewise.
* tramp-frame.c: Likewise.
* tui/tui-out.c: Likewise.
* tui/tui-winsource.c: Likewise.
* ui-out.c: Likewise.
* user-regs.c: Likewise.
* utils.c: Likewise.
* v850-tdep.c: Likewise.
* valops.c: Likewise.
* value.c: Likewise.
* varobj.c: Likewise.
* vax-nat.c: Likewise.
* xml-syscall.c: Likewise.
* xml-tdesc.c: Likewise.
* xstormy16-tdep.c: Likewise.
* xtensa-linux-nat.c: Likewise.
* xtensa-tdep.c: Likewise.
gdb/gdbserver/
2014-08-07 Gary Benson <gbenson@redhat.com>
* server.h: Do not include gdb_assert.h.
|
|
See the bug for further information.
|
|
[forgot to commit/push these with previous push]
If lookup_symbol_file tries to locate a member variable with NULL name:
/* A simple lookup failed. Check if the symbol was defined in
a base class. */
cleanup = make_cleanup (null_cleanup, NULL);
/* Find the name of the class and the name of the method,
variable, etc. */
prefix_len = cp_entire_prefix_len (name);
/* If no prefix was found, search "this". */
if (prefix_len == 0)
{
struct type *type;
struct symbol *this;
this = lookup_language_this (language_def (language_cplus), block);
if (this == NULL)
{
do_cleanups (cleanup);
return NULL;
}
type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (this)));
klass = xstrdup (TYPE_NAME (type));
nested = xstrdup (name);
}
TYPE_NAME (type) is NULL, so xstrdup (NULL) and boom!
This can happen, e.g., with clang++. See testsuite/gdb.cp/namelessclass.exp
or the bugzilla report.
This patch simply adds a fencepost against this case, allowing the caller
of lookup_symbol_file to search other blocks for the right symbol.
|
|
PR c++/16253.
symbol_matches_domain was permitting searches for a VAR_DOMAIN
symbol to also match STRUCT_DOMAIN symbols for languages like C++
where STRUCT_DOMAIN symbols also define a typedef of the same name,
e.g., "struct foo {}" introduces a typedef of the name "foo".
Problems occur if there exists both a VAR_DOMAIN and STRUCT_DOMAIN
symbol of the same name. Then it is essentially a race between which
symbol is found first. The other symbol is obscurred.
[This is a relatively common idiom: enum e { ... } e;]
This patchset moves this "language defines a typedef" logic to
lookup_symbol[_in_language], looking first for a symbol in the given
domain and falling back to searching STRUCT_DOMAIN when/if appropriate.
2014-04-14 Keith Seitz <keiths@redhat.com>
PR c++/16253
* ada-lang.c (ada_symbol_matches_domain): Moved here and renamed
from symbol_matches_domain in symtab.c. All local callers
of symbol_matches_domain updated.
(standard_lookup): If DOMAIN is VAR_DOMAIN and no symbol is found,
search STRUCT_DOMAIN.
(ada_find_any_type_symbol): Do not search STRUCT_DOMAIN
independently. standard_lookup will do that automatically.
* cp-namespace.c (cp_lookup_symbol_nonlocal): Explain when/why
VAR_DOMAIN searches may return a STRUCT_DOMAIN match.
(cp_lookup_symbol_in_namespace): Likewise.
If no VAR_DOMAIN symbol is found, search STRUCT_DOMAIN.
(cp_lookup_symbol_exports): Explain when/why VAR_DOMAIN searches
may return a STRUCT_DOMAIN match.
(lookup_symbol_file): Search for the class name in STRUCT_DOMAIN.
* cp-support.c: Include language.h.
(inspect_type): Explicitly search STRUCT_DOMAIN before searching
VAR_DOMAIN.
* psymtab.c (match_partial_symbol): Compare the requested
domain with the symbol's domain directly.
(lookup_partial_symbol): Likewise.
* symtab.c (lookup_symbol_in_language): Explain when/why
VAR_DOMAIN searches may return a STRUCT_DOMAIN match.
If no VAR_DOMAIN symbol is found, search STRUCT_DOMAIN for
appropriate languages.
(symbol_matches_domain): Renamed `ada_symbol_matches_domain'
and moved to ada-lang.c
(lookup_block_symbol): Explain that this function only returns
symbol matching the requested DOMAIN.
Compare the requested domain with the symbol's domain directly.
(iterate_over_symbols): Compare the requested domain with the
symbol's domain directly.
* symtab.h (symbol_matches_domain): Remove.
2014-04-14 Keith Seitz <keiths@redhat.com>
PR c++/16253
* gdb.cp/var-tag.cc: New file.
* gdb.cp/var-tag.exp: New file.
* gdb.dwarf2/dw2-ada-ffffffff.exp: Set the language to C++.
* gdb.dwarf2/dw2-anon-mptr.exp: Likewise.
* gdb.dwarf2/dw2-double-set-die-type.exp: Likewise.
* gdb.dwarf2/dw2-inheritance.exp: Likewise.
|
|
This adds support for the C++11 "enum class" feature. This is
PR c++/15246.
I chose to use the existing TYPE_DECLARED_CLASS rather than introduce
a new type code. This seemed both simple and clear to me.
I made overloading support for the new enum types strict. This is how
it works in C++; and it didn't seem like an undue burden to keep this,
particularly because enum constants are printed symbolically by gdb.
Built and regtested on x86-64 Fedora 20.
2014-04-14 Tom Tromey <tromey@redhat.com>
PR c++/15246:
* c-exp.y (type_aggregate_p): New function.
(qualified_name, classify_inner_name): Use it.
* c-typeprint.c (c_type_print_base): Handle TYPE_DECLARED_CLASS
and TYPE_TARGET_TYPE of an enum type.
* dwarf2read.c (read_enumeration_type): Set TYPE_DECLARED_CLASS on
an enum type.
(determine_prefix) <case DW_TAG_enumeration_type>: New case;
handle TYPE_DECLARED_CLASS.
* gdbtypes.c (rank_one_type): Handle TYPE_DECLARED_CLASS on enum
types.
* gdbtypes.h (TYPE_DECLARED_CLASS): Update comment.
* valops.c (enum_constant_from_type): New function.
(value_aggregate_elt): Use it.
* cp-namespace.c (cp_lookup_nested_symbol): Handle
TYPE_CODE_ENUM.
2014-04-14 Tom Tromey <tromey@redhat.com>
* gdb.cp/classes.exp (test_enums): Handle underlying type.
* gdb.dwarf2/enum-type.exp: Add test for enum with underlying
type.
* gdb.cp/enum-class.exp: New file.
* gdb.cp/enum-class.cc: New file.
|
|
|
|
Added new domain MODULE_DOMAIN for fortran modules to avoid
issues with sharing namespaces (e.g. when a variable currently
in scope has the same name as a module).
(gdb) ptype modname
old> No symbol "modname" in current context.
new> type = module modname
This fixes PR 15209 and also addresses the issue
with sharing namespaces:
https://sourceware.org/ml/gdb-patches/2013-02/msg00643.html
2013-11-19 Keven Boell <keven.boell@intel.com>
Sanimir Agovic <sanimir.agovic@intel.com>
* cp-namespace.c (cp_lookup_nested_symbol): Enable
nested lookups for fortran modules.
* dwarf2read.c (read_module): Add fortran module to
the symbol table.
(add_partial_symbol, add_partial_module): Add fortran
module to the partial symbol table.
(new_symbol_full): Create full symbol for fortran module.
* f-exp.y (yylex): Add new module domain to be parsed.
* symtab.h: New domain for fortran modules.
testsuite/
* gdb.fortran/module.exp: Completion matches fortran module
names as well. ptype/whatis on modules return a proper type.
Add new check for having the correct scope.
|
|
https://sourceware.org/ml/gdb-patches/2013-11/msg00102.html
|
|
This moves the "gdbarch" field from the objfile into the BFD.
This field's value is derived from the BFD and is immutable over the
lifetime of the BFD. This makes it a reasonable candidate for pushing
into the per-BFD object.
This is part of the long-term objfile splitting project. In the long
run I think this patch will make it simpler to moves types from the
objfile to the per-BFD object; but the patch makes sense as a minor
cleanup by itself.
Built and regtested on x86-64 Fedora 18.
* cp-namespace.c (cp_lookup_symbol_imports_or_template): Use
get_objfile_arch.
* elfread.c (elf_rel_plt_read, elf_gnu_ifunc_record_cache)
(elf_gnu_ifunc_resolve_by_got): Use get_objfile_arch.
* jit.c (jit_object_close_impl): Update.
* jv-lang.c (get_dynamics_objfile): Update.
* linespec.c (add_minsym): Use get_dynamics_objfile.
* objfiles.c (get_objfile_bfd_data): Initialize 'gdbarch' field.
(allocate_objfile): Don't initialize 'gdbarch' field.
(get_objfile_arch): Update.
* objfiles.h (struct objfile_per_bfd_storage) <gdbarch>: New field,
moved from...
(struct objfile) <gdbarch>: ... here. Remove.
* stap-probe.c (stap_can_evaluate_probe_arguments): Use
get_objfile_arch.
* symfile.c (init_entry_point_info): Use get_objfile_arch.
|
|
* cp-namespace.c (find_symbol_in_baseclass): Call
cp_lookup_symbol_in_namespace instead of cp_lookup_symbol_namespace.
Check result of call to lookup_symbol_static.
Call lookup_static_symbol_aux unconditionally.
Call check_typedef on base types before accessing them.
(cp_lookup_nested_symbol): Fix comment.
testsuite/
* gdb.cp/derivation2.cc: New file.
* gdb.cp/derivation.cc (main): Call foo2.
* gdb.cp/derivation.exp: Add tests for typedefs in another
file, and when there's an active block.
|
|
cp_lookup_symbol_imports_or_template could return without
running cleanups.
* cp-namespace.c (cp_lookup_symbol_imports_or_template): Call
do_cleanups on all return paths.
|
|
Subject: [PATCH] Fix for PR c++/15203 and PR c++/15210
Date: Sat, 09 Mar 2013 02:50:49 -0300 (5 days, 4 hours, 57 minutes ago)
Message-ID: <m3a9qdnmti.fsf@redhat.com>
Hi,
This bug was reported internally at our Bugzilla, along with a proposed
fix. After talking to Keith about it, he investigated and came up with
another patch needed to really fix the issue on CVS HEAD.
The first part of the fix is the patch to cp-namespace.c. It handles
the case when we are accessing a static variable inside a function
(inside a class) by the full linespec (is it right, Keith?). E.g.:
class foo
{
public:
int bar()
{
static int var = 0;
}
};
And then, printing the value of `var':
(gdb) print 'foo::bar()::var'
GDB would fall in an internal_error:
gdb/cp-namespace.c:816: internal-error: cp_lookup_nested_symbol called on a non-aggregate type.
This is because `cp_lookup_nested_symbol' is not handling the case when
TYPE_CODE is either _FUNC or _METHOD. This patch fixes it by returning
NULL in this case.
The second part of the fix is the patch to elfread.c. It is needed
because the BSF_GNU_UNIQUE flag was added to some symbols in
<http://sourceware.org/ml/binutils/2009-06/msg00016.html>. Because of
that, (still) the command:
(gdb) print 'foo::bar()::var'
where `var' is a static variable returns:
"No symbol "foo::bar()::var" in current context."
So with the second patch applied the command finally DTRT:
(gdb) print 'foo::bar()::var'
$1 = 0
This may not be the ideal solution, according to Keith it would be good
to implement productions on c-exp.y in order to recognize
CLASS::FUNCTION::VARIABLE, but it is a solution which works with what we
have today.
I regtested it in Fedora 17 x86_64 with -m64 and -m32, including
gdbserver, without regressions.
gdb/:
2013-03-14 Keith Seitz <keiths@redhat.com>
Alan Matsuoka <alanm@redhat.com>
PR c++/15203
PR c++/15210
* cp-namespace.c (cp_lookup_nested_symbol): Handle TYPE_CODE_FUNC and
TYPE_CODE_METHOD.
* elfread.c (elf_symtab_read): Handle BSF_GNU_UNIQUE for certain
symbols.
gdb/testsuite/:
2013-03-14 Sergio Durigan Junior <sergiodj@redhat.com>
PR c++/15203
PR c++/15210
* gdb.cp/m-static.cc (keepalive_int): New function.
(gnu_obj_1::method): New variable `sintvar', call `keepalive_int'.
* gdb.cp/m-static.exp: New test for `sintvar'.
|
|
* charset.c (intermediate_encoding): Remove unused i.
* completer.c (signal_completer): Remove unused i.
* continuations.c (discard_my_continuations_1): Remove unused
continuation_ptr.
* corelow.c (core_close): Remove unuseD name.
(get_core_siginfo): Remove unused pid.
* cp-namespace.c (cp_lookup_symbol_imports_or_template): Remove unused
i, cps.
* dwarf2loc.c (dwarf2_compile_expr_to_ax): Remove unused base_offset.
(loclist_describe_location): Remove unused first.
* event-top.c (command_line_handler): Remove unused got_eof.
* exec.c (exec_close_1): Remove unused need_symtab_cleanup.
(resize_section_table): Remove unused old_value.
* gdb_bfd.c (gdb_bfd_map_section): Remove unused header.
* gnu-v3-abi.c (compute_vtable_size): Remove unused addr.
* i386-tdep.c (i386_process_record): Remove unused rex.
* infcmd.c (get_return_value): Remove unused uiout.
* jv-lang.c (type_from_class): Remove unused is_array.
* jv-valprint.c (java_val_print): Remove unused i.
* linux-nat.c (linux_nat_stop_lwp): Remove unused ptid.
* linux-thread-db.c (thread_db_find_new_threads_2): Remove unuseD pid.
* m2-typeprint.c (m2_print_type): Remove unused code.
* macroexp.c (get_character_constant): Remove unused body_start.
(macro_stringify): Remove unused result.
* objc-lang.c (find_methods): Remove unused gdbarch.
* objfiles.c (filter_overlapping_sections): Remove unused abfd1, abfd2.
* regcache.c (regcache_cooked_read): Remove unused gdbarch.
* stack.c (print_frame_args): Remove unused summary.
* thread.c (thread_apply_command): Remove unused p.
* valarith.c (value_x_unop): Remove unused mangle_ptr.
* valops.c (search_struct_method): Remove unused skip.
* valprint.c (generic_val_print): Remove unused byte_order.
* varobj.c (varobj_update): Remove unused changed.
* cli/cli-cmds.c (complete_command): Remove unused next_item.
(alias_command): Remove unused c.
* mi/mi-cmd-catch.c (mi_catch_load_unload): Remove unused c.
* mi/mi-main.c (mi_cmd_data_write_register_values): Remove unused
format.
(mi_cmd_data_write_memory): Remove unused word_format.
(mi_cmd_data_write_memory_bytes): Remove unused r.
* python/py-gdb-readline.c (gdbpy_readline_wrapper): Remove unused
p_start, p_end.
* python/python.c (_initialize_python): Remove unused cmd_name, cmd.
* tui/tui-disasm.c (tui_set_disassem_content): Remove unused
line_width.
Reference: http://sourceware.org/ml/gdb-patches/2013-01/msg00766.html
|
|
* cp-support.h (cp_set_block_scope): Remove.
* dbxread.c: Include block.h.
(cp_set_block_scope): New function.
(process_one_symbol): Update.
* dwarf2read.c (read_func_scope): Use block_set_scope.
|
|
(cp_add_using_directive): Add 'copy_names' argument.
* cp-support.h (cp_add_using_directive): Update.
(struct using_direct) <import_src, import_dest, alias,
declaration>: Now const.
* dwarf2read.c (read_import_statement): Use obconcat.
Don't copy names passed to cp_add_using_directive.
|
|
* symfile.c (obsavestring): Remove.
* ada-exp.y: Use obstack_copy0, not obsavestring.
* ada-lang.c: Use obstack_copy0, not obsavestring.
* coffread.c: Use obstack_copy0, not obsavestring.
* cp-namespace.c: Use obstack_copy0, not obsavestring.
* dbxread.c: Use obstack_copy0, not obsavestring.
* dwarf2read.c: Use obstack_copy0, not obsavestring.
* jit.c: Use obstack_copy0, not obsavestring.
* mdebugread.c: Use obstack_copy0, not obsavestring.
* psymtab.c: Use obstack_copy0, not obsavestring.
* stabsread.c: Use obstack_copy0, not obsavestring.
* xcoffread.c: Use obstack_copy0, not obsavestring.
|
|
Two modifications:
1. The addition of 2013 to the copyright year range for every file;
2. The use of a single year range, instead of potentially multiple
year ranges, as approved by the FSF.
|
|
* cp-namespace.c (cp_lookup_symbol_in_namespace): Add SEARCH
parameter and pass it to lookup_symbol_file.
(cp_lookup_symbol_imports): Tell cp_lookup_symbol_in_namespace
to search base classes.
(cp_lookup_symbol_namespace): Likewise.
(lookup_namespace_scope): Likewise.
(lookup_symbol_file): Add SEARCH parameter.
If SEARCH is non-zero and no symbol is found, lookup the class
and call cp_lookup_nested_symbol.
(find_symbol_in_baseclass): New function.
(cp_lookup_nested_symbol): Do not let
cp_lookup_symbol_in_namespace search through base classes.
Do that later when there is no global symbol match.
PR c++/13615
* gdb.cp/baseenum.cc: New file.
* gdb.cp/baseenum.exp: New file.
* gdb.cp/derivation.cc (A): Add copyright.
Add a typedef.
(B): Use A::value_type instead of int. Change all references.
(D): Use value_type instead of int. Change all references.
(E): Likewise.
(F); Likewise.
(Z): New class.
(ZZ): New class.
(N, Base, Derived): New namespace and classes.
(main): Add instances of Z and ZZ.
Make sure all symbols from N are kept.
* gdb.cp/derivation.exp: Update typedef changes in tests.
Add tests for class typedefs both before and after starting
the inferior.
Add tests for searching for a typedef while stopped in a
method.
|
|
* charset.c (convert_between_encodings): Use xsnprintf.
* cli-out.c (cli_field_int): Likewise.
* cp-namespace.c (cp_lookup_nested_symbol): Likewise.
* expprint.c (op_name_standard): Likewise.
* frv-tdep.c (set_variant_num_gprs): Likewise.
(set_variant_num_fprs): Likewise.
* m68hc11-tdep.c (m68hc11_initialize_register_info): Likewise.
* nto-tdep.c (nto_find_and_open_solib): Likewise.
(nto_init_solib_absolute_prefix): Likewise.
* source.c (init_source_path): Likewise.
(print_source_lines_base): Likewise.
* valprint.c (print_wchar): Likewise.
* mi/mi-out.c (mi_field_int): Likewise.
windows-nat.c (windows_pid_to_exec_file): Likewise.
(windows_create_inferior): Likewise.
(_initialize_check_for_gdb_ini): Likewise.
|
|
PR c++/14177 - Fix parsing TYPENAME:: in parentheses.
* c-exp.y (classify_inner_name): Remove caller assumptions in the
function comment. Return ERROR for unresolved cases. Implement
returning proper NAME.
(yylex): Accept also NAME from classify_inner_name.
* cp-namespace.c (cp_lookup_nested_type): Rename to ...
(cp_lookup_nested_symbol): ... here. Return any found symbol, not just
LOC_TYPEDEF type.
* cp-support.h (cp_lookup_nested_type): Update its declaration.
gdb/testsuite/
PR c++/14177 - Fix parsing TYPENAME:: in parentheses.
* gdb.cp/cpexprs.cc (class CV, CV::i, ATTRIBUTE_USED, CV_f): New.
(test_function): Call CV_f.
* gdb.cp/cpexprs.exp (p 'CV::m(int)', p CV::m(int))
(p 'CV::m(int) const', p CV::m(int) const, p 'CV::m(int) volatile')
(p CV::m(int) volatile, p 'CV::m(int) const volatile')
(p CV::m(int) const volatile, p CV_f(int), p CV_f(CV::t))
(p CV_f(CV::i)): New tests.
|
|
gdb/ChangeLog:
Copyright year update in most files of the GDB Project.
|
|
|
|
arguments by adding OBJFILE. Instead of getting objfile from
symbol's symtab, use new argument OBJFILE.
* cp-support.h (cp_scan_for_anonymous_namespaces): Changed function
arguments by adding OBJFILE.
* gdb/dwarf2read.c (new_symbol_full): Change call to
cp_scan_for_anonymous_namespaces to match new signature.
* gdb/stabsread.c (define_symbol): Change call to
cp_scan_for_anonymous_namespaces to match new signature.
|