• 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/hjl/pr12639
RSS
Rev. Tiempo Autor
0860f63 users/hjl/pr12639 2017-11-27 02:38:09 H.J. Lu

Check corrupted symbol table

bfd/

PR binutils/12639
* elfcode.h (elf_slurp_symbol_table): Check corrupted global
symbols.

binutils/

PR binutils/12639
* readelf.c (process_symbol_table): Detect corrupted symbol
table.

8e2495f 2017-11-27 01:32:26 H.J. Lu

gas: Update x86 sse-noavx tests

This fixed:

FAIL: i386 SSE without AVX equivalent
FAIL: x86-64 SSE without AVX equivalent
FAIL: x86-64 (ILP32) SSE without AVX equivalent

on x86-64.

* testsuite/gas/i386/sse-noavx.s: Add tests for fisttps and
fisttpl.
* testsuite/gas/i386/x86-64-sse-noavx.s: Likewise.
* testsuite/gas/i386/ilp32/x86-64-sse-noavx.d: Updated.
* testsuite/gas/i386/sse-noavx.d: Likewise.
* testsuite/gas/i386/x86-64-sse-noavx.d: Likewise.

58f7f0b 2017-11-27 01:29:00 Ulrich Weigand

Fix broken ChangeLog entry for last commit.

617cd4b 2017-11-27 01:19:57 Ulrich Weigand

[spu] Fix various test cases

The SPU-specific test cases were not modified to use standard_output_file
and therefore all were no longer being executed. Fixing this exposed a
few other bugs in spu-info noticed by using a more recent compiler, which
are also fixed here.

gdb/testsuite/ChangeLog:
2017-11-26 Ulrich Weigand <uweigand@de.ibm.com>

* gdb.arch/spu-info.c: Include <unistd.h>.
(do_signal_test): Fix broken calls to write.
* gdb.arch/spu-info.exp: Use prepare_for_testing.
Fix checks for empty mailboxes. Update signal tests for corrected
do_signal_test routine. Allow nonzero event status.

5ffd2cb 2017-11-27 01:15:25 Ulrich Weigand

[spu] Fix single-stepping regression

Switching spu_software_single_step to use a regcache instead of a frame:
https://sourceware.org/ml/gdb-patches/2016-11/msg00355.html
cause a serious regression to SPU single-stepping.

There were two separate problems:
- SPU_LSLR_REGNUM is a pseudo register, so we must use the "cooked"
regcache methods instead of the "raw" ones to access it.
- When accessing a branch target register, we must only use the first
four bytes of the 16-byte vector register. This was done automatically
by the frame routines, but not by the regcache routines.

gdb/ChangeLog:
2017-11-26 Ulrich Weigand <uweigand@de.ibm.com>

* spu-tdep.c (spu_software_single_step): Access SPU_LSLR_REGNUM as
"cooked" register. Access only first four bytes of branch target
registers.

e5a8dd4 2017-11-26 09:00:27 GDB Administrator

Automatic date update in version.in

0e5457d 2017-11-26 00:57:58 Sergio Durigan Junior

Adding ChangeLog entry for the last commit.

685de8c 2017-11-25 15:13:03 Sergio Durigan Junior

Fix PR gdb/22491: Regression when setting SystemTap probe semaphores

Pedro has kindly pointed out that
gdb.arch/amd64-stap-optional-prefix.exp was failing after my
C++-ification patches touching the probe interface. The failure is
kind of cryptic:

77 break -pstap bar
78 Breakpoint 3 at 0x40048d
79 (gdb) PASS: gdb.arch/amd64-stap-optional-prefix.exp: bar: break -pstap bar
80 continue
81 Continuing.
82
83 Program received signal SIGILL, Illegal instruction.
84 main () at amd64-stap-optional-prefix.S:26
85 26 STAP_PROBE1(probe, foo, (%rsp))

It took me a while to figure out where this SIGILL is coming from.
Initially I thought it was something related to writing registers to
the inferior when dealing with probe arguments, but I discarded this
since the arguments were not touching any registers.

In the end, this was a mistake that was introduced during the review
process of the patch. When setting/clearing a SystemTap probe's
semaphore, the code was using 'm_address' (which refers the probe's
address) instead of 'm_sem_addr' (which refers to the semaphore's
address). This caused GDB to write a bogus value in the wrong memory
position, which in turn caused the SIGILL.

