• R/O
  • HTTP
  • SSH
  • HTTPS

List of commits

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


users/simark/mi-symbols-output
RSS
Rev. Tiempo Autor
90c3c3e users/simark/mi-symbols-output 2019-11-21 14:27:37 Simon Marchi

Hi Andrew

Change-Id: I695d9860d6f7dae86f966dfc0524b934660478da

379876d 2019-11-21 13:11:41 Andrew Burgess

gdb/mi: Add new commands -symbol-info-{functions,variables,types}

Add new MI commands -symbol-info-functions, -symbol-info-variables,
and -symbol-info-types which correspond to the CLI commands 'info
functions', 'info variables', and 'info types' respectively.

gdb/ChangeLog:

* mi/mi-cmds.c (mi_cmds): Add '-symbol-info-functions',
'-symbol-info-variables', and '-symbol-info-types'.
* mi/mi-cmds.h (mi_cmd_symbol_info_functions): Declare.
(mi_cmd_symbol_info_variables): Declare.
(mi_cmd_symbol_info_types): Declare.
* mi/mi-symbol-cmds.c: Add 'source.h' and 'mi-getopt.h' includes.
(mi_info_one_symbol_details): New function.
(class mi_symbol_info_emitter): New class.
(mi_symbol_info): New function.
(mi_info_functions_or_variables): New function.
(mi_cmd_symbol_info_functions): New function.
(mi_cmd_symbol_info_types): New function.
(mi_cmd_symbol_info_variables): New function.
* NEWS: Mention new commands.

gdb/testsuite/ChangeLog:

* gdb.mi/mi-sym-info-1.c: New file.
* gdb.mi/mi-sym-info-2.c: New file.
* gdb.mi/mi-sym-info.exp: New file.

gdb/doc/ChangeLog:

* doc/gdb.texinfo (GDB/MI Symbol Query): Document new MI command
-symbol-info-functions, -symbol-info-types, and
-symbol-info-variables.

Change-Id: Ic2fc6a6750bbce91cdde2344791014e5ef45642d

ce8ccaa 2019-11-21 13:11:40 Andrew Burgess

gdb: Split print_symbol_info into two parts

Split the function print_symbol_info into two parts, the new worker
core returns a string, which print_symbol_info then prints. This will
be useful in a later commit when some new MI commands will be added
which will use the worker core to fill some MI output fields.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* symtab.c (symbol_to_info_string): New function, most content
moved from print_symbol_info, but updated to return a std::string.
(print_symbol_info): Update to use symbol_to_info_string and print
returned string.
* symtab.h (symbol_to_info_string): Declare new function.

Change-Id: I6454ce43cacb61d32fbadb9e3655e70823085777

2c05882 2019-11-21 13:11:40 Andrew Burgess

gdb: Introduce global_symbol_searcher

Introduce a new class to wrap up the parameters needed for the
function search_symbols, which has now become a member function of
this new class.

The motivation is that search_symbols already takes a lot of
parameters, and a future commit is going to add even more. This
commit hopefully makes collecting the state required for a search
easier.

As part of this conversion the list of filenames in which to search
has been converted to a std::vector.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* python/python.c (gdbpy_rbreak): Convert to using
global_symbol_searcher.
* symtab.c (file_matches): Convert return type to bool, change
file list to std::vector.
(search_symbols): Rename to...
(global_symbol_searcher::search): ...this and update now its
a member function of global_symbol_searcher. Take account of the
changes to file_matches.
(symtab_symbol_info): Convert to using global_symbol_searcher.
(rbreak_command): Likewise.
(search_module_symbols): Likewise.
* symtab.h (enum symbol_search): Update comment.
(search_symbols): Remove declaration.
(class global_symbol_searcher): New class.

Change-Id: I488ab292a892d9e9e84775c632c5f198b6ad3710

b13e475 2019-11-21 09:00:23 GDB Administrator

Automatic date update in version.in

