• R/O
  • HTTP
  • SSH
  • HTTPS

List of commits

標籤
無標籤

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/split-dwarf2read
RSS
修訂. 時間 作者
093c33e users/simark/split-dwarf2read 2018-03-27 06:07:45 Simon Marchi

Move DWARF index-related things to a separate file

I want to add a DWARF index-related feature (automatically produce index
files when loading objfiles in GDB), but I don't want to add many
hundred lines to the already too big dwarf2read.c. I thought it would
be a logical split to move everything related to the DWARF index to its
own file.

I first tried to move everything that reads and writes DWARF indices to
a separate file, but found that the "read" part is a little bit
entangled with the rest of dwarf2read.c, so the line is hard to draw
about where to split. The write part is quite isolated though, so I
moved this part to a new file, dwarf-index-write.c. Some things are
necessary to both reading and writing indices, so I placed them in
dwarf-index-common.{c,h}. The idea would be to have a
dwarf-index-read.c eventually that would use it too (for now that code
is still in dwarf2read.c).

This required moving some things to a new dwarf2read.h header, so they
can be read by the code that writes the index.

The patch is big in number of lines, but it's all existing code being
moved around. The only changes are that some functions are not static
anymore, a declaration is added in a .h file, and therefore the comment
is moved there.

I built-tested it with a little and big endian target.

This patch is also available on the users/simark/split-dwarf2read
branch.

gdb/ChangeLog:

* Makefile.in (COMMON_SFILES): Add dwarf-index-common.c and
dwarf-index-write.c
(HFILES_NO_SRCDIR): Add dwarf-index-common.h and dwarf2read.h.
* dwarf-index-common.c: New file.
* dwarf-index-common.h: New file.
* dwarf-index-write.c: New file.
* dwarf2read.c: Include dwarf2read.h and dwarf-index-common.h.
(struct dwarf2_section_info): Move from here.
(dwarf2_section_info_def): Likewise.
(DEF_VEC_O (dwarf2_section_info_def)): Likewise.
(offset_type): Likewise.
(DW2_GDB_INDEX_SYMBOL_STATIC_SET_VALUE): Likewise.
(DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE): Likewise.
(DW2_GDB_INDEX_CU_SET_VALUE): Likewise.
(byte_swap): Likewise.
(MAYBE_SWAP): Likewise.
(dwarf2_per_cu_ptr): Likewise.
(DEF_VEC_P (dwarf2_per_cu_ptr)): Likewise.
(struct tu_stats): Likewise.
(struct dwarf2_per_objfile): Likewise.
(struct dwarf2_per_cu_data): Likewise.
(struct signatured_type): Likewise.
(sig_type_ptr): Likewise.
(DEF_VEC_P (sig_type_ptr)): Likewise.
(INDEX4_SUFFIX): Likewise.
(INDEX5_SUFFIX): Likewise.
(DEBUG_STR_SUFFIX): Likewise.
(dwarf2_read_section): Make non-static.
(mapped_index_string_hash): Move from here.
(dwarf5_djb_hash): Likewise.
(file_write): Likewise.
(class data_buf): Likewise.
(struct symtab_index_entry): Likewise.
(struct mapped_symtab): Likewise.
(find_slot): Likewise.
(hash_expand): Likewise.
(add_index_entry): Likewise.
(uniquify_cu_indices): Likewise.
(class c_str_view): Likewise.
(class c_str_view_hasher): Likewise.
(class vector_hasher): Likewise.
(write_hash_table): Likewise.
(psym_index_map): Likewise.
(struct addrmap_index_data): Likewise.
(add_address_entry): Likewise.
(add_address_entry_worker): Likewise.
(write_address_map): Likewise.
(symbol_kind): Likewise.
(write_psymbols): Likewise.
(struct signatured_type_index_data): Likewise.
(write_one_signatured_type): Likewise.
(recursively_count_psymbols): Likewise.
(recursively_write_psymbols): Likewise.
(class debug_names): Likewise.
(check_dwarf64_offsets): Likewise.
(psyms_seen_size): Likewise.
(write_gdbindex): Likewise.
(write_debug_names): Likewise.
(assert_file_size): Likewise.
(write_psymtabs_to_index): Likewise.
(save_gdb_index_command): Likewise.
(_initialize_dwarf2_read): Don't register the "save gdb-index"
command.
* dwarf2read.h: New file.