I am pushing this patch to correct the mistake.

On a side note: I told Pedro that the BuildBot hadn't caught the
failure during my try build, and for a moment there was a suspicion
that the BuildBot might be at fault here. However, I investigate this
and noticed that I only did one try build, with a patch that was
correctly using 'm_sem_addr' where applicable, and therefore no
failure should have happened indeed. I probably should have requested
another try build after addressing the review's comments, but they
were mostly basic and I didn't think it was needed. Oh, well.

2017-11-25 Sergio Durigan Junior <sergiodj@redhat.com>

PR gdb/22491
* stap-probe.c (relocate_address): New function.
(stap_probe::get_relocated_address): Use 'relocate_address'.
(stap_probe::set_semaphore): Use 'relocate_address' and pass
'm_sem_addr'.
(stap_probe::clear_semaphore): Likewise.

deeeba5 2017-11-25 09:33:05 Pedro Alves

Use TOLOWER in SYMBOL_HASH_NEXT

The support for setting breakpoint in functions with ABI tags patch
will add a use of SYMBOL_HASH_NEXT in cp-support.c, which fails to
compile with:

src/gdb/cp-support.c:38:0:
src/gdb/cp-support.c: In function ‘unsigned int cp_search_name_hash(const char*)’:
src/gdb/../include/safe-ctype.h:148:20: error: ‘do_not_use_tolower_with_safe_ctype’ was not declared in this scope
#define tolower(c) do_not_use_tolower_with_safe_ctype
^
src/gdb/minsyms.h:174:18: note: in expansion of macro ‘tolower’
((hash) * 67 + tolower ((unsigned char) (c)) - 113)
^
src/gdb/cp-support.c:1677:14: note: in expansion of macro ‘SYMBOL_HASH_NEXT’
hash = SYMBOL_HASH_NEXT (hash, *string);
^

This fixes the problem before it happens.

I was somewhat worried about whether this might have an impact with
languages that are case insensitive, but I convinced myself that it
doesn't. As bonus, this improves GDB's minsym interning performance a
bit (3%-10%). See
<https://sourceware.org/ml/gdb/2017-11/msg00021.html>.

gdb/ChangeLog:
2017-11-25 Pedro Alves <palves@redhat.com>

* dictionary.c: Include "safe-ctype.h".
* minsyms.c: Include "safe-ctype.h".
* minsyms.c (SYMBOL_HASH_NEXT): Use TOLOWER instead of tolower.

a81aaca 2017-11-25 09:20:31 Pedro Alves

Fix completing an empty string

Earlier while working on the big completer rework series, I managed to
break

(gdb) [TAB]

locally, and make GDB crash, but only notice a few weeks down the
road, because we have no test for that...

I also noticed that:

(gdb) [TAB]

didn't work (didn't show all commands as matches), even though
entering a command with leading whitespace works:

(gdb) help

This commit fixes the latter and adds a testcase that covers both
issues.

The gdb.base/completion.exp change is necessary because the new test
has a file name that also starts with "gdb.base/complet", making that
particular test ambiguous. Adding another letter disambiguates.

gdb/ChangeLog:
2017-11-25 Pedro Alves <palves@redhat.com>

* completer.c (complete_line_internal_1): Skip spaces until the
start of the command.

gdb/testsuite/ChangeLog:
2017-11-25 Pedro Alves <palves@redhat.com>

* gdb.base/complete-empty.exp: New file.
* gdb.base/completion.exp: Adjust.

6a3c6ee 2017-11-25 09:09:25 Pedro Alves

Add comprehensive C++ operator linespec/location/completion tests

This exercises the special handling C++ operators require in several
places in the linespec parser, both the linespec and explicit location
completers, symbol lookup, etc. Particularly, makes sure all that
works without quoting.

Note that despite the apparent smallish size, this adds thousands of
tests to the testsuite, due to combination explosion (linespecs,
explicit locations, tab completion, complete command, completion at
different points in each function, etc.)

Grows the gdb.linespec/ tests like this:

-# of expected passes 3464
+# of expected passes 7823

gdb/testsuite/ChangeLog:
2017-11-25 Pedro Alves <palves@redhat.com>

* gdb.linespec/cpls-ops.cc: New file.
* gdb.linespec/cpls-ops.exp: New file.
* lib/completion-support.exp (test_complete_prefix_range_re): New,
factored out from ...
(test_complete_prefix_range): ... this.

