Compare commits

...

112 Commits

Author SHA1 Message Date
Joel Brobecker
c2bb526a22 Set GDB version number to 7.10.1.
gdb/ChangeLog:

	* version.in: Set GDB version number to 7.10.1.
2015-12-05 16:16:46 +01:00
GDB Administrator
9234ef44bf Automatic date update in version.in 2015-12-05 00:00:34 +00:00
GDB Administrator
92e6983be1 Automatic date update in version.in 2015-12-04 00:00:40 +00:00
GDB Administrator
bdaeeefd84 Automatic date update in version.in 2015-12-03 00:00:35 +00:00
Yao Qi
87a8c81ef0 Fix regression by Do not skip prologue for asm (.S) files
Patch "Do not skip prologue for asm (.S) files" [1] changes GDB's
behaviour on which test gdb.arch/thumb-singlestep.exp depends, so
it causes the fail below:

 (gdb) si^M
 37              blx     foo^M
 (gdb) FAIL: gdb.arch/thumb-singlestep.exp: step into foo

the test assumes the program will stop at the instruction after "push"
but it doesn't.  The fix to this fail is to do one more single step.

[1] https://sourceware.org/ml/gdb-patches/2015-06/msg00561.html

gdb/testsuite:

2015-12-02  Yao Qi  <yao.qi@linaro.org>

	* gdb.arch/thumb-singlestep.exp: Do one more single step.
2015-12-02 09:32:34 +00:00
GDB Administrator
01382ffd00 Automatic date update in version.in 2015-12-02 00:00:32 +00:00
GDB Administrator
c8b5fa335e Automatic date update in version.in 2015-12-01 00:00:39 +00:00
GDB Administrator
1fdd609138 Automatic date update in version.in 2015-11-30 00:00:35 +00:00
GDB Administrator
121ed3f9e2 Automatic date update in version.in 2015-11-29 00:00:41 +00:00
Pedro Alves
9a2752c7f0 Adjust GDB to demangler API change
Before commit 3a8724032abf, DEMANGLE_COMPONENT_CAST was used for both
casts and conversion operators.  We now have
DEMANGLE_COMPONENT_CONVERSION for the latter.

gdb/ChangeLog:
2014-11-28  Pedro Alves  <palves@redhat.com>

	* cp-name-parser.y (conversion_op): Use
	DEMANGLE_COMPONENT_CONVERSION instead of DEMANGLE_COMPONENT_CAST.
2015-11-28 17:11:45 +00:00
Pedro Alves
49037e4a12 PR other/61321 - demangler crash on casts in template parameters
The fix for bug 59195:

 [C++ demangler handles conversion operator incorrectly]
 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59195

unfortunately makes the demangler crash due to infinite recursion, in
case of casts in template parameters.

For example, with:

 template<int> struct A {};
 template <typename Y> void function_temp(A<sizeof ((Y)(999))>) {}
 template void function_temp<int>(A<sizeof (int)>);

The 'function_temp<int>' instantiation above mangles to:

  _Z13function_tempIiEv1AIXszcvT_Li999EEE

The demangler parses this as:

typed name
  template
    name 'function_temp'
    template argument list
      builtin type int
  function type
    builtin type void
    argument list
      template                          (*)
        name 'A'
        template argument list
          unary operator
            operator sizeof
            unary operator
              cast
                template parameter 0    (**)
              literal
                builtin type int
                name '999'