4f22c3f 2019-11-21 06:31:35 Sergio Durigan Junior

Add missing parentheses on 'print' (gdb.python/py-progspace.exp)

Commit 33d569b709886a1208145806da80b689d9cae9da ("gdb/python: Return
None from Progspace.block_for_pc on error") added a few tests on
gdb.python/py-progspace.exp which use 'print', but forgot to use
parentheses when passing the arguments to be printed. This fails on
Python 3.

This commit adds these missing parentheses. Pushed as obvious.

gdb/testsuite/ChangeLog:
2019-11-20 Sergio Durigan Junior <sergiodj@redhat.com>

* gdb.python/py-progspace.exp: Add missing parentheses on some
'print' commands.

Change-Id: Iac0a7578855d128bbee3b98e7ea5888dae55fc00

6cdd651 2019-11-21 01:57:34 Luis Machado

Improve target description check for SVE in gdbserver

The current code checks for the presence of a SVE target description by
comparing the number of registers. This is a bit fragile since the number
of registers can change whenever we add new sets. Like PAC, for example.

If the comparison breaks, then we're left with SVE registers in the
description, but gdbserver doesn't send the registers to GDB, which in
turn displays stale information to the user.

The following patch changes the check to use the SVE feature string instead,
which hopefully should be more stable.

gdb/gdbserver/ChangeLog:

2019-11-20 Luis Machado <luis.machado@linaro.org>

* linux-aarch64-low.c (is_sve_tdesc): Check against target feature
instead of register count.
* tdesc.c (tdesc_contains_feature): New function.
* tdesc.h (tdesc_contains_feature): New prototype.

Change-Id: I28b782cb1677560ca9a06a1be442974b25aabae4

94c9b9d 2019-11-20 20:29:33 Alan Modra

PR24944, gas doesn't read enough digits when parsing a floating point number

PR 24944
* atof-generic.c (atof_generic): Increase decimal guard digits.
* testsuite/gas/i386/fp.s: Add more tests.
* testsuite/gas/i386/fp.d: Update.

e042e6c 2019-11-20 18:16:24 Jose E. Marchesi

cpu: fix comment in bpf.cpu

2019-11-20 Jose E. Marchesi <jose.marchesi@oracle.com>

* bpf.cpu: Fix comment describing the 128-bit instruction format.

fa4dea2 2019-11-20 09:00:29 GDB Administrator

Automatic date update in version.in

9f6ad28 2019-11-20 05:27:25 Tom Tromey

Fix the "winheight" command

The "winheight" command is broken. I probably broke it in one of my
TUI refactoring patches, though I didn't track down exactly which one.

The bug is that the code does:

*buf_ptr = '\0';

... but then never advances buf_ptr past this point, so no window name
is seen.

This patch refactors the code a bit so that a copy of the argument
string is not needed, also fixing the bug.

A new test case is included.

gdb/ChangeLog
2019-11-19 Tom Tromey <tom@tromey.com>

* tui/tui-win.c (tui_partial_win_by_name): Move from tui-data.c.
Now static. Change type of "name".
(tui_set_win_height_command): Don't copy "arg".
* tui/tui-data.h (tui_partial_win_by_name): Don't declare.
* tui/tui-data.c (tui_partial_win_by_name): Move to tui-win.c.

gdb/testsuite/ChangeLog
2019-11-19 Tom Tromey <tom@tromey.com>

* gdb.tui/winheight.exp: New file.

Change-Id: I0871e93777a70036dbec9c9543f862f42e3a81e5

435d3d8 2019-11-20 04:37:53 Ali Tamur

Replace "if (attr)" with "if (attr != nullptr)".

This is a cleanup patch in response to a reviewer comment on "Dwarf 5: Handle
debug_str_offsets" patch.

c9739b6 2019-11-20 00:33:53 Tom Tromey

Report GetLastError value when DebugActiveProcess fails

When DebugActiveProcess fails, the error message is fairly generic:

error (_("Can't attach to process."));

It would be more useful for diagnosing problems if the Windows error
code was included in the message. This patch implements this.

gdb/ChangeLog
2019-11-19 Tom Tromey <tromey@adacore.com>

* windows-nat.c (windows_nat_target::attach): Include GetLastError
result in error when DebugActiveProcess fails.

Change-Id: Ie1bf502a0d96bb7c09bd5b1c5e0c924ba58cd68c

f2032b6 2019-11-19 20:02:42 Alan Modra

PR24499, ignore --add-gnu-debuglink for archives

objcopy --add-gnu-debuglink=foo.a.dbg foo.a just doesn't make any
sense. Who puts executables in archives?

PR 24499
* objcopy.c (copy_file): Ignore --add-gnu-debuglink for archives.

6765ee1 2019-11-19 17:56:40 Alan Modra

PR24968, make objcopy use output ELF arch if -B not given

This should make objcopy -B redundant for the common case of producing
ELF output where the -O target defaults to the desired arch:mach.

PR 24968
* objcopy.c (copy_object): For ELF output and non-ELF input without
arch, take arch from output file if not given by -B. Don't
bfd_get_arch_info when we already have iarch.

dd68a12 2019-11-19 14:01:48 Alan Modra

PR25191, internal error in _bfd_elf_set_section_contents

This PR copies a fuzzed PE input file to ELF output, in the process
confusing the ELF backend by copying COFF-only section flags to the
output. SEC_COFF_SHARED has the same value as SEC_ELF_COMPRESS. One
approach to fixing this problem is of course not to reuse flag bits,
but we've run out. So this patch only copies section flags that are
in the bfd_applicable_section_flags set when changing the flavour of
the output file.

PR 25191
* objcopy.c (is_nondebug_keep_contents_section): Use bfd_get_flavour.
(copy_object): Likewise.
(setup_section): Likewise. If flavour of input and output files
differ, restrict section flags to the intersection of input and
output bfd_applicable_section_flags.

f14080d 2019-11-19 11:01:22 Alan Modra

PR25197, assertion fail coffgen.c

The testcase in this PR triggered "BFD_ASSERT (p2->is_sym)" by
sneakily generating a C_FILE sym whose value pointed into auxents.
The fix then is in the last changed line of this patch, to check
p->is_sym as well as p->u.syment.n_sclass. The other changes fix
various overflow checks that weren't as solid as they could be.

PR 25197
* coffgen.c (coff_find_nearest_line_with_names): Check that C_FILE
u.syment.n_value does point at another C_FILE sym and not into
some auxent that happens to look like a C_FILE. Properly check
for integer overflow and avoid possible pointer wrap-around.
Simplify pr17512 checks.

df56ecd 2019-11-19 11:01:22 Alan Modra

Add space between program name and file for objcopy/strip/objdump messages

The GNU coding standard does indicate there should be no space in
messages like these, but we tend to put a space in all other
messages. This patch cures the inconsistency in:

$ binutils/strip-new -F elf32-little -N .text -o pr25200 pr25200.bin
binutils/strip-new: pr25200: R_X86_64_PLT32 unsupported
binutils/strip-new:pr25200: sorry, cannot handle this file

* bucomm.c (bfd_nonfatal_message): Add a space between program
name and file.

0b8dbf3 2019-11-19 09:37:21 Andrew Burgess

gdb/testsuite: Merge whatis.exp and ctf-whatis.exp

The recently added gdb.base/ctf-whatis.exp test is a slightly modified
version of gdb.base/whatis.exp, with a few tests removed, and the
source compiled with different compiler options. This patch merges
the two tests together into a single test script.

I tested using a version of GCC with CTF support added.

gdb/testsuite/ChangeLog:

* gdb.base/ctf-whatis.c: Delete.
* gdb.base/ctf-whatis.exp: Delete.
* gdb.base/whatis.exp: Rewrite to compile as both dwarf and ctf.

Change-Id: I09e11c70f197b79d2b1e0ae8c86a21c622be6c51

f833b7a 2019-11-19 09:37:21 Andrew Burgess

gdb/testsuite: Merge cvexpr.exp and ctf-cvexpr.exp

The recently added gdb.base/ctf-cvexpr.exp is just a copy of
gdb.base/cvexpr.exp but compiled with different options. This patch
merges these two tests together into a single test script.

I tested this change using a version of GCC with CTF support added.

gdb/testsuite/ChangeLog:

* gdb.base/ctf-cvexpr.exp: Delete.
* gdb.base/cvexpr.exp: Rewrite to compile as both dwarf and ctf.

Change-Id: If678c3e38cb444867defa970203d26563f15dba4

30d0a63 2019-11-19 09:37:20 Andrew Burgess

gdb/testsuite: Introduce skip_ctf_tests guard function

Most versions of GCC in the wild don't support CTF debug format right
now, so, rather than attempting to compile the tests and failing each
time, this patch introduces a guard function to check if the compiler
supports CTF. If we don't have CTF support then the CTF tests are
skipped.

This patch only updates 3 of the 4 CTF tests, the fourth will be
handled in the next patch.

gdb/testsuite/ChangeLog:

* gdb.base/ctf-constvars.exp: Skip test if CTF is not supported in
the compiler. Clean up header comment a little.
* gdb.base/ctf-ptype.exp: Likewise.
* gdb.base/ctf-whatis.exp: Likewise.
* lib/gdb.exp (skip_ctf_tests): New proc.

Change-Id: I505c11169a9bc9871a31fc0c61e119f92f32cc63

494409b 2019-11-19 09:13:43 Sergio Durigan Junior

Fix crash with core + TUI + run

Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1765117

A segfault can happen in a specific scenario when using TUI + a
corefile, as explained in the bug mentioned above. The problem
happens when opening a corefile on GDB:

$ gdb ./core program

entering TUI (C-x a), and then issuing a "run" command. GDB segfaults
with the following stack trace:

(top-gdb) bt
#0 0x00000000004cd5da in target_ops::shortname (this=0x0) at ../../binutils-gdb/gdb/target.h:449
#1 0x0000000000ac08fb in target_shortname () at ../../binutils-gdb/gdb/target.h:1323
#2 0x0000000000ac09ae in tui_locator_window::make_status_line[abi:cxx11]() const (this=0x23e1fa0 <_locator>) at ../../binutils-gdb/gdb/tui/tui-stack.c:86
#3 0x0000000000ac1043 in tui_locator_window::rerender (this=0x23e1fa0 <_locator>) at ../../binutils-gdb/gdb/tui/tui-stack.c:231
#4 0x0000000000ac1632 in tui_show_locator_content () at ../../binutils-gdb/gdb/tui/tui-stack.c:369
#5 0x0000000000ac63b6 in tui_set_key_mode (mode=TUI_COMMAND_MODE) at ../../binutils-gdb/gdb/tui/tui.c:321
#6 0x0000000000aaf9be in tui_inferior_exit (inf=0x2d446a0) at ../../binutils-gdb/gdb/tui/tui-hooks.c:181
#7 0x000000000044cddf in std::_Function_handler<void (inferior*), void (*)(inferior*)>::_M_invoke(std::_Any_data const&, inferior*&&) (__functor=..., __args#0=@0x7fffffffd650: 0x2d446a0)
at /usr/include/c++/9/bits/std_function.h:300
#8 0x0000000000757db9 in std::function<void (inferior*)>::operator()(inferior*) const (this=0x2cf3168, __args#0=0x2d446a0) at /usr/include/c++/9/bits/std_function.h:690
#9 0x0000000000757876 in gdb::observers::observable<inferior*>::notify (this=0x23de0c0 <gdb::observers::inferior_exit>, args#0=0x2d446a0)
at ../../binutils-gdb/gdb/gdbsupport/observable.h:106
#10 0x000000000075532d in exit_inferior_1 (inftoex=0x2d446a0, silent=1) at ../../binutils-gdb/gdb/inferior.c:191
#11 0x0000000000755460 in exit_inferior_silent (inf=0x2d446a0) at ../../binutils-gdb/gdb/inferior.c:234
#12 0x000000000059f47c in core_target::close (this=0x2d68590) at ../../binutils-gdb/gdb/corelow.c:265
#13 0x0000000000a7688c in target_close (targ=0x2d68590) at ../../binutils-gdb/gdb/target.c:3293
#14 0x0000000000a63d74 in target_stack::push (this=0x23e1800 <g_target_stack>, t=0x23c38c8 <the_amd64_linux_nat_target>) at ../../binutils-gdb/gdb/target.c:568
#15 0x0000000000a63dbf in push_target (t=0x23c38c8 <the_amd64_linux_nat_target>) at ../../binutils-gdb/gdb/target.c:583
#16 0x0000000000748088 in inf_ptrace_target::create_inferior (this=0x23c38c8 <the_amd64_linux_nat_target>, exec_file=0x2d58d30 "/usr/bin/cat", allargs="", env=0x25f12b0, from_tty=1)
at ../../binutils-gdb/gdb/inf-ptrace.c:128
#17 0x0000000000795ccb in linux_nat_target::create_inferior (this=0x23c38c8 <the_amd64_linux_nat_target>, exec_file=0x2d58d30 "/usr/bin/cat", allargs="", env=0x25f12b0, from_tty=1)
at ../../binutils-gdb/gdb/linux-nat.c:1094
#18 0x000000000074eae9 in run_command_1 (args=0x0, from_tty=1, run_how=RUN_NORMAL) at ../../binutils-gdb/gdb/infcmd.c:639
...

The problem happens because 'tui_locator_window::make_status_line'
needs the value of 'target_shortname' in order to update the status
line. 'target_shortname' is a macro which expands to:

#define target_shortname (current_top_target ()->shortname ())

and, in our scenario, 'current_top_target ()' returns NULL, which
obviously causes a segfault. But why does it return NULL, since,
according to its comment on target.h, it should never do that?

What is happening is that we're being caught in the middle of a
"target switch". We had the 'core_target' on top, because we were
inspecting a corefile, but when the user decided to invoke "run" GDB
had to actually create the inferior, which ends up detecting that we
have a target already, and tries to close it (from target.c):

/* See target.h. */

void
target_stack::push (target_ops *t)
{
/* If there's already a target at this stratum, remove it. */
strata stratum = t->stratum ();

if (m_stack[stratum] != NULL)
{
target_ops *prev = m_stack[stratum];
m_stack[stratum] = NULL;
target_close (prev); // <-- here
}
...

When the current target ('core_target') is being closed, it checks for
possible observers registered with it and calls them. TUI is one of
those observers, it gets called, tries to update the status line, and
GDB crashes.

The real problem is that we are clearing 'm_stack[stratum]', but
forgetting to adjust 'm_top'. Interestingly, this scenario is covered
in 'target_stack::unpush', but Pedro said he forgot to call it here..
The fix, therefore, is to call '::unpush' if there's a target on the
stack.

This patch has been tested on the Buildbot and no regressions have
been found. I'm also submitting a testcase for it.

gdb/ChangeLog:
2019-11-18 Sergio Durigan Junior <sergiodj@redhat.com>
Pedro Alves <palves@redhat.com>

https://bugzilla.redhat.com/show_bug.cgi?id=1765117
* target.c (target_stack::push): Call 'unpush' if there's a
target on top of the stack.

gdb/testsuite/ChangeLog:
2019-11-18 Sergio Durigan Junior <sergiodj@redhat.com>

https://bugzilla.redhat.com/show_bug.cgi?id=1765117
* gdb.tui/corefile-run.exp: New file.

Change-Id: I39e2f8b538c580c8ea5bf1d657ee877e47746c8f

58bd370 2019-11-19 09:00:21 GDB Administrator

Automatic date update in version.in

aa465b1 2019-11-19 06:06:20 Alan Modra

[GOLD] OSABI not set when STT_GNU_IFUNC or STB_GNU_UNIQUE symbols output

This patch arranges to have OSABI set to ELFOSABI_GNU (if not set to
some other non-zero value) when gold outputs an ifunc local or global
symbol, or a unique global symbol to either .dynsym or .symtab.
STT_GNU_IFUNC and STB_GNU_UNIQUE have values in the LOOS to HIOS range
and therefore require interpretation according to OSABI.

I'm not sure why parameters->target() is const Target& while
parameters->sized_target() is Sized_target*, but it's inconvenient to
use the latter in Symbol_table::finalize. So this patch adds another
const_cast complained about in layout.cc and gold.cc.

PR 24853
* symtab.h (set_has_gnu_output, has_gnu_output_): New.
* symtab.cc (Symbol_table::Symbol_table): Init has_gnu_output_.
(Symbol_table::finalize): Set ELFOSABI_GNU when has_gnu_output_.
(Symbol_table::set_dynsym_indexes, Symbol_table::sized_finalize):
Call set_has_gnu_output for STT_GNU_IFUNC and STB_GNU_UNIQUE globals.
* object.cc (Sized_relobj_file::do_finalize_local_symbols): Call
set_has_gnu_output when STT_GNU_IFUNC locals will be output.

94698d0 2019-11-19 06:05:05 Alan Modra

PR25200, SIGSEGV in _bfd_elf_validate_reloc

PR 25200
* reloc.c (bfd_default_reloc_type_lookup): Don't BFD_FAIL.
* elf.c (_bfd_elf_validate_reloc): Don't segfault on NULL howto.

2e953ac 2019-11-19 04:14:26 Philippe Waroquiers

Fix a bunch of python leaks due to missing calls to tp_free in *_dealloc functions.

valgrind reports leaks in many python tests, such as:
==17162== VALGRIND_GDB_ERROR_BEGIN
==17162== 8,208 (5,472 direct, 2,736 indirect) bytes in 57 blocks are definitely lost in loss record 7,551 of 7,679
==17162== at 0x4835753: malloc (vg_replace_malloc.c:307)
==17162== by 0x6EAFD1: _PyObject_New (object.c:279)
==17162== by 0x4720E6: blpy_iter(_object*) (py-block.c:92)
==17162== by 0x698772: PyObject_GetIter (abstract.c:2577)
==17162== by 0x2343BE: _PyEval_EvalFrameDefault (ceval.c:3159)
==17162== by 0x22E9E2: function_code_fastcall (call.c:283)
==17162== by 0x2340A8: _PyObject_Vectorcall (abstract.h:127)
==17162== by 0x2340A8: call_function (ceval.c:4987)
==17162== by 0x2340A8: _PyEval_EvalFrameDefault (ceval.c:3486)
==17162== by 0x22E9E2: function_code_fastcall (call.c:283)
==17162== by 0x82172B: _PyObject_Vectorcall (abstract.h:127)
==17162== by 0x82172B: method_vectorcall (classobject.c:67)
==17162== by 0x6AF474: _PyObject_Vectorcall (abstract.h:127)
==17162== by 0x6AF474: _PyObject_CallNoArg (abstract.h:153)
==17162== by 0x6AF474: _PyObject_CallFunctionVa (call.c:914)
==17162== by 0x6B0673: callmethod (call.c:1010)
==17162== by 0x6B0673: _PyObject_CallMethod_SizeT (call.c:1103)
==17162== by 0x477DFE: gdb_PyObject_CallMethod<> (python-internal.h:182)
==17162== by 0x477DFE: get_py_iter_from_func(_object*, char const*) (py-framefilter.c:272)
==17162== by 0x4791B4: py_print_args (py-framefilter.c:706)
==17162== by 0x4791B4: py_print_frame(_object*, enum_flags<frame_filter_flag>, ext_lang_frame_args, ui_out*, int, htab*) (py-framefilter.c:960)
==17162== by 0x47A130: gdbpy_apply_frame_filter(extension_language_defn const*, frame_info*, enum_flags<frame_filter_flag>, ext_lang_frame_args, ui_out*, int, int) (py-framefilter.c:1236)
==17162== by 0x369C39: apply_ext_lang_frame_filter(frame_info*, enum_flags<frame_filter_flag>, ext_lang_frame_args, ui_out*, int, int) (extension.c:563)
==17162== by 0x4EC9C9: backtrace_command_1 (stack.c:2031)
==17162== by 0x4EC9C9: backtrace_command(char const*, int) (stack.c:2183)
...

Most of the leaks in python tests are due to the fact that many
PyObject xxxxx_dealloc functions are missing the line to free self
or obj such as:
Py_TYPE (self)->tp_free (self);
or
Py_TYPE (obj)->tp_free (obj);

With this patch, the number of python tests leaking decreases from 52 to 12.

gdb/ChangeLog

2019-11-18 Philippe Waroquiers <philippe.waroquiers@skynet.be>

* python/py-block.c (blpy_dealloc): Call tp_free.
(blpy_block_syms_dealloc): Likewise.
* python/py-finishbreakpoint.c (bpfinishpy_dealloc): Likewise.
* python/py-inferior.c (infpy_dealloc): Likewise.
* python/py-lazy-string.c (stpy_dealloc): Likewise.
* python/py-linetable.c (ltpy_iterator_dealloc): Likewise.
* python/py-symbol.c (sympy_dealloc): Likewise.
* python/py-symtab.c (stpy_dealloc): Likewise.
* python/py-type.c (typy_iterator_dealloc): Likewise.

6edc43e 2019-11-19 02:50:48 Christian Biesinger

Don't use class-initialization for the owner union

As reported by PhilippeW, valgrind reports that symtab is uninitialized
when compiling with GCC 4.8.5, which is the default compiler on CentOS 7.

This is apparently a compiler bug fixed in later versions, but to keep
CentOS 7 working, this patch initializes the union explicitly instead of
using a class initializer.

gdb/ChangeLog:

2019-11-18 Christian Biesinger <cbiesinger@google.com>

* symtab.h (struct symbol) <owner>: Initialize explicitly in the
constructor instead of using a class initializer.

Change-Id: I94f48afeae5d29cf81a280295e2d02e2d7e1c1f1

ed7e9d0 2019-11-18 20:36:09 Alan Modra

elf_backend_init_file_header

This patch renames elf_backend_post_process_headers and moves the
prep_headers code into the new function. Naming the backend functions
elf_backend_init_file_header and elf_backend_modify_headers makes it
clear which function is called first.

* elf-bfd.h (struct elf_backend_data <elf_backend_init_file_header>):
Rename from elf_backend_post_process_headers.
(_bfd_elf_post_process_headers): Delete.
(_bfd_elf_init_file_header): Declare.
* elf.c (_bfd_elf_compute_section_file_positions): Call new function
in place of prep_headers and elf_backend_post_process_headers.
(_bfd_elf_init_file_header): Renamed from prep_headers with
updated args and made global. Delete dead code.
(_bfd_elf_post_process_headers): Delete.
* elf32-arm.c (elf32_arm_init_file_header): Rename from
elf32_arm_post_process_headers and call _bfd_elf_init_file_header.
Return status.
(elf_backend_init_file_header): Define.
(elf_backend_post_process_headers): Don't define.
* elf32-i386.c (elf_i386_fbsd_init_file_header): Similarly.
* elf32-m68hc1x.c (elf32_m68hc11_init_file_header): Similarly.
* elf32-metag.c (elf_metag_init_file_header): Similarly.
* elf32-spu.c (spu_elf_init_file_header
* elf32-visium.c (visium_elf_init_file_header
* elf64-alpha.c (elf64_alpha_fbsd_init_file_header
* elf64-hppa.c (elf64_hppa_init_file_header
* elf64-ia64-vms.c (elf64_vms_init_file_header
* elfnn-aarch64.c (elfNN_aarch64_init_file_header
* elfnn-ia64.c (elfNN_hpux_init_file_header
* elfxx-mips.c (_bfd_mips_init_file_header
* elfxx-mips.h (_bfd_mips_post_process_headers): Delete.
(_bfd_mips_init_file_header): Declare.
(elf_backend_post_process_headers): Delete.
(elf_backend_init_file_header): Define.
* elfxx-target.h (elf_backend_post_process_headers): Delete.
(elf_backend_init_file_header): Define and use.
* elf32-m68hc12.c (elf_backend_init_file_header): Define.
(elf_backend_post_process_headers): Don't define.
* elf32-m68hc1x.h (elf32_m68hc11_post_process_headers): Delete.
(elf32_m68hc11_init_file_header): Declare.
* elf32-ppc.c (elf_backend_post_process_headers): Remove
unnecessary undef.

6d6c25c 2019-11-18 20:36:09 Alan Modra

elf_backend_modify_headers

This patch renames elf_backend_modify_program_headers and moves the
elf.c code tweaking the ELF file header for -pie -Ttext-segment to a
new function, _bfd_elf_modify_headers, which then becomes the default
elf_backed_modify_headers and is called from any other target
elf_backed_modify_headers.

* elf-bfd.h (struct elf_backend_data <elf_backend_modify_headers>):
Rename from elf_backend_modify_program_headers.
(_bfd_elf_modify_headers): Declare.
* elf.c (assign_file_positions_except_relocs): Set
elf_program_header_size. Always call elf_backend_modify_headers.
Extract code modifying file header..
(_bfd_elf_modify_headers): ..to here. New function.
* elf32-arm.c (elf_backend_modify_headers): Renamed from
elf_backend_modify_program_headers.
* elf32-i386.c: Similarly.
* elf64-x86-64.c: Similarly.
* elfxx-target.h: Similarly. Default elf_backend_modify_headers
to _bfd_elf_modify_headers.
* elf-nacl.h (nacl_modify_headers): Rename from
nacl_modify_program_headers.
* elf-nacl.c (nacl_modify_headers): Rename from
nacl_modify_program_headers and call _bfd_elf_modify_headers.
* elf32-rx.c (elf32_rx_modify_headers): Similarly.
* elf32-spu.c (spu_elf_modify_headers): Similarly.
* elfnn-ia64.c (elfNN_ia64_modify_headers): Similarly.
* elf32-sh.c (elf_backend_modify_program_headers): Don't undef.

9aea1e3 2019-11-18 20:36:09 Alan Modra

PR25196, abort in rewrite_elf_program_header

This patch introduces a new "sorry, cannot handle this file" bfd error
status. The idea is to use this error in cases where bfd hasn't found
a bfd_bad_value error, ie. an input file or set of options that are
invalid, but rather an input file that is simply too difficult to
process. Typically this might happen with fuzzed object files such as
the one in the PR, a wildly improbable core file. Some things are
just not worth wasting time over to fix "properly".

PR 25196
* bfd.c (bfd_error_type): Add bfd_error_sorry.
(bfd_errmsgs): Likewise.
* elf.c (rewrite_elf_program_header): Don't abort on confused
lma/alignment. Replace bfd_error_bad_value with bfd_error_sorry.
(_bfd_elf_validate_reloc): Use bfd_error_sorry.
(_bfd_elf_final_write_processing): Likewise.
* bfd-in2.h: Regenerate.