13450e7 2017-11-25 09:00:26 GDB Administrator

Automatic date update in version.in

8955eb2 2017-11-25 08:41:12 Pedro Alves

Comprehensive C++ linespec/completer tests

Exercises all sorts of aspects fixed by previous patches, going back a
few months.

- Exercises label completion, linespecs and explicit locations.

- Exercises both quoting vs non-quoting, source filenames, function
names, labels, with both linespecs and explicit locations.

- Tests corner cases around not-quoting function names, and
whitespace and/and completing inside a parameter or template
argument list, anonymous namespace awareness, etc.

E.g.,

"break foo<[TAB]" -> "break foo<int>()"
"break bar ( int[TAB]" -> "break bar ( int)
"break ( anon" -> "break ( anonymous namespace)::func()"
"b cfunc() [tab]" -> "b cfunc() const"
"b rettype templfunc[tab]" -> "b rettype templfunc<bar>()"

... and others.

- Tests the "b source.c[TAB] -> b source.cc:" feature. I.e., colon
auto-appending.

- Exercises corner cases around C++ "operator<" / "operator<<".
(Much more extensive C++ operator completion/linespec handling in a
separate patch.)

- Exercises both tab completion and "complete" command completion,
using routines that handle it automatically, to ensure no test
forgets either mode.

- Many of the completion tests test completion at at prefix of a
given tricky name, to make sure all corner cases are covered.
E.g., completing before, at and after ":", "(", "<".

- Exercises "keyword" completion. I.e., "b function() [TAB]"
displaying "if task thread" as completion match list. Likewise for
display explicit location options matches at the appropriate
points.

- Ensures that the completer finds the same breakpoint locations that
setting a breakpoint finds.

- Tests that linespec/location completion doesn't find data symbols.

- Tests that expression completion still kicks in after a
linespec/location keyword. I.e., this:

"b function () if global1 + global[TAB]"

knows that after "if", you're completing on an expression, and thus
breaks words after "if" as an expression and matches on "global" as
a data symbol.

- Adds common routines to help with all the above, to be used by
multiple completion and linespec/location test cases.

- More...

Grows the gdb.linespec/ tests like this:

-# of expected passes 573
+# of expected passes 3464

gdb/testsuite/ChangeLog:
2017-11-24 Pedro Alves <palves@redhat.com>

* gdb.linespec/cpcompletion.exp: New file.
* gdb.linespec/cpls-hyphen.cc: New file.
* gdb.linespec/cpls.cc: New file.
* gdb.linespec/cpls2.cc: New file.
* gdb.linespec/explicit.exp: Load completion-support.exp. Adjust
test to use test_gdb_complete_unique. Add label completion,
keyword completion and explicit location completion tests.
* lib/completion-support.exp: New file.

0662b6a 2017-11-25 08:30:04 Pedro Alves

Make strcmp_iw NOT ignore whitespace in the middle of tokens

currently "b func tion" manages to set a breakpoint at "function" !

All these years I had never noticed this, but now that the linespec
completer actually works, this easily happens by accident, with:

"b func t<tab>"

expecting to get "thread", but getting instead:

"b func tion"

...

Also, this:

"b rettypefunc<int>"

manages to set a breakpoint on "rettype func<int>()".

These things happen due to strcmp_iw "magic".

Fix it by teaching strcmp_iw about when can it skip whitespace. This
required handling user-defined operators, and scope operators,
complicating the code a bit, unfortunately. I added unit tests for
all the corner cases I stumbled on, as I was developing this, and then
in the end wrote a testsuite testcase covering many of the same things
and more (to be added later).

gdb/ChangeLog:
2017-11-24 Pedro Alves <palves@redhat.com>

* cp-support.c (cp_symbol_name_matches_1): New, factored out from
cp_fq_symbol_name_matches. Pass language_cplus to
strncmp_with_mode.
(cp_fq_symbol_name_matches): Call cp_symbol_name_matches_1.
(selftests::test_cp_symbol_name_cmp): New.
(_initialize_cp_support): Register "cp_symbol_name_matches"
selftests.
* language.c (default_symbol_name_matcher): Pass language_minimal
to strncmp_iw_with_mode.
* utils.c: Include "cp-support.h" and <algorithm>.
(valid_identifier_name_char, cp_skip_operator_token, skip_ws)
(cp_is_operator): New functions.
(strncmp_iw_with_mode): Use them. Add language parameter. Don't
skip whitespace in the symbol name when the lookup name doesn't
have spaces, and vice versa.
(strncmp_iw, strcmp_iw): Pass language to strncmp_iw_with_mode.
* utils.h (strncmp_iw_with_mode): Add language parameter.