And after the fix for 59195, due to:

 static void
 d_print_cast (struct d_print_info *dpi, int options,
	       const struct demangle_component *dc)
 {
 ...
   /* For a cast operator, we need the template parameters from
      the enclosing template in scope for processing the type.  */
   if (dpi->current_template != NULL)
     {
       dpt.next = dpi->templates;
       dpi->templates = &dpt;
       dpt.template_decl = dpi->current_template;
     }

when printing the template argument list of A (what should be "<sizeof
(int)>"), the template parameter 0 (that is, "T_", the '**' above) now
refers to the first parameter of the the template argument list of the
'A' template (the '*' above), exactly what we were already trying to
print.  This leads to infinite recursion, and stack exaustion.  The
template parameter 0 should actually refer to the first parameter of
the 'function_temp' template.

Where it reads "for the cast operator" in the comment in d_print_cast
(above), it's really talking about a conversion operator, like:

  struct A { template <typename U> explicit operator U(); };

We don't want to inject the template parameters from the enclosing
template in scope when processing a cast _expression_, only when
handling a conversion operator.

The problem is that DEMANGLE_COMPONENT_CAST is currently ambiguous,
and means _both_ 'conversion operator' and 'cast expression'.

Fix this by adding a new DEMANGLE_COMPONENT_CONVERSION component type,
which does what DEMANGLE_COMPONENT_CAST does today, and making
DEMANGLE_COMPONENT_CAST just simply print its component subtree.

I think we could instead reuse DEMANGLE_COMPONENT_CAST and in
d_print_comp_inner still do:

 @@ -5001,9 +5013,9 @@ d_print_comp_inner (struct d_print_info *dpi, int options,
        d_print_comp (dpi, options, dc->u.s_extended_operator.name);
        return;

     case DEMANGLE_COMPONENT_CAST:
       d_append_string (dpi, "operator ");
 -     d_print_cast (dpi, options, dc);
 +     d_print_conversion (dpi, options, dc);
       return;

leaving the unary cast case below calling d_print_cast, but seems to
me that spliting the component types makes it easier to reason about
the code.

g++'s testsuite actually generates three symbols that crash the
demangler in the same way.  I've added those as tests in the demangler
testsuite as well.

And then this fixes PR other/61233 too, which happens to be a
demangler crash originally reported to GDB, at:
https://sourceware.org/bugzilla/show_bug.cgi?id=16957

Bootstrapped and regtested on x86_64 Fedora 20.

Also ran this through GDB's testsuite.  GDB will require a small
update to use DEMANGLE_COMPONENT_CONVERSION in one place it's using
DEMANGLE_COMPONENT_CAST in its sources.

libiberty/
2015-11-27  Pedro Alves  <palves@redhat.com>

        PR other/61321
        PR other/61233
        * demangle.h (enum demangle_component_type)
        <DEMANGLE_COMPONENT_CONVERSION>: New value.
        * cp-demangle.c (d_demangle_callback, d_make_comp): Handle
        DEMANGLE_COMPONENT_CONVERSION.
        (is_ctor_dtor_or_conversion): Handle DEMANGLE_COMPONENT_CONVERSION
        instead of DEMANGLE_COMPONENT_CAST.
        (d_operator_name): Return a DEMANGLE_COMPONENT_CONVERSION
        component if handling a conversion.
        (d_count_templates_scopes, d_print_comp_inner): Handle
        DEMANGLE_COMPONENT_CONVERSION.
        (d_print_comp_inner): Handle DEMANGLE_COMPONENT_CONVERSION instead
        of DEMANGLE_COMPONENT_CAST.
        (d_print_cast): Rename as ...
        (d_print_conversion): ... this.  Adjust comments.
        (d_print_cast): Rewrite - simply print the left subcomponent.
        * cp-demint.c (cplus_demangle_fill_component): Handle
        DEMANGLE_COMPONENT_CONVERSION.

        * testsuite/demangle-expected: Add tests.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231020 138bc75d-0d04-0410-961f-82ee72b054a4
2015-11-28 17:11:45 +00:00
Jason Merrill
d65faac094 Implement N4514, C++ Extensions for Transactional Memory.
gcc/
	* builtins.def (BUILT_IN_ABORT): Add transaction_pure attribute.
gcc/c-family/
	* c-common.c (c_common_reswords): Add C++ TM TS keywords.
	(c_common_attribute_table): Add transaction_safe_dynamic.
	transaction_safe now affects type identity.
	(handle_tm_attribute): Handle transaction_safe_dynamic.
	* c-common.h (enum rid): Add RID_ATOMIC_NOEXCEPT,
	RID_ATOMIC_CANCEL, RID_SYNCHRONIZED.
	(OBJC_IS_CXX_KEYWORD): Add RID_SYNCHRONIZED.
	(D_TRANSMEM): New.
	* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_transactional_memory.
	* c-pretty-print.c (pp_c_attributes_display): Don't print
	transaction_safe in C++.
gcc/c/
	* c-parser.c (c_lex_one_token): Handle @synchronized.
	* c-decl.c (match_builtin_function_types): A declaration of a built-in
	can change whether the function is transaction_safe.
gcc/cp/
	* cp-tree.h (struct cp_declarator): Add tx_qualifier field.
	(BCS_NORMAL, BCS_TRANSACTION): New enumerators.
	* lex.c (init_reswords): Limit TM kewords to -fgnu-tm.
	* parser.c (cp_lexer_get_preprocessor_token): Fix @synchronized.
	(make_call_declarator): Take tx_qualifier.
	(cp_parser_tx_qualifier_opt): New.
	(cp_parser_lambda_declarator_opt): Use it.
	(cp_parser_direct_declarator): Likewise.
	(cp_parser_statement): Handle atomic_noexcept, atomic_cancel.
	(cp_parser_compound_statement): Change in_try parameter to bcs_flags.
	(cp_parser_std_attribute): Map optimize_for_synchronized to
	transaction_callable.
	(cp_parser_transaction): Take the token.  Handle atomic_noexcept.
	* lambda.c (maybe_add_lambda_conv_op): Handle transaction-safety.
	* call.c (enum conversion_kind): Add ck_tsafe.
	(standard_conversion): Handle transaction-safety conversion.
	(convert_like_real, resolve_address_of_overloaded_function): Likewise.
	(check_methods): Diagnose transaction_safe_dynamic on non-virtual
	function.
	(look_for_tm_attr_overrides): Don't inherit transaction_safe_dynamic.
	* cvt.c (tx_safe_fn_type_p, tx_unsafe_fn_variant)
	(can_convert_tx_safety): New.
	* typeck.c (composite_pointer_type): Handle transaction-safety.
	* name-lookup.h (enum scope_kind): Add sk_transaction.
	* name-lookup.c (begin_scope): Handle it.
	* semantics.c (begin_compound_stmt): Pass it.
	* decl.c (check_previous_goto_1): Check it.
	(struct named_label_entry): Add in_transaction_scope.
	(poplevel_named_label_1): Set it.
	(check_goto): Check it.
	(duplicate_decls): A specialization can be transaction_safe
	independently of its template.
	(grokdeclarator): Handle tx-qualifier.
	* rtti.c (ptr_initializer): Handle transaction-safe.
	* search.c (check_final_overrider): Check transaction_safe_dynamic.
	Don't check transaction_safe.
	* mangle.c (write_function_type): Mangle transaction_safe here.
	(write_CV_qualifiers_for_type): Not here.
	(write_type): Preserve transaction_safe when stripping attributes.
	* error.c (dump_type_suffix): Print transaction_safe.
libiberty/
	* cp-demangle.c (d_cv_qualifiers): Dx means transaction_safe.
	(cplus_demangle_type): Let d_cv_qualifiers handle it.
	(d_dump, d_make_comp, has_return_type, d_encoding)
	(d_count_templates_scopes, d_print_comp_inner)
	(d_print_mod_list, d_print_mod, d_print_function_type)
	(is_ctor_or_dtor): Handle DEMANGLE_COMPONENT_TRANSACTION_SAFE.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228462 138bc75d-0d04-0410-961f-82ee72b054a4
2015-11-28 17:11:44 +00:00
Ian Lance Taylor
99eda040d8 Demangler: Fix constructor names with ABI tags
The symbol _ZNSt8ios_base7failureB5cxx11C1EPKcRKSt10error_code, which
appears in libstdc++, was being demangled as

std::ios_base::failure[abi:cxx11]::cxx11(char const*, std::error_code const&)

That is clearly incorrect: std::ios_base::failure does not have a
method cxx11, and anyhow if you look closely at the mangled name you
will see that it is supposed to be a constructor.  This patch fixes
the demangler to generate the correct demangling, namely

std::ios_base::failure[abi:cxx11]::failure(char const*, std::error_code const&)

Bootstrapped and ran libiberty and libstdc++-v3 tests on
x86_64-unknown-linux-gnu.

2015-08-15  Ian Lance Taylor  <iant@google.com>

	* cp-demangle.c (d_abi_tags): Preserve di->last_name across any
	ABI tags.
2015-11-28 17:07:32 +00:00
Mikhail Maltsev
fde0a3e549 Fix several crashes of C++ demangler on fuzzed input.
libiberty/
	* cp-demangle.c (d_dump): Fix syntax error.
	(d_identifier): Adjust type of len to match d_source_name.
	(d_expression_1): Fix out-of-bounds access.  Check code variable for
	NULL before dereferencing it.
	(d_find_pack): Do not recurse for FIXED_TYPE, DEFAULT_ARG and NUMBER.
	(d_print_comp_inner): Add NULL pointer check.
	* cp-demangle.h (d_peek_next_char): Define as inline function when
	CHECK_DEMANGLER is defined.
	(d_advance): Likewise.
	* testsuite/demangle-expected: Add new testcases.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225727 138bc75d-0d04-0410-961f-82ee72b054a4
2015-11-28 16:59:46 +00:00
GDB Administrator
1dc1927e25 Automatic date update in version.in 2015-11-28 00:00:34 +00:00
GDB Administrator
c4c83242ea Automatic date update in version.in 2015-11-27 00:00:38 +00:00
Markus Metzger
bab694b7f9 btrace: diagnose "record btrace pt" without libipt
If GDB has been configured without libipt support, i.e. HAVE_LIBIPT is
undefined, and is running on a system that supports Intel(R) Processor Trace,
GDB will run into an internal error when trying to decode the trace.

    (gdb) record btrace
    (gdb) s
    usage (name=0x7fffffffe954 "fib-64")
        at src/fib.c:12
    12          fprintf(stderr, "usage: %s <num>\n", name);
    (gdb) info record
    Active record target: record-btrace
    Recording format: Intel(R) Processor Trace.
    Buffer size: 16kB.
    gdb/btrace.c:971: internal-error: Unexpected branch trace format.
    A problem internal to GDB has been detected,
    further debugging may prove unreliable.
    Quit this debugging session? (y or n)

This requires a system with Linux kernel 4.1 or later running on a 5th
Generation Intel Core processor or later.

The issue is documented as PR 19297.

When trying to enable branch tracing, in addition to checking the target
support for the requested branch tracing format, also check whether GDB
supports. it.

gdb/
	* btrace.c (btrace_enable): Check whether HAVE_LIBIPT is defined.
2015-11-26 13:16:13 +01:00
GDB Administrator
70341a0320 Automatic date update in version.in 2015-11-26 00:00:32 +00:00
GDB Administrator
757295aed8 Automatic date update in version.in 2015-11-25 00:00:31 +00:00
GDB Administrator
866aba2f3f Automatic date update in version.in 2015-11-24 00:00:30 +00:00
GDB Administrator
8a71ab1dd3 Automatic date update in version.in 2015-11-23 00:00:31 +00:00
GDB Administrator
99f3bd8149 Automatic date update in version.in 2015-11-22 00:00:35 +00:00
GDB Administrator
8bcab5edb2 Automatic date update in version.in 2015-11-21 00:01:00 +00:00
GDB Administrator
c17e7b9386 Automatic date update in version.in 2015-11-20 00:00:37 +00:00
GDB Administrator
1cc835f4ed Automatic date update in version.in 2015-11-19 00:00:45 +00:00
GDB Administrator
2739eb3359 Automatic date update in version.in 2015-11-18 00:00:37 +00:00
GDB Administrator
89f5b69dd8 Automatic date update in version.in 2015-11-17 00:00:40 +00:00
GDB Administrator
8b593a34ee Automatic date update in version.in 2015-11-16 00:00:31 +00:00
GDB Administrator
28098f2c59 Automatic date update in version.in 2015-11-15 00:00:34 +00:00
GDB Administrator
483ec498cb Automatic date update in version.in 2015-11-14 00:00:33 +00:00
GDB Administrator
47400476a2 Automatic date update in version.in 2015-11-13 00:00:32 +00:00
GDB Administrator
978461c7af Automatic date update in version.in 2015-11-12 00:00:40 +00:00
GDB Administrator
dc544175c0 Automatic date update in version.in 2015-11-11 00:00:32 +00:00
GDB Administrator
15aa89a588 Automatic date update in version.in 2015-11-10 00:00:31 +00:00
GDB Administrator
64ab977fde Automatic date update in version.in 2015-11-09 00:00:45 +00:00
GDB Administrator
59925580b7 Automatic date update in version.in 2015-11-08 00:00:38 +00:00
GDB Administrator
0e3adc94fa Automatic date update in version.in 2015-11-07 00:00:35 +00:00
GDB Administrator
40430ae983 Automatic date update in version.in 2015-11-06 00:00:31 +00:00
GDB Administrator
890a027361 Automatic date update in version.in 2015-11-05 00:00:36 +00:00
GDB Administrator
c0fab01b98 Automatic date update in version.in 2015-11-04 00:00:28 +00:00
GDB Administrator
e000bd2af2 Automatic date update in version.in 2015-11-03 00:00:37 +00:00
GDB Administrator
c0b6cd5664 Automatic date update in version.in 2015-11-02 00:00:40 +00:00
GDB Administrator
dcb213fcbe Automatic date update in version.in 2015-11-01 00:00:37 +00:00
GDB Administrator
bec257f7ce Automatic date update in version.in 2015-10-31 00:00:30 +00:00
GDB Administrator
949b9ae781 Automatic date update in version.in 2015-10-30 00:00:33 +00:00
GDB Administrator
d418c8ed93 Automatic date update in version.in 2015-10-29 00:00:38 +00:00
GDB Administrator
8bbeb88b59 Automatic date update in version.in 2015-10-28 00:00:37 +00:00
GDB Administrator
052e52d302 Automatic date update in version.in 2015-10-27 00:00:48 +00:00
GDB Administrator
abde461669 Automatic date update in version.in 2015-10-26 00:00:28 +00:00
GDB Administrator
4f0e1f7fa3 Automatic date update in version.in 2015-10-25 00:00:30 +00:00
GDB Administrator
7659a298ef Automatic date update in version.in 2015-10-24 00:00:29 +00:00
GDB Administrator
e9257300e8 Automatic date update in version.in 2015-10-23 00:00:24 +00:00
GDB Administrator
bf9576cdae Automatic date update in version.in 2015-10-22 00:00:35 +00:00
GDB Administrator
249f762ce4 Automatic date update in version.in 2015-10-21 00:00:35 +00:00
GDB Administrator
b84c2850fe Automatic date update in version.in 2015-10-20 00:00:34 +00:00
GDB Administrator
ac55db1af8 Automatic date update in version.in 2015-10-19 00:00:25 +00:00
GDB Administrator
98280491b1 Automatic date update in version.in 2015-10-18 00:00:32 +00:00
GDB Administrator
a491a09897 Automatic date update in version.in 2015-10-17 00:00:33 +00:00
GDB Administrator
77871966bf Automatic date update in version.in 2015-10-16 00:00:28 +00:00
GDB Administrator
d407cdc9f4 Automatic date update in version.in 2015-10-15 00:00:26 +00:00
GDB Administrator
359d19073c Automatic date update in version.in 2015-10-14 00:00:35 +00:00
GDB Administrator
bb7c63525c Automatic date update in version.in 2015-10-13 00:00:29 +00:00
GDB Administrator
9d97bbb2ca Automatic date update in version.in 2015-10-12 00:00:28 +00:00
GDB Administrator
5bc9d9735f Automatic date update in version.in 2015-10-11 00:00:26 +00:00
GDB Administrator
92d9638ed7 Automatic date update in version.in 2015-10-10 00:00:24 +00:00
GDB Administrator
c364c793db Automatic date update in version.in 2015-10-09 00:00:31 +00:00
GDB Administrator
f0bd542bb3 Automatic date update in version.in 2015-10-08 00:00:30 +00:00
GDB Administrator
67ab3de484 Automatic date update in version.in 2015-10-07 00:00:44 +00:00
GDB Administrator
7fa30cf041 Automatic date update in version.in 2015-10-06 00:00:33 +00:00
GDB Administrator
1eda0a43df Automatic date update in version.in 2015-10-05 00:00:25 +00:00
GDB Administrator
31f601b9d5 Automatic date update in version.in 2015-10-04 00:00:31 +00:00
GDB Administrator
8b064c652d Automatic date update in version.in 2015-10-03 00:00:31 +00:00
GDB Administrator
fb28718376 Automatic date update in version.in 2015-10-02 00:00:27 +00:00
GDB Administrator
fb961a3831 Automatic date update in version.in 2015-10-01 00:00:37 +00:00
GDB Administrator
13ee570ecf Automatic date update in version.in 2015-09-30 00:00:26 +00:00
GDB Administrator
ff720a983b Automatic date update in version.in 2015-09-29 00:00:23 +00:00
GDB Administrator
d67b05090b Automatic date update in version.in 2015-09-28 00:00:29 +00:00
GDB Administrator
14fbc6b96d Automatic date update in version.in 2015-09-27 00:00:24 +00:00
GDB Administrator
42e294dd10 Automatic date update in version.in 2015-09-26 00:00:29 +00:00
GDB Administrator
99c84c8f4d Automatic date update in version.in 2015-09-25 00:00:25 +00:00
GDB Administrator
169bcce707 Automatic date update in version.in 2015-09-24 00:00:33 +00:00
GDB Administrator
935fcae11a Automatic date update in version.in 2015-09-23 00:00:23 +00:00
GDB Administrator
924c868252 Automatic date update in version.in 2015-09-22 00:00:26 +00:00
GDB Administrator
883ab1278b Automatic date update in version.in 2015-09-21 00:00:29 +00:00
GDB Administrator
b37fa5a2cf Automatic date update in version.in 2015-09-20 00:00:34 +00:00
GDB Administrator
32733b89ed Automatic date update in version.in 2015-09-19 00:00:25 +00:00
GDB Administrator
78fc1068f0 Automatic date update in version.in 2015-09-18 00:00:25 +00:00
GDB Administrator
8b518c24e9 Automatic date update in version.in 2015-09-17 00:00:30 +00:00
GDB Administrator
2dfdc67d32 Automatic date update in version.in 2015-09-16 00:00:24 +00:00
Pedro Alves
9c53c9a4a2 gdb/doc: revert previous vforkdone change
The previous manual change was wrong.  The vfork parent thread ID
should be reported with the usual "thread" magic register:

   Sending packet: $vCont;c:p7260.7260#1e...Packet received: OK
 -   Notification received: Stop:T05vforkdone:;
 +   Notification received: Stop:T05vforkdone:;thread:p7260.7260
                                               ^^^^^^^^^^^^^^^^^

This is already how the parent is reported in the vfork/fork events,
and is actually what the fix made gdbserver do.  Following the
documentation change, the event would have been reported like this
instead:

    Notification received: Stop:T05vforkdone:p7260.7260

gdb/doc/ChangeLog:
2015-09-15  Pedro Alves  <palves@redhat.com>

	PR remote/18965
	* gdb.texinfo (Stop Reply Packets): Revert previous change to
	the vforkdone description.
2015-09-15 19:35:56 +01:00
Pedro Alves
487bf2f706 PR remote/18965: vforkdone stop reply should indicate parent PID
The vforkdone stop reply misses indicating the thread ID of the vfork
parent which the event relates to:

 @cindex vfork events, remote reply
 @item vfork
 The packet indicates that @code{vfork} was called, and @var{r}
 is the thread ID of the new child process. Refer to
 @ref{thread-id syntax} for the format of the @var{thread-id}
 field.  This packet is only applicable to targets that support
 vfork events.

 @cindex vforkdone events, remote reply
 @item vforkdone
 The packet indicates that a child process created by a vfork
 has either called @code{exec} or terminated, so that the
 address spaces of the parent and child process are no longer
 shared. The @var{r} part is ignored.  This packet is only
 applicable to targets that support vforkdone events.

Unfortunately, this is not just a documentation issue.  GDBserver
is really not specifying the thread ID.  I noticed because
in non-stop mode, gdb complains:

 [Thread 6089.6089] #1 stopped.
 #0  0x0000003615a011f0 in ?? ()
 0x0000003615a011f0 in ?? ()
 (gdb) set debug remote 1
 (gdb) c
 Continuing.
 Sending packet: $QPassSignals:e;10;14;17;1a;1b;1c;21;24;25;2c;4c;#5f...Packet received: OK
 Sending packet: $vCont;c:p17c9.17c9#88...Packet received: OK
   Notification received: Stop:T05vfork:p17ce.17ce;06:40d7ffffff7f0000;07:30d7ffffff7f0000;10:e4c9eb1536000000;thread:p17c9.17c9;core:2;
 Sending packet: $vStopped#55...Packet received: OK
 Sending packet: $D;17ce#af...Packet received: OK
 Sending packet: $vCont;c:p17c9.17c9#88...Packet received: OK
   Notification received: Stop:T05vforkdone:;
 No process or thread specified in stop reply: T05vforkdone:;
 (gdb)

This is not non-stop-mode-specific, however.  Consider e.g., that in
all-stop, you may be debugging more than one process at the same time.
You continue, and both processes vfork.  So when you next get a
T05vforkdone, there's no way to tell which of the parent processes is
done with the vfork.

Tests will be added later.

Tested on x86_64 Fedora 20.

gdb/gdbserver/ChangeLog:
2015-09-15  Pedro Alves  <palves@redhat.com>

	PR remote/18965
	* remote-utils.c (prepare_resume_reply): Merge
	TARGET_WAITKIND_VFORK_DONE switch case with the
	TARGET_WAITKIND_FORKED case.

gdb/doc/ChangeLog:
2015-09-15  Pedro Alves  <palves@redhat.com>

	PR remote/18965
	* gdb.texinfo (Stop Reply Packets): Explain that vforkdone's 'r'
	part indicates the thread ID of the parent process.
2015-09-15 17:45:26 +01:00
GDB Administrator
8f1d470248 Automatic date update in version.in 2015-09-15 00:00:25 +00:00
Gary Benson
a8c636cb54 Fix build issue with nat/linux-namespaces.c
This commit fixes a build issue on systems with a prototype for setns
in their header files but no working setns is detected by configure.

gdb/ChangeLog:

	PR gdb/18957
	* nat/linux-namespaces.c (setns): Rename from this ...
	(do_setns): ... to this.  Support calling setns if it exists.
	(mnsh_handle_setns): Call do_setns.
2015-09-14 11:02:06 +01:00
GDB Administrator
2928b1844d Automatic date update in version.in 2015-09-14 00:00:31 +00:00
GDB Administrator
8011d680c8 Automatic date update in version.in 2015-09-13 00:00:29 +00:00
GDB Administrator
b5eaa25e19 Automatic date update in version.in 2015-09-12 00:00:24 +00:00
GDB Administrator
d9018fcbe4 Automatic date update in version.in 2015-09-11 00:00:26 +00:00
GDB Administrator
fb1645ee60 Automatic date update in version.in 2015-09-10 00:00:25 +00:00
GDB Administrator
b310d39dd7 Automatic date update in version.in 2015-09-09 00:00:24 +00:00
GDB Administrator
b4c34d6c3d Automatic date update in version.in 2015-09-08 00:00:28 +00:00
GDB Administrator
ed23c559e8 Automatic date update in version.in 2015-09-07 00:00:30 +00:00
GDB Administrator
e59f2de1ac Automatic date update in version.in 2015-09-06 00:00:48 +00:00
GDB Administrator
f0696724f9 Automatic date update in version.in 2015-09-05 00:00:25 +00:00
GDB Administrator
2ed19d6656 Automatic date update in version.in 2015-09-04 00:00:25 +00:00
GDB Administrator
a2be137bb6 Automatic date update in version.in 2015-09-03 00:00:31 +00:00
GDB Administrator
15134533af Automatic date update in version.in 2015-09-02 00:00:35 +00:00
GDB Administrator
d3908ed37f Automatic date update in version.in 2015-09-01 00:00:24 +00:00
GDB Administrator
627b650e78 Automatic date update in version.in 2015-08-31 00:00:25 +00:00
GDB Administrator
7778100946 Automatic date update in version.in 2015-08-30 00:00:25 +00:00
GDB Administrator
2e106bef86 Automatic date update in version.in 2015-08-29 00:00:28 +00:00
Joel Brobecker
731da5a0b3 Bump GDB version number to 7.10.0.DATE-cvs.
gdb/ChangeLog:

	* version.in: Set GDB version number to 7.10.0.DATE-cvs.
2015-08-28 17:40:58 -04:00
Joel Brobecker
e79ede2a14 Document the GDB 7.10 release in gdb/ChangeLog
gdb/ChangeLog:

	GDB 7.10 released.
2015-08-28 17:37:57 -04:00
17 changed files with 315 additions and 40 deletions

View File

@@ -1,4 +1,4 @@
#define BFD_VERSION_DATE 20150828
#define BFD_VERSION_DATE 20151205
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@

View File

@@ -1,3 +1,32 @@
2015-12-05 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 7.10.1.
2014-11-28 Pedro Alves <palves@redhat.com>
* cp-name-parser.y (conversion_op): Use
DEMANGLE_COMPONENT_CONVERSION instead of DEMANGLE_COMPONENT_CAST.
2015-11-26 Markus Metzger <markus.t.metzger@intel.com>
PR 19297
* btrace.c (btrace_enable): Check whether HAVE_LIBIPT is defined.
2015-09-14 Peter Bergner <bergner@vnet.ibm.com>
PR gdb/18957
* nat/linux-namespaces.c (setns): Rename from this ...
(do_setns): ... to this. Support calling setns if it exists.
(mnsh_handle_setns): Call do_setns.
2015-08-28 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 7.10.0.DATE-cvs.
2015-08-28 Joel Brobecker <brobecker@adacore.com>
GDB 7.10 released.
2015-08-28 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 7.10.

View File

@@ -1020,6 +1020,11 @@ btrace_enable (struct thread_info *tp, const struct btrace_config *conf)
if (tp->btrace.target != NULL)
return;
#if !defined (HAVE_LIBIPT)
if (conf->format == BTRACE_FORMAT_PT)
error (_("GDB does not support Intel(R) Processor Trace."));
#endif /* !defined (HAVE_LIBIPT) */
if (!target_supports_btrace (conf->format))
error (_("Target does not support branch tracing."));

View File

@@ -528,7 +528,7 @@ oper : OPERATOR NEW
since it's not clear that it's parseable. */
conversion_op
: OPERATOR typespec_2
{ $$ = fill_comp (DEMANGLE_COMPONENT_CAST, $2, NULL); }
{ $$ = fill_comp (DEMANGLE_COMPONENT_CONVERSION, $2, NULL); }
;
conversion_op_name

View File

@@ -1,3 +1,15 @@
2015-09-15 Pedro Alves <palves@redhat.com>
PR remote/18965
* gdb.texinfo (Stop Reply Packets): Revert previous change to
the vforkdone description.
2015-09-15 Pedro Alves <palves@redhat.com>
PR remote/18965
* gdb.texinfo (Stop Reply Packets): Explain that vforkdone's 'r'
part indicates the thread ID of the parent process.
2015-07-20 Doug Evans <dje@google.com>
* Makefile.in (STABS_DOC_BUILD_INCLUDES): Add gdb-cfg.texi, GDBvn.texi.

View File

@@ -1,3 +1,10 @@
2015-09-15 Pedro Alves <palves@redhat.com>
PR remote/18965
* remote-utils.c (prepare_resume_reply): Merge
TARGET_WAITKIND_VFORK_DONE switch case with the
TARGET_WAITKIND_FORKED case.
2015-08-19 Gary Benson <gbenson@redhat.com>
* hostio.c (handle_pread): Do not attempt to read more data

View File

@@ -1116,6 +1116,7 @@ prepare_resume_reply (char *buf, ptid_t ptid,
case TARGET_WAITKIND_STOPPED:
case TARGET_WAITKIND_FORKED:
case TARGET_WAITKIND_VFORKED:
case TARGET_WAITKIND_VFORK_DONE:
{
struct thread_info *saved_thread;
const char **regp;
@@ -1133,6 +1134,12 @@ prepare_resume_reply (char *buf, ptid_t ptid,
buf = write_ptid (buf, status->value.related_pid);
strcat (buf, ";");
}
else if (status->kind == TARGET_WAITKIND_VFORK_DONE && report_vfork_events)
{
enum gdb_signal signal = GDB_SIGNAL_TRAP;
sprintf (buf, "T%02xvforkdone:;", signal);
}
else
sprintf (buf, "T%02x", status->value.sig);
@@ -1248,16 +1255,6 @@ prepare_resume_reply (char *buf, ptid_t ptid,
else
sprintf (buf, "X%02x", status->value.sig);
break;
case TARGET_WAITKIND_VFORK_DONE:
if (report_vfork_events)
{
enum gdb_signal signal = GDB_SIGNAL_TRAP;
sprintf (buf, "T%02xvforkdone:;", signal);
}
else
sprintf (buf, "T%02x", GDB_SIGNAL_0);
break;
default:
error ("unhandled waitkind");
break;

View File

@@ -34,18 +34,18 @@ int debug_linux_namespaces;
/* Handle systems without setns. */
#ifndef HAVE_SETNS
static int
setns (int fd, int nstype)
static inline int
do_setns (int fd, int nstype)
{
#ifdef __NR_setns
#ifdef HAVE_SETNS
return setns (fd, nstype);
#elif defined __NR_setns
return syscall (__NR_setns, fd, nstype);
#else
errno = ENOSYS;
return -1;
#endif
}
#endif
/* Handle systems without MSG_CMSG_CLOEXEC. */
@@ -495,7 +495,7 @@ mnsh_recv_message (int sock, enum mnsh_msg_type *type,
static ssize_t
mnsh_handle_setns (int sock, int fd, int nstype)
{
int result = setns (fd, nstype);
int result = do_setns (fd, nstype);
return mnsh_return_int (sock, result, errno);
}

View File

@@ -1,3 +1,7 @@
2015-12-02 Yao Qi <yao.qi@linaro.org>
* gdb.arch/thumb-singlestep.exp: Do one more single step.
2015-08-21 Gary Benson <gbenson@redhat.com>
* gdb.trace/pending.exp: Cope with remote transfer warnings.

View File

@@ -34,5 +34,8 @@ if ![runto_main] then {
return -1
}
# GDB doesn't skip prologue for asm files, so do one single step to
# pass instruction "push".
gdb_test "si" "blx foo.*" "single step"
gdb_test "si" "foo \\(\\) at .*${srcfile}.*mov r0,#42.*" "step into foo"

View File

@@ -1 +1 @@
7.10
7.10.1

View File

@@ -379,6 +379,10 @@ enum demangle_component_type
/* A typecast, represented as a unary operator. The one subtree is
the type to which the argument should be cast. */
DEMANGLE_COMPONENT_CAST,
/* A conversion operator, represented as a unary operator. The one
subtree is the type to which the argument should be converted
to. */
DEMANGLE_COMPONENT_CONVERSION,
/* A nullary expression. The left subtree is the operator. */
DEMANGLE_COMPONENT_NULLARY,
/* A unary expression. The left subtree is the operator, and the
@@ -442,6 +446,8 @@ enum demangle_component_type
DEMANGLE_COMPONENT_PACK_EXPANSION,
/* A name with an ABI tag. */
DEMANGLE_COMPONENT_TAGGED_NAME,
/* A transaction-safe function type. */
DEMANGLE_COMPONENT_TRANSACTION_SAFE,
/* A cloned function. */
DEMANGLE_COMPONENT_CLONE
};

View File

@@ -1,3 +1,54 @@
2015-11-28 Pedro Alves <palves@redhat.com>
PR other/61321
PR other/61233
* demangle.h (enum demangle_component_type)
<DEMANGLE_COMPONENT_CONVERSION>: New value.
* cp-demangle.c (d_demangle_callback, d_make_comp): Handle
DEMANGLE_COMPONENT_CONVERSION.
(is_ctor_dtor_or_conversion): Handle DEMANGLE_COMPONENT_CONVERSION
instead of DEMANGLE_COMPONENT_CAST.
(d_operator_name): Return a DEMANGLE_COMPONENT_CONVERSION
component if handling a conversion.
(d_count_templates_scopes, d_print_comp_inner): Handle
DEMANGLE_COMPONENT_CONVERSION.
(d_print_comp_inner): Handle DEMANGLE_COMPONENT_CONVERSION instead
of DEMANGLE_COMPONENT_CAST.
(d_print_cast): Rename as ...
(d_print_conversion): ... this. Adjust comments.
(d_print_cast): Rewrite - simply print the left subcomponent.
* cp-demint.c (cplus_demangle_fill_component): Handle
DEMANGLE_COMPONENT_CONVERSION.
* testsuite/demangle-expected: Add tests.
2015-11-28 Jason Merrill <jason@redhat.com>
* cp-demangle.c (d_cv_qualifiers): Dx means transaction_safe.
(cplus_demangle_type): Let d_cv_qualifiers handle it.
(d_dump, d_make_comp, has_return_type, d_encoding)
(d_count_templates_scopes, d_print_comp_inner)
(d_print_mod_list, d_print_mod, d_print_function_type)
(is_ctor_or_dtor): Handle DEMANGLE_COMPONENT_TRANSACTION_SAFE.
2015-11-28 Ian Lance Taylor <iant@google.com>
* cp-demangle.c (d_abi_tags): Preserve di->last_name across any
ABI tags.
2015-11-28 Mikhail Maltsev <maltsevm@gmail.com>
* cp-demangle.c (d_dump): Fix syntax error.
(d_identifier): Adjust type of len to match d_source_name.
(d_expression_1): Fix out-of-bounds access. Check code variable for
NULL before dereferencing it.
(d_find_pack): Do not recurse for FIXED_TYPE, DEFAULT_ARG and NUMBER.
(d_print_comp_inner): Add NULL pointer check.
* cp-demangle.h (d_peek_next_char): Define as inline function when
CHECK_DEMANGLER is defined.
(d_advance): Likewise.
* testsuite/demangle-expected: Add new testcases.
2015-06-01 Jason Merrill <jason@redhat.com>
* cp-demangle.c (cplus_demangle_type): Handle arguments to vendor

View File

@@ -93,7 +93,11 @@
CP_DEMANGLE_DEBUG
If defined, turns on debugging mode, which prints information on
stdout about the mangled string. This is not generally useful.
*/
CHECK_DEMANGLER
If defined, additional sanity checks will be performed. It will
cause some slowdown, but will allow to catch out-of-bound access
errors earlier. This macro is intended for testing and debugging. */
#if defined (_AIX) && !defined (__GNUC__)
#pragma alloca
@@ -419,7 +423,7 @@ static struct demangle_component *d_source_name (struct d_info *);
static long d_number (struct d_info *);
static struct demangle_component *d_identifier (struct d_info *, int);
static struct demangle_component *d_identifier (struct d_info *, long);
static struct demangle_component *d_operator_name (struct d_info *);
@@ -538,8 +542,10 @@ d_print_array_type (struct d_print_info *, int,
static void
d_print_expr_op (struct d_print_info *, int, const struct demangle_component *);
static void
d_print_cast (struct d_print_info *, int, const struct demangle_component *);
static void d_print_cast (struct d_print_info *, int,
const struct demangle_component *);
static void d_print_conversion (struct d_print_info *, int,
const struct demangle_component *);
static int d_demangle_callback (const char *, int,
demangle_callbackref, void *);
@@ -682,6 +688,9 @@ d_dump (struct demangle_component *dc, int indent)
case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS:
printf ("rvalue reference this\n");
break;
case DEMANGLE_COMPONENT_TRANSACTION_SAFE:
printf ("transaction_safe this\n");
break;
case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
printf ("vendor type qualifier\n");
break;
@@ -715,7 +724,7 @@ d_dump (struct demangle_component *dc, int indent)
case DEMANGLE_COMPONENT_FIXED_TYPE:
printf ("fixed-point type, accum? %d, sat? %d\n",
dc->u.s_fixed.accum, dc->u.s_fixed.sat);
d_dump (dc->u.s_fixed.length, indent + 2)
d_dump (dc->u.s_fixed.length, indent + 2);
break;
case DEMANGLE_COMPONENT_ARGLIST:
printf ("argument list\n");
@@ -729,6 +738,9 @@ d_dump (struct demangle_component *dc, int indent)
case DEMANGLE_COMPONENT_CAST:
printf ("cast\n");
break;
case DEMANGLE_COMPONENT_CONVERSION:
printf ("conversion operator\n");
break;
case DEMANGLE_COMPONENT_NULLARY:
printf ("nullary operator\n");
break;
@@ -938,6 +950,7 @@ d_make_comp (struct d_info *di, enum demangle_component_type type,
case DEMANGLE_COMPONENT_IMAGINARY:
case DEMANGLE_COMPONENT_VENDOR_TYPE:
case DEMANGLE_COMPONENT_CAST:
case DEMANGLE_COMPONENT_CONVERSION:
case DEMANGLE_COMPONENT_JAVA_RESOURCE:
case DEMANGLE_COMPONENT_DECLTYPE:
case DEMANGLE_COMPONENT_PACK_EXPANSION:
@@ -966,6 +979,7 @@ d_make_comp (struct d_info *di, enum demangle_component_type type,
case DEMANGLE_COMPONENT_RESTRICT_THIS:
case DEMANGLE_COMPONENT_VOLATILE_THIS:
case DEMANGLE_COMPONENT_CONST_THIS:
case DEMANGLE_COMPONENT_TRANSACTION_SAFE:
case DEMANGLE_COMPONENT_REFERENCE_THIS:
case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS:
case DEMANGLE_COMPONENT_ARGLIST:
@@ -1208,6 +1222,7 @@ has_return_type (struct demangle_component *dc)
case DEMANGLE_COMPONENT_CONST_THIS:
case DEMANGLE_COMPONENT_REFERENCE_THIS:
case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS:
case DEMANGLE_COMPONENT_TRANSACTION_SAFE:
return has_return_type (d_left (dc));
}
}
@@ -1229,7 +1244,7 @@ is_ctor_dtor_or_conversion (struct demangle_component *dc)
return is_ctor_dtor_or_conversion (d_right (dc));
case DEMANGLE_COMPONENT_CTOR:
case DEMANGLE_COMPONENT_DTOR:
case DEMANGLE_COMPONENT_CAST:
case DEMANGLE_COMPONENT_CONVERSION:
return 1;
}
}
@@ -1264,6 +1279,7 @@ d_encoding (struct d_info *di, int top_level)
while (dc->type == DEMANGLE_COMPONENT_RESTRICT_THIS
|| dc->type == DEMANGLE_COMPONENT_VOLATILE_THIS
|| dc->type == DEMANGLE_COMPONENT_CONST_THIS
|| dc->type == DEMANGLE_COMPONENT_TRANSACTION_SAFE
|| dc->type == DEMANGLE_COMPONENT_REFERENCE_THIS
|| dc->type == DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS)
dc = d_left (dc);
@@ -1280,6 +1296,7 @@ d_encoding (struct d_info *di, int top_level)
while (dcr->type == DEMANGLE_COMPONENT_RESTRICT_THIS
|| dcr->type == DEMANGLE_COMPONENT_VOLATILE_THIS
|| dcr->type == DEMANGLE_COMPONENT_CONST_THIS
|| dcr->type == DEMANGLE_COMPONENT_TRANSACTION_SAFE
|| dcr->type == DEMANGLE_COMPONENT_REFERENCE_THIS
|| dcr->type == DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS)
dcr = d_left (dcr);
@@ -1302,7 +1319,12 @@ d_encoding (struct d_info *di, int top_level)
static struct demangle_component *
d_abi_tags (struct d_info *di, struct demangle_component *dc)
{
struct demangle_component *hold_last_name;
char peek;
/* Preserve the last name, so the ABI tag doesn't clobber it. */
hold_last_name = di->last_name;
while (peek = d_peek_char (di),
peek == 'B')
{
@@ -1311,6 +1333,9 @@ d_abi_tags (struct d_info *di, struct demangle_component *dc)
tag = d_source_name (di);
dc = d_make_comp (di, DEMANGLE_COMPONENT_TAGGED_NAME, dc, tag);
}
di->last_name = hold_last_name;
return dc;
}
@@ -1656,7 +1681,7 @@ d_number_component (struct d_info *di)
/* identifier ::= <(unqualified source code identifier)> */
static struct demangle_component *
d_identifier (struct d_info *di, int len)
d_identifier (struct d_info *di, long len)
{
const char *name;
@@ -1677,7 +1702,7 @@ d_identifier (struct d_info *di, int len)
/* Look for something which looks like a gcc encoding of an
anonymous namespace, and replace it with a more user friendly
name. */
if (len >= (int) ANONYMOUS_NAMESPACE_PREFIX_LEN + 2
if (len >= (long) ANONYMOUS_NAMESPACE_PREFIX_LEN + 2
&& memcmp (name, ANONYMOUS_NAMESPACE_PREFIX,
ANONYMOUS_NAMESPACE_PREFIX_LEN) == 0)
{
@@ -1785,11 +1810,16 @@ d_operator_name (struct d_info *di)
{
struct demangle_component *type;
int was_conversion = di->is_conversion;
struct demangle_component *res;
di->is_conversion = ! di->is_expression;
type = cplus_demangle_type (di);
if (di->is_conversion)
res = d_make_comp (di, DEMANGLE_COMPONENT_CONVERSION, type, NULL);
else
res = d_make_comp (di, DEMANGLE_COMPONENT_CAST, type, NULL);
di->is_conversion = was_conversion;
return d_make_comp (di, DEMANGLE_COMPONENT_CAST, type, NULL);
return res;
}
else
{
@@ -2269,7 +2299,8 @@ cplus_demangle_type (struct d_info *di)
names. */
peek = d_peek_char (di);
if (peek == 'r' || peek == 'V' || peek == 'K')
if (peek == 'r' || peek == 'V' || peek == 'K'
|| (peek == 'D' && d_peek_next_char (di) == 'x'))
{
struct demangle_component **pret;
@@ -2580,7 +2611,7 @@ cplus_demangle_type (struct d_info *di)
return ret;
}
/* <CV-qualifiers> ::= [r] [V] [K] */
/* <CV-qualifiers> ::= [r] [V] [K] [Dx] */
static struct demangle_component **
d_cv_qualifiers (struct d_info *di,
@@ -2591,7 +2622,8 @@ d_cv_qualifiers (struct d_info *di,
pstart = pret;
peek = d_peek_char (di);
while (peek == 'r' || peek == 'V' || peek == 'K')
while (peek == 'r' || peek == 'V' || peek == 'K'
|| (peek == 'D' && d_peek_next_char (di) == 'x'))
{
enum demangle_component_type t;
@@ -2610,13 +2642,19 @@ d_cv_qualifiers (struct d_info *di,
: DEMANGLE_COMPONENT_VOLATILE);
di->expansion += sizeof "volatile";
}
else
else if (peek == 'K')
{
t = (member_fn
? DEMANGLE_COMPONENT_CONST_THIS
: DEMANGLE_COMPONENT_CONST);
di->expansion += sizeof "const";
}
else
{
t = DEMANGLE_COMPONENT_TRANSACTION_SAFE;
di->expansion += sizeof "transaction_safe";
d_advance (di, 1);
}
*pret = d_make_comp (di, t, NULL, NULL);
if (*pret == NULL)
@@ -2682,7 +2720,7 @@ d_ref_qualifier (struct d_info *di, struct demangle_component *sub)
return ret;
}
/* <function-type> ::= F [Y] <bare-function-type> [<ref-qualifier>] E */
/* <function-type> ::= F [Y] <bare-function-type> [<ref-qualifier>] [T] E */
static struct demangle_component *
d_function_type (struct d_info *di)
@@ -3166,6 +3204,8 @@ d_expression_1 (struct d_info *di)
struct demangle_component *type = NULL;
if (peek == 't')
type = cplus_demangle_type (di);
if (!d_peek_next_char (di))
return NULL;
d_advance (di, 2);
return d_make_comp (di, DEMANGLE_COMPONENT_INITIALIZER_LIST,
type, d_exprlist (di, 'E'));
@@ -3240,6 +3280,8 @@ d_expression_1 (struct d_info *di)
struct demangle_component *left;
struct demangle_component *right;
if (code == NULL)
return NULL;
if (op_is_new_cast (op))
left = cplus_demangle_type (di);
else
@@ -3267,7 +3309,9 @@ d_expression_1 (struct d_info *di)
struct demangle_component *second;
struct demangle_component *third;
if (!strcmp (code, "qu"))
if (code == NULL)
return NULL;
else if (!strcmp (code, "qu"))
{
/* ?: expression. */
first = d_expression_1 (di);
@@ -3881,6 +3925,7 @@ d_count_templates_scopes (int *num_templates, int *num_scopes,
case DEMANGLE_COMPONENT_CONST_THIS:
case DEMANGLE_COMPONENT_REFERENCE_THIS:
case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS:
case DEMANGLE_COMPONENT_TRANSACTION_SAFE:
case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
case DEMANGLE_COMPONENT_POINTER:
case DEMANGLE_COMPONENT_COMPLEX:
@@ -3894,6 +3939,7 @@ d_count_templates_scopes (int *num_templates, int *num_scopes,
case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST:
case DEMANGLE_COMPONENT_INITIALIZER_LIST:
case DEMANGLE_COMPONENT_CAST:
case DEMANGLE_COMPONENT_CONVERSION:
case DEMANGLE_COMPONENT_NULLARY:
case DEMANGLE_COMPONENT_UNARY:
case DEMANGLE_COMPONENT_BINARY:
@@ -4196,6 +4242,9 @@ d_find_pack (struct d_print_info *dpi,
case DEMANGLE_COMPONENT_CHARACTER:
case DEMANGLE_COMPONENT_FUNCTION_PARAM:
case DEMANGLE_COMPONENT_UNNAMED_TYPE:
case DEMANGLE_COMPONENT_FIXED_TYPE:
case DEMANGLE_COMPONENT_DEFAULT_ARG:
case DEMANGLE_COMPONENT_NUMBER:
return NULL;
case DEMANGLE_COMPONENT_EXTENDED_OPERATOR:
@@ -4399,6 +4448,7 @@ d_print_comp_inner (struct d_print_info *dpi, int options,
&& typed_name->type != DEMANGLE_COMPONENT_VOLATILE_THIS
&& typed_name->type != DEMANGLE_COMPONENT_CONST_THIS
&& typed_name->type != DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS
&& typed_name->type != DEMANGLE_COMPONENT_TRANSACTION_SAFE
&& typed_name->type != DEMANGLE_COMPONENT_REFERENCE_THIS)
break;
@@ -4431,10 +4481,16 @@ d_print_comp_inner (struct d_print_info *dpi, int options,
local_name = d_right (typed_name);
if (local_name->type == DEMANGLE_COMPONENT_DEFAULT_ARG)
local_name = local_name->u.s_unary_num.sub;
if (local_name == NULL)
{
d_print_error (dpi);
return;
}
while (local_name->type == DEMANGLE_COMPONENT_RESTRICT_THIS
|| local_name->type == DEMANGLE_COMPONENT_VOLATILE_THIS
|| local_name->type == DEMANGLE_COMPONENT_CONST_THIS
|| local_name->type == DEMANGLE_COMPONENT_REFERENCE_THIS
|| local_name->type == DEMANGLE_COMPONENT_TRANSACTION_SAFE
|| (local_name->type
== DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS))
{
@@ -4770,6 +4826,7 @@ d_print_comp_inner (struct d_print_info *dpi, int options,
case DEMANGLE_COMPONENT_POINTER:
case DEMANGLE_COMPONENT_COMPLEX:
case DEMANGLE_COMPONENT_IMAGINARY:
case DEMANGLE_COMPONENT_TRANSACTION_SAFE:
modifier:
{
/* We keep a list of modifiers on the stack. */
@@ -5019,9 +5076,9 @@ d_print_comp_inner (struct d_print_info *dpi, int options,
d_print_comp (dpi, options, dc->u.s_extended_operator.name);
return;
case DEMANGLE_COMPONENT_CAST:
case DEMANGLE_COMPONENT_CONVERSION:
d_append_string (dpi, "operator ");
d_print_cast (dpi, options, dc);
d_print_conversion (dpi, options, dc);
return;
case DEMANGLE_COMPONENT_NULLARY:
@@ -5458,6 +5515,7 @@ d_print_mod_list (struct d_print_info *dpi, int options,
|| mods->mod->type == DEMANGLE_COMPONENT_VOLATILE_THIS
|| mods->mod->type == DEMANGLE_COMPONENT_CONST_THIS
|| mods->mod->type == DEMANGLE_COMPONENT_REFERENCE_THIS
|| mods->mod->type == DEMANGLE_COMPONENT_TRANSACTION_SAFE
|| (mods->mod->type
== DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS))))
{
@@ -5516,6 +5574,7 @@ d_print_mod_list (struct d_print_info *dpi, int options,
|| dc->type == DEMANGLE_COMPONENT_VOLATILE_THIS
|| dc->type == DEMANGLE_COMPONENT_CONST_THIS
|| dc->type == DEMANGLE_COMPONENT_REFERENCE_THIS
|| dc->type == DEMANGLE_COMPONENT_TRANSACTION_SAFE
|| dc->type == DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS)
dc = d_left (dc);
@@ -5552,6 +5611,9 @@ d_print_mod (struct d_print_info *dpi, int options,
case DEMANGLE_COMPONENT_CONST_THIS:
d_append_string (dpi, " const");
return;
case DEMANGLE_COMPONENT_TRANSACTION_SAFE:
d_append_string (dpi, " transaction_safe");
return;
case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
d_append_char (dpi, ' ');
d_print_comp (dpi, options, d_right (mod));
@@ -5642,6 +5704,7 @@ d_print_function_type (struct d_print_info *dpi, int options,
case DEMANGLE_COMPONENT_CONST_THIS:
case DEMANGLE_COMPONENT_REFERENCE_THIS:
case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS:
case DEMANGLE_COMPONENT_TRANSACTION_SAFE:
break;
default:
break;
@@ -5754,11 +5817,20 @@ d_print_expr_op (struct d_print_info *dpi, int options,
static void
d_print_cast (struct d_print_info *dpi, int options,
const struct demangle_component *dc)
const struct demangle_component *dc)
{
d_print_comp (dpi, options, d_left (dc));
}
/* Print a conversion operator. */
static void
d_print_conversion (struct d_print_info *dpi, int options,
const struct demangle_component *dc)
{
struct d_print_template dpt;
/* For a cast operator, we need the template parameters from
/* For a conversion operator, we need the template parameters from
the enclosing template in scope for processing the type. */
if (dpi->current_template != NULL)
{
@@ -6174,6 +6246,7 @@ is_ctor_or_dtor (const char *mangled,
case DEMANGLE_COMPONENT_CONST_THIS:
case DEMANGLE_COMPONENT_REFERENCE_THIS:
case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS:
case DEMANGLE_COMPONENT_TRANSACTION_SAFE:
default:
dc = NULL;
break;

View File

@@ -135,12 +135,37 @@ struct d_info
- call d_check_char(di, '\0')
Everything else is safe. */
#define d_peek_char(di) (*((di)->n))
#define d_peek_next_char(di) ((di)->n[1])
#define d_advance(di, i) ((di)->n += (i))
#ifndef CHECK_DEMANGLER
# define d_peek_next_char(di) ((di)->n[1])
# define d_advance(di, i) ((di)->n += (i))
#endif
#define d_check_char(di, c) (d_peek_char(di) == c ? ((di)->n++, 1) : 0)
#define d_next_char(di) (d_peek_char(di) == '\0' ? '\0' : *((di)->n++))
#define d_str(di) ((di)->n)
#ifdef CHECK_DEMANGLER
static inline char
d_peek_next_char (const struct d_info *di)
{
if (!di->n[0])
abort ();
return di->n[1];
}
static inline void
d_advance (struct d_info *di, int i)
{
if (i < 0)
abort ();
while (i--)
{
if (!di->n[0])
abort ();
di->n++;
}
}
#endif
/* Functions and arrays in cp-demangle.c which are referenced by
functions in cp-demint.c. */
#ifdef IN_GLIBCPP_V3

View File

@@ -110,6 +110,7 @@ cplus_demangle_fill_component (struct demangle_component *p,
case DEMANGLE_COMPONENT_IMAGINARY:
case DEMANGLE_COMPONENT_VENDOR_TYPE:
case DEMANGLE_COMPONENT_CAST:
case DEMANGLE_COMPONENT_CONVERSION:
if (right != NULL)
return 0;
break;

View File

@@ -4091,6 +4091,36 @@ void g<1>(A<1>&, B<static_cast<bool>(1)>&)
_ZNKSt7complexIiE4realB5cxx11Ev
std::complex<int>::real[abi:cxx11]() const
#
# Some more crashes revealed by fuzz-testing:
# Check for NULL pointer when demangling trinary operators
--format=gnu-v3
_Z1fAv32_f
_Z1fAv32_f
# Do not overflow when decoding identifier length
--format=gnu-v3
_Z11111111111
_Z11111111111
# Check out-of-bounds access when decoding braced initializer list
--format=gnu-v3
_ZDTtl
_ZDTtl
# Check for NULL pointer when demangling DEMANGLE_COMPONENT_LOCAL_NAME
--format=gnu-v3
_ZZN1fEEd_lEv
_ZZN1fEEd_lEv
# Handle DEMANGLE_COMPONENT_FIXED_TYPE in d_find_pack
--format=gnu-v3
_Z1fDpDFT_
_Z1fDpDFT_
# Likewise, DEMANGLE_COMPONENT_DEFAULT_ARG
--format=gnu-v3
_Z1fIDpZ1fEd_E
_Z1fIDpZ1fEd_E
# Likewise, DEMANGLE_COMPONENT_NUMBER
--format=gnu-v3
_Z1fDpDv1_c
f((char __vector(1))...)
#
# Ada (GNAT) tests.
#
# Simple test.
@@ -4359,3 +4389,35 @@ f(std::string[abi:foo], std::string[abi:foo])
--format=gnu-v3
_Z18IndirectExternCallIPU7stdcallU7regparmILi3EEFviiEiEvT_T0_S3_
void IndirectExternCall<void ( regparm<3> stdcall*)(int, int), int>(void ( regparm<3> stdcall*)(int, int), int, void ( regparm<3> stdcall*)(int, int))
#
# ABI tags used to confuse the constructor name calculation.
--format=gnu-v3 --no-params
_ZNSt8ios_base7failureB5cxx11C1EPKcRKSt10error_code
std::ios_base::failure[abi:cxx11]::failure(char const*, std::error_code const&)
std::ios_base::failure[abi:cxx11]::failure
--format=gnu-v3
_Z1fPDxFvvES0_
f(void (*)() transaction_safe, void (*)() transaction_safe)
#
# These two are from gcc PR61321, and gcc PR61233 / gdb PR16957
#
--format=gnu-v3
_Z13function_tempIiEv1AIXszcvT_Li999EEE
void function_temp<int>(A<sizeof ((int)(999))>)
#
--format=gnu-v3
_Z7ZipWithI7QStringS0_5QListZN4oral6detail16AdaptCreateTableI7AccountEES0_RKNS3_16CachedFieldsDataEEUlRKS0_SA_E_ET1_IDTclfp1_cvT__EcvT0__EEEERKT1_ISC_ERKT1_ISD_ET2_
QList<decltype ({parm#3}((QString)(), (QString)()))> ZipWith<QString, QString, QList, QString oral::detail::AdaptCreateTable<Account>(oral::detail::CachedFieldsData const&)::{lambda(QString const&, QString const&)#1}>(QList<QString oral::detail::AdaptCreateTable<Account>(oral::detail::CachedFieldsData const&)::{lambda(QString const&, QString const&)#1}> const&, QList<QList> const&, QString oral::detail::AdaptCreateTable<Account>(oral::detail::CachedFieldsData const&)::{lambda(QString const&, QString const&)#1})
#
# These three are symbols generated by g++'s testsuite, which triggered the same bug as above.
--format=gnu-v3
_Z14int_if_addableI1YERiP1AIXszpldecvPT_Li0EdecvS4_Li0EEE
int& int_if_addable<Y>(A<sizeof ((*((Y*)(0)))+(*((Y*)(0))))>*)
#
--format=gnu-v3
_Z3bazIiEvP1AIXszcl3foocvT__ELCf00000000_00000000EEEE
void baz<int>(A<sizeof (foo((int)(), (floatcomplex )00000000_00000000))>*)
#
--format=gnu-v3
_Z3fooI1FEN1XIXszdtcl1PclcvT__EEE5arrayEE4TypeEv
X<sizeof ((P(((F)())())).array)>::Type foo<F>()