9f034d7 2018-03-27 04:46:21 Simon Marchi

Remove DEF_VEC_I(offset_type)

It is unused.

gdb/ChangeLog:

* dwarf2read.c (DEF_VEC_I(offset_type)): Remove.

ce1459e 2018-03-27 04:31:11 Simon Marchi

Add include guard to filename-seen-cache.h

While moving things around, I stumbled on filename_seen_cache being
re-defined, because filename-seen-cache.h doesn't have an include guard.

gdb/ChangeLog:

* filename-seen-cache.h: Add include guard.

0b7a4aa 2018-03-27 02:54:45 Cary Coutant

Fix case where IR file provides symbol visibility but replacement file does not.

In PR 22868, two IR files provide conflicting visibility for a symbol.
When a def with PROTECTED visibility is seen after a def with DEFAULT
visibility, gold does not override the visibility. Later, if the
replacement object define the symbol with DEFAULT visibility, the symbol
remains DEFAULT. This was caused by a recent change to allow multiply-defined
absolute symbols, combined with the fact that the plugin framework was using
SHN_ABS as the section index for placeholder symbols. The solution is to
use a real (but arbitrary) section index.

gold/
PR gold/22868
* plugin.cc (Sized_pluginobj::do_add_symbols): Use a real section
index instead of SHN_ABS for defined symbols.
* testsuite/Makefile.am (plugin_pr22868): New test case.
* testsuite/Makefile.in: Regenerate
* testsuite/plugin_pr22868.sh: New test script.
* testsuite/plugin_pr22868_a.c: New source file.
* testsuite/plugin_pr22868_b.c: New source file.

4f7ae6f 2018-03-27 02:34:28 Keith Seitz

Remove struct keyword from section_addr_info

Buildbot pointed out a failiure in windows-nat.c:

../../binutils-gdb/gdb/windows-nat.c:582:10: error: using typedef-name 'section_addr_info' after 'struct'
struct section_addr_info *addrs;
^~~~~~~~~~~~~~~~~
In file included from ../../binutils-gdb/gdb/windows-nat.c:49:0:
../../binutils-gdb/gdb/symfile.h:75:37: note: 'section_addr_info' has a previous declaration here
typedef std::vector<other_sections> section_addr_info;
^~~~~~~~~~~~~~~~~

A recursive grep of the sources for "struct section_addr_info" reveals one
additional reference in a comment. In both cases, this patch simply removes
the struct keyword.

gdb/ChangeLog:

* symfile.c (place_section): Remove "struct" from section_addr_info
in comment.
* windows-nat.c (struct safe_symbol_file_add_args) <addrs>: Remove
"struct" keyword from section_addr_info.

5cd3e38 2018-03-26 18:54:55 Alan Hayward

Make gdbserver reg_defs a vector of objects

gdb/
* regformats/regdef.h (reg): Add constructors.

gdb/gdbserver/
* regcache.c (find_register_by_number): Return a ref.
(find_regno): Use references.
(register_size): Likewise.
(register_data): Likewise.
* tdesc.c (target_desc::~target_desc): Remove free calls.
(target_desc::operator==): Use std::vector compare.
(init_target_desc): Use reference.
(tdesc_create_reg): Use reg constructors.
* tdesc.h (struct target_desc): Replace pointer with object.

af9d57d 2018-03-26 09:01:03 GDB Administrator

Automatic date update in version.in

3e5ef9a 2018-03-26 02:56:58 Pedro Alves

eval.c: reverse minsym and sym