276da9b 2017-11-25 07:52:15 H.J. Lu

Re-apply "elf: Properly compute offsets of note descriptor and next note"

CORE PT_NOTE segments may have p_align values of 0 or 1. gABI specifies
that PT_NOTE alignment should be aligned to 4 bytes for 32-bit objects
and to 8 bytes for 64-bit objects. If segment alignment is less than 4,
we use 4 byte alignment.

e547c11 2017-11-25 07:15:30 Joel Brobecker

(Ada) provide the exception message when hitting an exception catchpoint

This patch enhances the debugger to print the exception message, when
available, as part of an exception catchpoint hit notification (both
GDB/CLI and GDB/MI). For instance, with the following code...

procedure A is
begin
raise Constraint_Error with "hello world";
end A;

... instead of printing...

Catchpoint 1, CONSTRAINT_ERROR at 0x000000000040245c in a () at a.adb:3

... it now prints:

Catchpoint 1, CONSTRAINT_ERROR (hello world) at 0x000000000040245c in a ()
^^^^^^^^^^^^^

This enhancement requires runtime support. If not present, the debugger
just behaves as before.

In GDB/MI mode, if the exception message is available, it is provided
as an extra field named "exception-message" in the catchpoint notification:

*stopped,bkptno="1",[...],exception-name="CONSTRAINT_ERROR",
exception-message="hello world",[...]

gdb/ChangeLog:

* ada-lang.c (ada_exception_message_1, ada_exception_message):
New functions.
(print_it_exception): If available, display the exception
message as well.
* NEWS: Document new feature.

gdb/doc/ChangeLog:

* gdb.texinfo (GDB/MI Ada Exception Information): Document
new "exception-message" field.

gdb/testsuite/ChangeLog:

* gdb.ada/catch_ex.exp, gdb.ada/mi_catch_ex.exp,
gdb.ada/mi_ex_cond.exp: Accept optional exception message in
when hitting an exception catchpoint.

5f1ca24 2017-11-25 07:14:07 Simon Marchi

Fix issues with gdb-memory-map.dtd

While writing a unit test for parse_memory_map, I tried to validate my
test input against gdb-memory-map.dtd, and found a few problems with it.
This doesn't influence how gdb parses it (AFAIK it doesn't use the
linked dtd), but if you edit the xml file in an editor that supports
dtds, you'll get plenty of errors.

- The <memory-map> element accepts exactly one <memory> OR <property>
as a child. This is a problem because you can't have multiple
<memory> elements and you shouldn't be able to have <property> elements
as direct children of <memory-map>.
- The <memory> element wants exactly one <property> child. This is
wrong, since you could have zero or more (even though we only
support one kind of property currently).
- I have no idea wht the device attribute of <memory> is, GDB doesn't
read that. I searched back in time a bit but couldn't find a trace
of it.

I took the opportunity to tighten what is accepted as a value of the
memory type and property name attributes. We currently accept any
string, but we can restrict them to the values GDB really accepts (and
which are documented).

AFAIK, this "file" only exists in the documentation, in gdb.texinfo, so
this is what I modified. However, it's also available at
http://sourceware.org/gdb/gdb-memory-map.dtd. This one should be
updated too, but I don't know how that should be done.

gdb/doc/ChangeLog:

* gdb.texinfo (Memory Map Format): Update gdb-memory-map.dtd.

f5291a6 2017-11-25 06:04:41 Ulrich Weigand

[spu] Fix spu-linux gdbserver build

Fix a typo in a newly added argument name.

gdb/ChangeLog:
2017-11-24 Ulrich Weigand <uweigand@de.ibm.com>

* spu-low.c (spu_create_inferior): Fix typo in argument name.

d7fcdff 2017-11-25 06:03:28 Ulrich Weigand

[spu] Fix spu-linux native build

Add missing file to NATDEPFILES.

gdb/ChangeLog:
2017-11-24 Ulrich Weigand <uweigand@de.ibm.com>

* configure.nat <spu-linux>: Add fork-inferior.o to NATDEPFILES.

4e25ac0 2017-11-25 05:43:51 Simon Marchi

