* elfnn-aarch64.c (elfNN_aarch64_howto_table): Use
R_AARCH64_TLS_DTPMOD64 instead of R_AARCH64_TLS_DTPMOD;
likewise for R_AARCH64_TLS_DTPREL and R_AARCH64_TLS_TPREL.
include/elf/
* aarch64.h: Define R_AARCH64_TLS_DTPMOD64,
R_AARCH64_TLS_DTPREL64 and R_AARCH64_TLS_TPREL64; guard
R_AARCH64_TLS_DTPMOD, R_AARCH64_TLS_DTPREL and
R_AARCH64_TLS_TPREL with RELOC_MACROS_GEN_FUNC.
Rather than having -list-features report support for the GDB/MI
commands providing access to Ada exception catchpoints with one entry,
and the GDB/MI command providing the list of Ada exceptions with
a second entry, this patch merges it all within one single entry.
This is OK, because all these commands were added within a short
amount of time, and within the same release cycle; and it reduces
a bit the size of the output.
gdb/ChangeLog:
* mi/mi-main.c (mi_cmd_list_features): Replace "info-ada-exceptions"
entry with "ada-exceptions".
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Miscellaneous Commands): Delete
the documentation of "info-ada-exceptions" in the output
of the "-list-features" command. Add the documentation
of the "ada-exception" entry instead.
This patch aims at fixing the following problem, where the user:
. debugs its program
. makes a modification and rebuilds it *without exiting the debugger*
. returns to its debugging session and restarts the inferior
In that situation, the debugger notices that the underlying executable
has changed and that re-reading its symbols is needed. Shortly after
displaying a message informing the user of the situation, GDB crashes:
(gdb) run
[...]
`/[...]/dest' has changed; re-reading symbols.
zsh: 13434922 segmentation fault (core dumped)
The crash occurs while trying to allocate some memory on the bfd_bfd
obstack. But, at some point in time, the whole obstack data gets
corrupted, nullified. So the memory allocation fails trying to call
a function at a NULL address. (side note: when debugging GDB in GDB,
top-gdb reports a SIGILL, while the shell makes it look like it was
a SIGSEGV - the discrepancy is not critical to the investigation
and therefore was not explored)
The corruption occurred because the region where the per_bfd data
got free'ed nearly after it got allocated! This is what happens,
in chronological order (see reread_symbols):
1. GDB notices that the executable has changed, decides to
re-read its symbols.
2. Opens a new bfd, unrefs the old one
3. Calls set_objfile_per_bfd (objfile);
4. Re-initializes the objfile's obstack:
obstack_init (&objfile->objfile_obstack);
I think that the normal behavior for set_objfile_per_bfd would
be to search for already-allocated shared per_bfd data, and
allocate new one if not found. The critical difference between
a platform such as x86_64-linuxe where it works, and ppc-aix,
where it doesn't lies in the fact that bfd-data sharing is not
activated on ppc-aix, and as a result, the per-bfd data gets
allocated on the objfile's obstack instead of in the bfd objalloc:
/* If the object requires gdb to do relocations, we simply fall
back to not sharing data across users. These cases are rare
enough that this seems reasonable. */
if (abfd != NULL && !gdb_bfd_requires_relocations (abfd))
{
storage = bfd_zalloc (abfd, sizeof (struct objfile_per_bfd_storage));
set_bfd_data (abfd, objfiles_bfd_data, storage);
}
else
storage = OBSTACK_ZALLOC (&objfile->objfile_obstack,
struct objfile_per_bfd_storage);
Allocating that per_bfd storage is of course nearly useless since
we end up free-ing right after in step (4) above. Eventually,
the memory region ends up being re-used, hence the corruption
leading to the crash.
This fix was simply to move the call to set_objfile_per_bfd after
the objfile's obstack re-initialization.
gdb/ChangeLog:
* symfile.c (reread_symbols): Move call to set_objfile_per_bfd
after re-initialization of OBJFILE's obstack.
Upstream GCC's new pass '-fisolate-erroneous-paths' may introduce
traps at places where GCC has determined undefined behavior, e.g. when
passing a NULL pointer to a function that defines this argument as
__attribute__(__nonnull__(...)). In particular this applies to
uniquify_strings(), because it invokes qsort() with NULL when the
'strings' vector is empty. I hit this problem on s390x when trying to
execute "break main" on a C program.
gdb/
2013-11-12 Andreas Arnez <arnez@linux.vnet.ibm.com>
* objc-lang.c (uniquify_strings): Prevent invoking qsort with
NULL.
* dwarf2read.c (read_index_from_section): Update comment.
(struct dw2_symtab_iterator): New member global_seen.
(dw2_symtab_iter_init): Initialize it.
(dw2_symtab_iter_next): Skip duplicate global symbols.
(dw2_expand_symtabs_matching): Ditto.
gdb/doc/ChangeLog:
* gdb.texinfo (Ada): Add entry in menu for new "Ada Exceptions" node.
(Ada Exceptions): New node.
(GDB/MI): Add entry in menu for new "GDB/MI Ada Exceptions
Commands" node.
(GDB/MI Ada Exceptions Commands): New node.
(GDB/MI Miscellaneous Commands): Document new "info-ada-exceptions"
field in the output of the "-list-features" command.
* NEWS: Add entry for the new "info exceptions" CLI command,
and for the new "-info-ada-exceptions" GDB/MI command.
This patch implements a new GDB/MI command implementing the equivalent
of the "info exceptions" CLI command. The command syntax is:
-info-ada-exceptions [REGEXP]
Here is an example of usage (slightly formatted by hand to make it
easier to read):
-info-ada-exceptions ions\.a_
^done,ada-exceptions=
{nr_rows="2",nr_cols="2",
hdr=[{width="1",alignment="-1",col_name="name",colhdr="Name"},
{width="1",alignment="-1",col_name="address",colhdr="Address"}],
body=[{name="global_exceptions.a_global_exception",
address="0x0000000000613a80"},
{name="global_exceptions.a_private_exception",
address="0x0000000000613ac0"}]}
Also, in order to allow graphical frontends to easily determine
whether this command is available or not, the output of the
"-list-features" command has been augmented to contain
"info-ada-exceptions".
gdb/Changelog:
* mi/mi-cmds.h (mi_cmd_info_ada_exceptions): Add declaration.
* mi/mi-cmds.c (mi_cmds): Add entry for -info-ada-exceptions
command.
* mi/mi-cmd-info.c: #include "ada-lang.c" and "arch-utils.c".
(mi_cmd_info_ada_exceptions): New function.
* mi/mi-main.c (mi_cmd_list_features): Add "info-ada-exceptions".
gdb/testsuite/ChangeLog:
* gdb.ada/mi_exc_info: New testcase.
This patch adds a new command "info exceptions" whose purpose is to
provide the list of exceptions currently defined in the inferior.
The usage is:
(gdb) info exceptions [REGEXP]
Without argument, the command lists all exceptions. Otherwise,
only those whose name match REGEXP are listed.
For instance:
(gdb) info exceptions
All defined Ada exceptions:
constraint_error: 0x613dc0
program_error: 0x613d40
storage_error: 0x613d00
tasking_error: 0x613cc0
global_exceptions.a_global_exception: 0x613a80
global_exceptions.a_private_exception: 0x613ac0
The name of the command, as well as its output is part of a legacy
I inherited long ago. It's output being parsed by frontends such as
GPS, I cannot easily change it. Same for the command name.
The implementation is mostly self-contained, and is written in a way
that should make it easy to implement the GDB/MI equivalent. The
careful reviewer will notice that the code added in ada-lang.h could
normally be made private inside ada-lang.c. But these will be used
by the GDB/MI implementation. Rather than making those private now,
only to move them later, I've made them public right away.
gdb/ChangeLog:
* ada-lang.h: #include "vec.h".
(struct ada_exc_info): New.
(ada_exc_info): New typedef.
(DEF_VEC_O(ada_exc_info)): New vector.
(ada_exceptions_list): Add declaration.
* ada-lang.c (ada_is_exception_sym)
(ada_is_non_standard_exception_sym, compare_ada_exception_info)
(sort_remove_dups_ada_exceptions_list)
(ada_exc_search_name_matches, ada_add_standard_exceptions)
(ada_add_exceptions_from_frame, ada_add_global_exceptions)
(ada_exceptions_list_1, ada_exceptions_list)
(info_exceptions_command): New function.
(_initialize_ada_language): Add "info exception" command.
gdb/testsuite/ChangeLog:
* gdb.ada/info_exc: New testcase.
When using the GDB/MI commands to insert a catchpoint on a specific
Ada exception, any re-evaluation of that catchpoint (for instance
a re-evaluation performed after a shared library got mapped by the
inferior) fails. For instance, with any Ada program:
(gdb)
-catch-exception -e program_error
^done,bkptno="1",bkpt={[...]}
(gdb)
-exec-run
=thread-group-started,id="i1",pid="28315"
=thread-created,id="1",group-id="i1"
^running
*running,thread-id="all"
(gdb)
=library-loaded,[...]
&"warning: failed to reevaluate internal exception condition for catchpoint 1: No definition of \"exec\" in current context.\n"
&"warning: failed to reevaluate internal exception condition for catchpoint 1: No definition of \"exec\" in current context.\n"
[...]
The same is true if using an Ada exception catchpoint.
The problem comes from the fact that that we deallocate the strings
given as arguments to create_ada_exception_catchpoint, while the latter
just makes shallow copies of those strings, thus creating dandling
pointers.
This patch fixes the issue by passing freshly allocated strings to
create_ada_exception_catchpoint, while at the same time updating
create_ada_exception_catchpoint's documentation to make it clear
that deallocating the strings is no longer the responsibility of
the caller.
gdb/ChangeLog:
* ada-lang.c (create_ada_exception_catchpoint): Enhance
the documentation of fields "except_string" and "condition".
* mi/mi-cmd-catch.c (mi_cmd_catch_assert): Reallocate
CONDITION on the heap before passing it to
create_ada_exception_catchpoint.
(mi_cmd_catch_exception): Likewise for EXCEPTION_NAME and
CONDITION.
gdb/testsuite/ChangeLog:
* gdb.ada/mi_ex_cond: New testcase.
Tested on x86_64-linux. The "-break-list" test FAILs without
this patch.
An earlier patch removed the check for "syscall" since the results
were not used in the C code. However, the result was used, via the
cache variable, elsewhere in configure.
This patch fixes the problem by checking for "syscall" at the point at
which HAVE_TKILL_SYSCALL is defined.
2013-11-11 Tom Tromey <tromey@redhat.com>
* config.in, configure: Rebuild.
* configure.ac (HAVE_TKILL_SYSCALL): Check for "syscall".
Some places in elf64-ppc.c carelessly used SYMBOL_CALLS_LOCAL when
the proper test is SYMBOL_REFERENCES_LOCAL for cases where we take the
address of a protected symbol. This works OK for function descriptors
but not for ELFv2. Setting symbols to their global entry stub a
little earlier is to ensure _bfd_elf_hash_symbol allows such symbols
in .gnu.hash.
* elf64-ppc.c (ppc64_elf_edit_toc): Use SYMBOL_REFERENCES_LOCAL
here, not SYMBOL_CALLS_LOCAL.
(ppc64_elf_relocate_section): Likewise.
(size_global_entry_stubs): Set undefined symbols on their global
entry stubs here..
(build_global_entry_stubs): ..rather than here.
(ppc64_elf_build_stubs): Don't reset glink->size before calling
build_global_entry_stubs.
* dwarf2read.c (dwarf2_read_debug): Change to unsigned int.
(create_debug_types_hash_table): Only print debugging messages for
each TU if dwarf2-read >= 2.
(process_queue): Ditto.
(_initialize_dwarf2_read): Make "set debug dwarf2-read" a zuinteger.
Update doc string.
doc/
* gdb.texinfo (Debugging Output): Update text for
"set debug dwarf2-read".
My grepping around showed that HAVE_MULTIPLE_PROC_FDS is only ever
mentioned in a comment in configure.ac. Since the macro is long dead,
let's remove the last mention.
2013-11-08 Tom Tromey <tromey@redhat.com>
* configure: Rebuild.
* configure.ac: Remove mentions of HAVE_MULTIPLE_PROC_FDS.
Now that the configury needed for the "common" and "target"
directories is in common.m4, some code in gdb's configure.ac is
redundant.
I ran this script after making an "ID" file using mkid:
sed -n 's/^.*\(HAVE_[A-Z0-9_]*\).*$/\1/p' config.in |
while read x; do
echo ===== $x
gid $x | egrep -v '^(testsuite|gnulib|common|target|gdbserver)/'
done
This finds all the spots using HAVE_ defines, and, more importantly,
makes it clear which defines aren't used in the main parts of gdb.
From this I came up with this patch to remove all the unused bits.
There are a few that are subtly used -- for example the configure
script sometimes checks internal configure cache variables, meaning
some checks cannot be removed.
2013-11-08 Tom Tromey <tromey@redhat.com>
* configure, config.in: Rebuild.
* configure.ac: Remove unused configury.
m32c-tdep.c is the last user of HAVE_STRING_H in gdb proper. It
really ought to be using gdb_string.h instead, as the rest of gdb
does.
2013-11-08 Tom Tromey <tromey@redhat.com>
* m32c-tdep.c: Use gdb_string.h.
The removal of solib-sunos.c also removed the last user of various
macros defined by configure.
This patch removes the corresponding configure code.
2013-11-08 Tom Tromey <tromey@redhat.com>
* configure, config.in: Rebuild.
* configure.ac: Remove all link.h-related checks.
It has bothered me for a while that files in common/ use macros
defined via autoconf checks, but rely on each configure.ac doing the
proper checks independently.
This patch introduces common/common.m4 which consolidates the checks
assumed by code in common.
The rule I propose is that if something is needed or used by common,
it should be checked for by common.m4. However, if the check is also
needed by gdb or gdbserver, then it should be duplicated there.
Built and regtested on x86-64 Fedora 18 (though this is hardly the
most strenuous case) and using the Fedora 18 mingw cross compilers. I
also examined the config.in diffs to ensure that symbols did not go
missing.
2013-11-08 Tom Tromey <tromey@redhat.com>
* acinclude.m4: Include common.m4.
* common/common.m4: New file.
* configure, config.in: Rebuild.
* configure.ac: Use GDB_AC_COMMON.
2013-11-08 Tom Tromey <tromey@redhat.com>
* acinclude.m4: Include common.m4, codeset.m4.
* configure, config.in: Rebuild.
* configure.ac: Use GDB_AC_COMMON.
2013-11-04 Balaji V. Iyer <balaji.v.iyer@intel.com>
* configure.ac: Added libcilkrts to noconfig list when C++ is not
supported.
* configure: Regenerated.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204396 138bc75d-0d04-0410-961f-82ee72b054a4
* cp-demangle.c (struct d_saved_scope): New structure.
(struct d_print_info): New fields saved_scopes and
num_saved_scopes.
(d_print_init): Initialize the above.
(d_print_free): New function.
(cplus_demangle_print_callback): Call the above.
(d_copy_templates): New function.
(d_print_comp): New variables saved_templates and
need_template_restore.
[DEMANGLE_COMPONENT_REFERENCE,
DEMANGLE_COMPONENT_RVALUE_REFERENCE]: Capture scope the first
time the component is traversed, and use the captured scope for
subsequent traversals.
* testsuite/demangle-expected: Add regression test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204068 138bc75d-0d04-0410-961f-82ee72b054a4