I noticed that in evaluate_funcall, where we handle
OP_VAR_MSYM_VALUE/OP_VAR_VALUE to figure out the symbol's name gets
the minimal_symbol/symbol backwards. Happens to be harmless in
practice because the symbol name is recorded in the common initial
sequence (in the general_symbol_info field).

gdb/ChangeLog:
2018-03-25 Pedro Alves <palves@redhat.com>

* eval.c (evaluate_funcall): Swap OP_VAR_MSYM_VALUE/OP_VAR_VALUE
if then/else bodies in var_func_name extraction.

c88d2fc 2018-03-26 02:54:44 Pedro Alves

Fix date in gdb/ChangeLog

bf54968 2018-03-25 21:02:32 H.J. Lu

x86-64: Add ENDBR64 to the TLSDESC PLT entry

The TLSDESC entry in a lazy procedure linkage table is called indirectly
with "callq *(%rax)". This patch adds an ENDBR64 to support indirect
branch tracking in Intel CET. The TLSDESC PLT entry now looks like:

0xf3, 0x0f, 0x1e, 0xfa, /* endbr64 */
0xff, 0x35, 8, 0, 0, 0, /* pushq GOT+8(%rip) */
0xff, 0x25, 16, 0, 0, 0 /* jmpq *GOT+TDG(%rip) */

The BND prefix isn't needed since MPX isn't used for TLSDESC.

bfd/

PR ld/23000
* elf64-x86-64.c (elf_x86_64_finish_dynamic_sections): Add
ENDBR64 to the TLSDESC PLT entry.

ld/

PR ld/23000
* testsuite/ld-x86-64/tlsdesc.pd: Updated.

b3ee71e 2018-03-25 09:00:55 GDB Administrator

Automatic date update in version.in

8da9a90 2018-03-24 15:34:13 Cary Coutant

Fix warn-unused-return message.

gold/
* plugin.cc (link_or_copy_file): Remove newlines from warning messages.
Add pedantic check for return value from ::write.

3215dea 2018-03-24 15:34:13 Cary Coutant

Add missing ChangeLog entry for last commit.

bce02d8 2018-03-24 11:57:46 Weimin Pan

aarch64: Make "info address" resolve TLS variables

TLS variables can't be resolved on aarch64-linux-gnu

Running the test case with upstream gdb shows two failures:

(1) Receiving different error messages when printing TLS variable before
program runs - because the ARM compiler does not emit dwarf attribute
DW_AT_location for TLS, the result is expected and the baseline may
need to be changed for aarch64.

(2) Using "info address" command on C++ static TLS object resulted in
"symbol unresolved" error - below is a snippet from the test case:

class K {
public:
static __thread int another_thread_local;
};

__thread int K::another_thread_local;

(gdb) info address K::another_thread_local
Symbol "K::another_thread_local" is unresolved.

This patch contains fix for (2).

Function info_address_command() handles the "info address" command and
calls lookup_minimal_symbol_and_objfile() to find sym's symbol entry in
mininal symbol table if SYMBOL_COMPUTED_OPS (sym) is false. Problem is
that function lookup_minimal_symbol_and_objfile() only looked up an
objfile's minsym ordinary hash table, not its demangled hash table, which
was the reason why the C++ name was not found.

The fix is to call lookup_minimal_symbol(), which already looks up entries
in both minsym's hash tables, to find names when traversing the object file
list in lookup_minimal_symbol_and_objfile().

Tested in both aarch64-linux-gnu and amd64-linux-gnu. No regressions.

9a96cf3 2018-03-24 09:00:50 GDB Administrator

Automatic date update in version.in

b7fee5a 2018-03-24 03:58:32 Keith Seitz

Add psymbols for nested types

c++/22968 involves the inability of ptype to find a type definition for
a type defined inside another type. I recently added some additional
support for nested type definitions, but I apparently overlooked psymbols.

The user reports that using -readnow fixes the problem:

$ gdb 22968 -ex "ptype Outer::Inner"
There is no field named Inner

$ gdb -readnow 22968 -ex "ptype Outer::Inner"
type = struct Outer::Inner {
<no data field>
}