Revert "elf: Properly compute offsets of note descriptor and next note"

This reverts commit 650444eb540f9fd85e821567a3f943b4bc41b8be.

With this patch, running the GDB test case gdb.base/auxv.exp is stuck in
an infinite loop, consuming memory to the point that it renders the
machine unusable. I am reverting it so we can take our time to
investigate while not killing all the developers' machines.

0fbc356 2017-11-25 02:31:59 Jim Wilson

Add reference to implicit use in _bfd_elf_is_local_label_name.

gas/
* write.h (FAKE_LABEL_CHAR): Expand comment.

8b77421 2017-11-25 01:58:56 H.J. Lu

Update PR ld/21562 tests for underscore targets

We also need to provide __start_scnfoo and __stop_scnfoo with the extra
leading underscore for underscore targets.

This patch fixed:

FAIL: ld-elf/pr21562k
FAIL: ld-elf/pr21562l
FAIL: ld-elf/pr21562m
FAIL: ld-elf/pr21562n

for metag-linux,

* testsuite/ld-elf/pr21562c.t: Also provide ___start_scnfoo and
___stop_scnfoo.
* testsuite/ld-elf/pr21562d.t: Likewise.

30649c1 2017-11-25 01:16:37 Philipp Rudo

Workaround build bug with GCC 6.2.1

Building GDB with GCC 6.2.1 gives multiple errors like