We clearly did not find a psymbol for Outer::Inner because it was located
in another CU. This patch addresses this problem by scanning structs
for additional psymbols. Rust is already doing this.

With this patch, the identical result to "-readnow" is given (without
using `-readnow', of course).

gdb/ChangeLog:

PR c++/22968
* dwarf2read.c (scan_partial_symbols): Scan structs/classes for
nested type definitions for C++, too.

gdb/testsuite/ChangeLog:

PR c++/22968
* gdb.cp/subtypes.exp: New file.
* gdb.cp/subtypes.h: New file.
* gdb.cp/subtypes.cc: New file.
* gdb.cp/subtypes-2.cc: New file.

291158a 2018-03-24 02:05:38 Cary Coutant

Add --debug=plugin option to record plugin actions.

With --debug=plugin, gold will log all plugin actions to a log file,
and make copies of plugin-supplied replacement files in a temporary
directory created under the current working directory.

gold/
* debug.h (DEBUG_PLUGIN): New constant.
(DEBUG_ALL): Add DEBUG_PLUGIN.
(debug_string_to_enum): Likewise.
* plugin.cc (make_sized_plugin_object): Add filename parameter.
(Plugin_recorder): New class.
(Plugin_manager::~Plugin_manager): Delete recorder_.
(Plugin_manager::load_plugins): Create and initialize recorder_.
(Plugin_manager::claim_file): Record claimed and unclaimed files.
(Plugin_manager::make_plugin_object): Use object name as name for
plugin object, if available.
(Plugin_manager::add_input_file): Record replacement files.
(Sized_pluginobj::do_add_symbols): Record plugin symbols.
(Plugin_finish::run): Call Plugin_recorder::finish().
(make_sized_plugin_object): Add filename parameter and pass to
Sized_pluginobj constructor.
* plugin.h (Plugin::filename): New method.
(Plugin::recorder): New method.
(Plugin::recorder_): New data member.

2cc9b30 2018-03-24 01:04:57 Tom Tromey

Change machoread.c to use std::vector

This changes machoread.c to use std::vector rather than VEC. This
allows removing some cleanups.

Regression tested by the buildbot, though I don't think anything
actually tests macho reading.

gdb/ChangeLog
2018-03-23 Tom Tromey <tom@tromey.com>

* machoread.c (struct oso_el): Add a constructor. Don't define as
a typedef.
(macho_register_oso): Remove.
(macho_symtab_read): Take a std::vector.
(oso_el_compare_name): Now a std::sort comparator.
(macho_symfile_read_all_oso): Take a std::vector.
(macho_symfile_read): Use std::vector. Remove cleanups.

dff7492 2018-03-23 23:49:09 Alan Hayward

Make gdbserver find_register_by_number static

gdbserver/
* regcache.c (find_register_by_number): Make static.
(find_regno): Use find_register_by_number
* regcache.h (struct reg): Remove declaration.

8fd7578 2018-03-23 21:20:03 Nick Clifton

Improve readelf's selection of a file start symbol when displaying a gnu build attribute.

* readelf.c (get_symbol_for_build_attribute): Skip ARM mapping
symbols.
(print_gnu_build_attribute_description): If no file start symbol
could be found, look for one two bytes into the file.
* testsuite/binutils-all/note-4-64.s: Set the address of the file
start symbol to two bytes into the file.
* testsuite/binutils-all/note-4-32.s: Likewise.

f6c4d4b 2018-03-23 21:08:54 Nick Clifton

Add an extra library name template to the list used by the WIN32 targets.

PR 22948
* emultempl/pe.em (open_dynamic_archive): Add libXXX.lib template
to library name list.
* emultempl/pep.em (open_dynamic_archive): Likewise.
* ld.texinfo (WIN32): Update documentation.

376be52 2018-03-23 20:55:02 Andrew Burgess

gdb: Fix testsuite issue in gdb.arch/amd64-disp-step-avx.exp

This test starts up and confirms that $xmm0 has the value 0, it then
modifies $xmm0 (in the inferior) and confirms that the new value can
be read (in GDB).

On some machines I was noticing that this test would occasionally
fail, and on investigation I believe that the reason for this is that
the test is linked as a dynamically linked executable and makes use of
the system libraries during startup. The reason that this causes
problems is that both the runtime linker and the startup code run
before main can, and do (on at least some platforms) make use of the
XMM registers.

In this commit I modify the test program slightly to allow it to be
linked statically, without using the startup libraries. Now by the
time GDB reaches the symbol main we have only executed one 'nop'
instruction, and the XMM registers should all have the value 0. I've
extended the test script to confirm that $xmm0 to $xmm15 are all
initially 0, and I also check that at the point after $xmm0 has been
modified, all the other XMM registers ($xmm1 to $xmm15) are still 0.

The test program is still linked against libc in order that we can
call the exit function, however, we now call _exit rather than exit in
order to avoid all of the usual cleanup that exit does. This clean up
tries to tear down things that are usually setup during the startup
code, but now this isn't called calling exit will just result in a
crash.

gdb/testsuite/ChangeLog:

* gdb.arch/amd64-disp-step-avx.S: Add '_start' label.
(done): Call '_exit' not 'exit' to avoid atexit handlers.
* gdb.arch/amd64-disp-step-avx.exp: Pass -static, and
-nostartfiles when compiling the test. Confirm that all registers
xmm0 to xmm15 are initially 0, and that xmm1 to xmm15 are 0 after.

066cfa9 2018-03-23 20:55:01 Andrew Burgess

gdb: Minor cleanup in some gdb.arch/* tests

A small number of tests incorrectly tried to pass -Wa,-g through to
GCC as an extra compile time flag, either to gdb_compile or
prepare_for_testing.

The problem is that the syntax used for passing the flags was
incorrect, and as a result these extra flags were being ignored.
Luckily, the 'debug' flag was being passed in each case anyway, which
means that the '-g' flag would already be added.

Given that all these tests pass 'debug', and the invalid flag has been
ignored for some time, I'm just removing the flags in this commit.

I've also changed the tests from using gdb_compile to
prepare_for_testing, which allows some extra code to be removed from a
couple of tests scripts.

There should be no change in the test results after this commit.

gdb/testsuite/ChangeLog:

* gdb.arch/amd64-disp-step-avx.exp: Remove unneeded assembler flag
option, syntax was wrong anyway.
* gdb.arch/arm-disp-step.exp: Likewise.
* gdb.arch/sparc64-regs.exp: Likewise.
* gdb.arch/amd64-disp-step.exp: Remove unneeded assembler flag
option, syntax was wrong anyway, switch to use
prepare_for_testing.
* gdb.arch/i386-disp-step.exp: Likewise.

d80e524 2018-03-23 20:08:27 Alan Hayward

Move gdbserver tdesc header funcs to c file

gdbserver/
* tdesc.c (target_desc::~target_desc): Move to here.
(target_desc::operator==): Likewise.
* tdesc.h (target_desc::~target_desc): Move from here.
(target_desc::operator==): Likewise.

079670b 2018-03-23 18:38:23 Andreas Arnez

Testsuite: fully migrate to use_gdb_stub convenience func

In the GDB test suite, there are still multiple invocations of
"target_info exists use_gdb_stub". However, the recommended way of
checking for use_gdb_stub is to call the convenience function of the same
name.

Replace these occurrences and just call "use_gdb_stub" instead.

gdb/testsuite/ChangeLog:

* gdb.ada/exec_changed.exp: Replace "target_info exists
use_gdb_stub" by "use_gdb_stub".
* gdb.ada/start.exp: Likewise.
* gdb.base/async-shell.exp: Likewise.
* gdb.base/attach-pie-misread.exp: Likewise.
* gdb.base/attach-wait-input.exp: Likewise.
* gdb.base/break-entry.exp: Likewise.
* gdb.base/break-interp.exp: Likewise.
* gdb.base/dprintf-detach.exp: Likewise.
* gdb.base/nostdlib.exp: Likewise.
* gdb.base/solib-nodir.exp: Likewise.
* gdb.base/statistics.exp: Likewise.
* gdb.base/testenv.exp: Likewise.
* gdb.mi/mi-exec-run.exp: Likewise.
* gdb.mi/mi-start.exp: Likewise.
* gdb.multi/dummy-frame-restore.exp: Likewise.
* gdb.multi/multi-arch-exec.exp: Likewise.
* gdb.multi/multi-arch.exp: Likewise.
* gdb.multi/tids.exp: Likewise.
* gdb.multi/watchpoint-multi.exp: Likewise.
* gdb.python/py-events.exp: Likewise.
* gdb.threads/attach-into-signal.exp: Likewise.
* gdb.threads/attach-stopped.exp: Likewise.
* gdb.threads/threadapply.exp: Likewise.
* lib/selftest-support.exp: Likewise.

a2b2bc1 2018-03-23 12:19:11 Tom Tromey

Remove some cleanups from record-full.c

This removes some cleanups from record-full.c in a straightforward
way.

Tested by the buildbot.

gdb/ChangeLog
2018-03-22 Tom Tromey <tom@tromey.com>

* record-full.c (record_full_exec_insn): Use gdb::byte_vector.
(record_full_goto_bookmark): Use std::string.

8ff5bf3 2018-03-23 09:00:38 GDB Administrator

Automatic date update in version.in

7a8f494 2018-03-22 22:22:45 Pedro Franco de Carvalho

ppc: Fix stwux and stdux masks in skip_prologue

This patch merges the masks for matching the stwux and stdux
instructions in rs6000-tdep.c:skip_prologue into a single mask that
only matches these two instructions.

Commit 72dd273062 fixed the warning described in PR tdep/18295, this
patch addresses the comment in the same PR indicating that the mask
was too permissive.

gdb/Changelog:

PR tdep/18295
* rs6000-tdep.c (skip_prologue): Match both stwux and stdux
a single mask.

dd6d677 2018-03-22 22:22:45 Pedro Franco de Carvalho

ppc: Detect when LR is saved through frame pointer

This patch extends rs6000-tdep.c:skip_prologue so that it can detect
when the Link Register is saved using the frame pointer (usually r31)
in adition to the stack pointer (r1).

The frame pointer offset from the frame base is tracked separately
from the stack pointer offset for cases when the frame pointer is not
in synch with the stack pointer at the moment of the LR save.

Previously, "stq" could also be detected as an instruction that saves
LR or CR. Because this was likely unintentional, this patch also
restricts the matches to stw/stwu/std/stdu.

gdb/ChangeLog:

* rs6000-tdep.c (store_insn_p): New function.
(skip_prologue): New variable alloca_reg_offset. Set lr_reg
and cr_reg to their unshifted values. Use store_insn_p to
match LR saves using either R1 or fdata->alloca_reg. Use
store_insn_p to match CR saves. Set alloca_reg_offset
when alloca_reg and framep are set. Remove lr_reg shift
when assigning to fdata->lr_register.

26d6cec 2018-03-22 18:02:18 Andreas Arnez

Make "info proc cmdline" show args on GNU/Linux

Currently "info proc cmdline" on GNU/Linux does not show the full command
line, but only argument 0. And even a warning is shown if there are more.
This was discussed in 2014 already:

https://sourceware.org/ml/gdb-patches/2014-04/msg00212.html

Follow the advice there and avoid target_fileio_read_stralloc. Instead,
use target_fileio_read_alloc to read the whole command line and then
replace NUL characters by spaces. Also add an appropriate test case.
Note that gdbserver already handles this correctly.

gdb/ChangeLog:

* linux-tdep.c (linux_info_proc): For "info proc cmdline", print
command line args instead of emitting a warning.

gdb/testsuite/ChangeLog:

* gdb.base/info-proc.exp: Add test for "info proc cmdline".