gdb/dtrace-probe.c: In member function ‘void dtrace_probe::build_arg_exprs(gdbarch*)’:
gdb/dtrace-probe.c:627:8: error: types may not be defined in a for-range-declaration [-Werror]
for (struct dtrace_probe_arg &arg : m_args

Fix it by removing the 'struct' keyword.

A similar Bug was already fixed for GCC 6.3.1
https://sourceware.org/ml/gdb-patches/2017-10/msg00442.html

gdb/ChangeLog:

* dtrace-probe.c (dtrace_probe::build_arg_exprs)
(dtrace_probe::is_enabled, dtrace_probe::enable)
(dtrace_probe::disable): Remove keyword 'struct' at for-range
variable
* probe.c (gen_ui_out_table_header_info)
(print_ui_out_not_applicables): Remove keyword 'struct' at
for-range variable

7696f5c 2017-11-25 00:56:34 Alan Hayward

Fix aarch64-none-elf build error

gdb/
* configure.tgt: Add arch/aarch64.o

8172f16 2017-11-25 00:42:25 Simon Marchi

Poison XNEW and friends for types that should use new/delete

This patch (finally!) makes it so that trying to use XNEW with a type
that requires "new" will cause a compilation error. The criterion I
initially used to allow a type to use XNEW (which calls malloc in the
end) was std::is_trivially_constructible, but then realized that gcc 4.8
did not have it. Instead, I went with:

using IsMallocatable = std::is_pod<T>;

which is just a bit more strict, which doesn't hurt. A similar thing is
done for macros that free instead of allocated, the criterion is:

using IsFreeable = gdb::Or<std::is_trivially_destructible<T>, std::is_void<T>>;

Trying to use XNEW on a type that requires new will result in an error
like this:

In file included from /home/simark/src/binutils-gdb/gdb/common/common-utils.h:26:0,
from /home/simark/src/binutils-gdb/gdb/common/common-defs.h:78,
from /home/simark/src/binutils-gdb/gdb/defs.h:28,
from /home/simark/src/binutils-gdb/gdb/lala.c:1:
/home/simark/src/binutils-gdb/gdb/common/poison.h: In instantiation of ‘T* xnew() [with T = bar]’:
/home/simark/src/binutils-gdb/gdb/lala.c:13:3: required from here
/home/simark/src/binutils-gdb/gdb/common/poison.h:103:3: error: static assertion failed: Trying to use XNEW with a non-POD data type. Use operator new instead.
static_assert (IsMallocatable<T>::value, "Trying to use XNEW with a non-POD\
^~~~~~~~~~~~~

Generated-code-wise, it adds one more function call (xnew<T>) when using
XNEW and building with -O0, but it all goes away with optimizations
enabled.

gdb/ChangeLog:

* common/common-utils.h: Include poison.h.
(xfree): Remove declaration, add definition with static_assert.
* common/common-utils.c (xfree): Remove.
* common/poison.h (IsMallocatable): Define.
(IsFreeable): Define.
(free): Delete for non-freeable types.
(xnew): New.
(XNEW): Undef and redefine.
(xcnew): New.
(XCNEW): Undef and redefine.
(xdelete): New.
(XDELETE): Undef and redefine.
(xnewvec): New.
(XNEWVEC): Undef and redefine.
(xcnewvec): New.
(XCNEWVEC): Undef and redefine.
(xresizevec): New.
(XRESIZEVEC): Undef and redefine.
(xdeletevec): New.
(XDELETEVEC): Undef and redefine.
(xnewvar): New.
(XNEWVAR): Undef and redefine.
(xcnewvar): New.
(XCNEWVAR): Undef and redefine.
(xresizevar): New.
(XRESIZEVAR): Undef and redefine.

7aabaf9 2017-11-25 00:40:31 Simon Marchi

Create private_thread_info hierarchy

There are multiple definitions of the private_thread_info structure
compiled in the same GDB build. Because of the one definition rule, we
need to change this if we want to be able to make them non-POD (e.g. use
std::vector fields). This patch creates a class hierarchy, with
private_thread_info being an abstract base class, and all the specific
implementations inheriting from it.

In order to poison XNEW/xfree for non-POD types, it is also needed to
get rid of the xfree in thread_info::~thread_info, which operates on an
opaque type. This is replaced by thread_info::priv now being a
unique_ptr, which calls the destructor of the private_thread_info
subclass when the thread is being destroyed.

Including gdbthread.h from darwin-nat.h gave these errors:

/Users/simark/src/binutils-gdb/gdb/gdbthread.h:609:3: error: must use 'class' tag to refer to type 'thread_info' in this scope
thread_info *m_thread;
^
class
/usr/include/mach/thread_act.h:240:15: note: class 'thread_info' is hidden by a non-type declaration of 'thread_info' here
kern_return_t thread_info
^

It turns out that there is a thread_info function in the Darwin/XNU/mach API:

http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/thread_info.html

Therefore, I had to add the class keyword at a couple of places in gdbthread.h,
I don't really see a way around it.

gdb/ChangeLog:

* gdbthread.h (private_thread_info): Define structure type, add
virtual pure destructor.
(thread_info) <priv>: Change type to unique_ptr.
<private_dtor>: Remove.
* thread.c (add_thread_with_info): Adjust to use of unique_ptr.
(private_thread_info::~private_thread_info): Provide default
implementation.
(thread_info::~thread_info): Don't call private_dtor nor
manually free priv.
* aix-thread.c (private_thread_info): Rename to ...
(aix_thread_info): ... this.
(get_aix_thread_info): New.
(sync_threadlists): Adjust.
(iter_tid): Adjust.
(aix_thread_resume): Adjust.
(aix_thread_fetch_registers): Adjust.
(aix_thread_store_registers): Adjust.
(aix_thread_extra_thread_info): Adjust.
* darwin-nat.h (private_thread_info): Rename to ...
(darwin_thread_info): ... this.
(get_darwin_thread_info): New.
* darwin-nat.c (darwin_init_thread_list): Adjust.
(darwin_check_new_threads): Adjust.
(thread_info_from_private_thread_info): Adjust.
* linux-thread-db.c (private_thread_info): Rename to ...
(thread_db_thread_info): ... this, initialize fields.
(get_thread_db_thread_info): New.
<dying>: Change type to bool.
(update_thread_state): Adjust to type rename.
(record_thread): Adjust to type rename an use of unique_ptr.
(thread_db_pid_to_str): Likewise.
(thread_db_extra_thread_info): Likewise.
(thread_db_thread_handle_to_thread_info): Likewise.
(thread_db_get_thread_local_address): Likewise.
* nto-tdep.h (private_thread_info): Rename to ...
(nto_thread_info): ... this, initialize fields.
(get_nto_thread_info): New.
<name>: Change type to std::string.
* nto-tdep.c (nto_extra_thread_info): Adjust to type rename and
use of unique_ptr.
* nto-procfs.c (update_thread_private_data_name): Adjust to
std::string change, allocate nto_private_thread_info with new.
(update_thread_private_data): Adjust to unique_ptr.
* remote.c (private_thread_info): Rename to ...
(remote_thread_info): ... this, initialize data members with
default values.
<extra, name>: Change type to std::string.
<thread_handle>: Change type to non-pointer.
(free_private_thread_info): Remove.
(get_private_info_thread): Rename to...
(get_remote_thread_info): ... this, change return type, adjust to
use of unique_ptr, use remote_thread_info constructor.
(remote_add_thread): Adjust.
(get_private_info_ptid): Rename to...
(get_remote_thread_info): ...this, change return type.
(remote_thread_name): Use get_remote_thread_info, adjust to
change to std::string.
(struct thread_item) <~thread_item>: Remove.
<thread_handle>: Make non pointer.
(start_thread): Adjust to thread_item::thread_handle type
change.
(remote_update_thread_list): Adjust to type name change, move
strings from temporary to long-lived object instead of
duplicating.
(remote_threads_extra_info): Use get_remote_thread_info.
(process_initial_stop_replies): Likewise.
(resume_clear_thread_private_info): Likewise.
(remote_resume): Adjust to type name change.
(remote_commit_resume): Use get_remote_thread_info.
(process_stop_reply): Adjust to type name change.
(remote_stopped_by_sw_breakpoint): Use get_remote_thread_info.
(remote_stopped_by_hw_breakpoint): Likewise.
(remote_stopped_by_watchpoint): Likewise.
(remote_stopped_data_address): Likewise.
(remote_core_of_thread): Likewise.
(remote_thread_handle_to_thread_info): Use
get_private_info_thread, adjust to thread_handle field type
change.

21fe1c7 2017-11-25 00:40:15 Simon Marchi

remote: C++ify thread_item and threads_listing_context

This patch C++ifies the thread_item and threads_listing_context
structures in remote.c. thread_item::{extra,name} are changed to
std::string. As a result, there's a bit of awkwardness in
remote_update_thread_list, where we have to xstrdup those strings when
filling the private_thread_info structure. This is removed in the
following patch, where private_thread_info is also C++ified and its
corresponding fields made std::string too. The xstrdup then becomes an
std::move.

Other than that there's nothing really special, it's a usual day-to-day
VEC -> vector and char* -> std::string change. It allows removing a
cleanup in remote_update_thread_list.

Note that an overload of hex2bin that returns a gdb::byte_vector is
added, with corresponding selftests.

gdb/ChangeLog:

* remote.c (struct thread_item): Add constructor, disable copy
construction and copy assignment, define default move
construction and move assignment.
<extra, name>: Change type to std::string.
<core>: Initialize.
<thread_handle>: Make non-pointer.
(thread_item_t): Remove typedef.
(DEF_VEC_O(thread_item_t)): Remove.
(threads_listing_context) <contains_thread>: New method.
<remove_thread>: New method.
<items>: Change type to std::vector.
(clear_threads_listing_context): Remove.
(threads_listing_context_remove): Remove.
(remote_newthread_step): Use thread_item constructor, adjust to
change to std::vector.
(start_thread): Use thread_item constructor, adjust to change to
std::vector.
(end_thread): Adjust to change to std::vector and std::string.
(remote_get_threads_with_qthreadinfo): Use thread_item
constructor, adjust to std::vector.
(remote_update_thread_list): Adjust to change to std::vector and
std::string, use threads_listing_context methods.
(remove_child_of_pending_fork): Adjust.
(remove_new_fork_children): Adjust.
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add rsp-low-selftests.c.
(SUBDIR_UNITTESTS_OBS): Add rsp-low-selftests.o.
* unittests/rsp-low-selftests.c: New file.
* common/rsp-low.h: Include common/byte-vector.h.
(hex2bin): New overload.
* common/rsp-low.c (hex2bin): New overload.

089354b 2017-11-25 00:39:31 Simon Marchi

Create private_inferior class hierarchy

There are currently multiple definitions of private_inferior, defined in
remote.c and darwin-nat.h. The patch that poisons XNEW and friends for
non-POD types trips on that, because private_inferior is freed in
~inferior(), where it is an opaque type. Since the compiler can't tell
whether the type is POD, it gives an error. Also, we can't start using
C++ features in these structures (make them non-POD) as long as there
are multiple definitions with the same name. For these reasons, this
patch makes a class hierarchy, with private_inferior being the abstract
base class, and darwin_inferior & remote_inferior inheriting from it.
Destruction is done through the virtual destructor.

I stumbled on some suspicious code in the darwin implementation though.
darwin_check_new_threads does an XCNEW(darwin_thread_t) when it finds a
new thread, allocating a new structure for it (darwin_thread_t is a
typedef for private_thread_info). It then VEC_safe_pushes it in a
vector defined as DEF_VEC_O (a vector of objects). This means that the
structure content gets copied in the vector. The thread_info object is
created with the XCNEW'ed structure as the private thread info, while
the rest of the code works with the instance in the vector. We have
therefore two distinct instances of darwin_thread_t/private_thread_info
for each thread. This is not really a problem in practice, because
thread_info::priv is not used in the darwin code. I still find it weird
and far from ideal, so I tried to fix it by changing the vector to be a
vector of pointers. There should now be a single instance of the
structure for each thread. The deallocation of the
darwin_thread_t/private_thread_info structure is done by the thread_info
destructor.

I am able to build on macOS, but not really test, since the port seems a
bit broken. I am not able to debug reliably on the machine I have
access to, which runs macOS 10.12.6.

gdb/ChangeLog:

* inferior.h (private_inferior): Define structure type, add
virtual pure destructor.
(inferior) <priv>: Change type to unique_ptr.
* inferior.c (private_inferior::~private_inferior): Provide
default implementation.
(inferior::~inferior): Don't free priv field.
(exit_inferior_1): Likewise.
* darwin-nat.h (struct darwin_exception_info): Initialize fields.
(darwin_exception_info): Remove typedef.
(DEF_VEC_O (darwin_thread_t)); Remove.
(private_inferior): Rename to ...
(darwin_private_inferior): ... this, extend private_inferior.
(get_darwin_inferior): New.
<threads>: Change type to std::vector of darwin_thread_t pointers.
* darwin-nat.c (darwin_check_new_threads): Adjust.
(find_inferior_task_it): Adjust.
(darwin_find_thread); Adjust.
(darwin_suspend_inferior): Adjust.
(darwin_resume_inferior): Adjust.
(darwin_find_new_inferior): Adjust.
(darwin_decode_notify_message): Adjust.
(darwin_send_reply): Adjust.
(darwin_resume_inferior_threads): Adjust.
(darwin_suspend_inferior_threads): Adjust.
(darwin_decode_message): Adjust.
(darwin_wait): Adjust.
(darwin_interrupt): Adjust.
(darwin_deallocate_threads): Adjust.
(darwin_mourn_inferior): Adjust, don't free private data.
(darwin_reply_to_all_pending_messages): Adjust.
(darwin_stop_inferior): Adjust.
(darwin_setup_exceptions): Adjust.
(darwin_kill_inferior): Adjust.
(darwin_setup_request_notification): Adjust.
(darwin_attach_pid): Adjust.
(darwin_init_thread_list): Adjust.
(darwin_setup_fake_stop_event): Adjust.
(darwin_attach): Adjust.
(darwin_detach): Adjust.
(darwin_xfer_partial): Adjust.
(set_enable_mach_exceptions): Adjust.
(darwin_pid_to_exec_file): Adjust.
(darwin_get_ada_task_ptid): Adjust.
* darwin-nat-info.c (get_task_from_args): Adjust.
(info_mach_ports_command): Adjust.
(info_mach_region_command): Adjust.
(info_mach_exceptions_command): Adjust.
* remote.c (private_inferior): Rename to ...
(remote_private_inferior): ... this, initialize fields.
(get_remote_inferior); New.
(remote_commit_resume): Use get_remote_inferior.
(check_pending_event_prevents_wildcard_vcont_callback): Likewise.

d044bac 2017-11-25 00:21:16 Pedro Alves

Document linespec/explicit locations & completion improvements (manual + NEWS)

gdb/ChangeLog:
2017-11-24 Pedro Alves <palves@redhat.com>

* NEWS: Mention linespecs and explicit locations, and completion
improvements.

gdb/doc/ChangeLog:
2017-11-24 Pedro Alves <palves@redhat.com>

* gdb.texinfo (Completion): Update need-quoting examples. Remove
false claim that GDB inserts quoting automatically.
(Symbols): Add anchor.

e8d58cb 2017-11-24 23:59:02 Yao Qi

Remove dead code in regcache::dump

footnote_register_size in regcache::dump is a constant zero, so the
condition check against footnote_register_size is dead code. The code
writing to footnote_register_size was removed by 01e1877.

This patche removes footnote_register_size and the dead code.

gdb:

2017-11-24 Yao Qi <yao.qi@linaro.org>

* regcache.c (regcache::dump): Remove footnote_register_size.