public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: Andreas Arnez <arnez@linux.vnet.ibm.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH 2/3] Testsuite: Rename "end()" to avoid libinproctrace C++ symbol clash
Date: Fri, 16 Mar 2018 21:57:00 -0000	[thread overview]
Message-ID: <a31c0b89-dbcf-fb40-d8ec-aee748e61e3c@ericsson.com> (raw)
In-Reply-To: <m3lgerx0oz.fsf@oc1027705133.ibm.com>

On 2018-03-16 03:47 PM, Andreas Arnez wrote:
> On Thu, Mar 15 2018, Simon Marchi wrote:
> 
>> On 2018-03-14 12:11 PM, Andreas Arnez wrote:
>>> Some of GDB's trace test cases define a function end() and place a
>>> breakpoint there with "break end".  However, when libinproctrace is linked
>>> to the binary, there are multiple methods named "end", such as
>>> std::string::end() from the C++ library or format_pieces::end() from
>>> common/format.h.  GDB then creates multiple breakpoints instead of just a
>>> single one, and some FAILs result, such as these:
>>>
>>>   FAIL: gdb.trace/trace-mt.exp: ftrace on: break end
>>>   FAIL: gdb.trace/trace-mt.exp: ftrace off: break end
>>>
>>> This is fixed by renaming end() to my_end().  For consistency, where end()
>>> was paired with a previous begin(), the latter is renamed to my_begin() as
>>> well.
>>>
>>> gdb/testsuite/ChangeLog:
>>>
>>> 	* gdb.trace/trace-break.c (end): Rename to...
>>> 	(my_end): ...this.
>>> 	(main): Adjust call.
>>> 	* gdb.trace/trace-mt.c (end): Rename to...
>>> 	(my_end): ...this.
>>> 	(main): Adjust call.
>>> 	* gdb.trace/unavailable.cc (begin): Rename to...
>>> 	(my_begin): ...this.
>>> 	(end): Rename to...
>>> 	(my_end): ...this.
>>> 	(main): Adjust calls.
>>> 	* gdb.trace/trace-break.exp: Reflect function name change.
>>> 	* gdb.trace/trace-mt.exp: Likewise.
>>> 	* gdb.trace/unavailable.exp: Likewise.
>>
>> Hi Andreas,
>>
>> Another way would have been to pass "-qualified" to the break command,
>> or use gdb_breakpoint and pass the "qualified" arg.  There are also
>> other instances of the same "problem" in tests that don't check the
>> output of the break command at all...
>>
>>   gdb_test "break end" ".*" ""
>>
>> In any case, this patch LGTM.
> 
> Hm, actually the use of "-qualified" is a good point.  I'd rather go
> with that.  How about the patch below?
> 
> --
> Andreas
> 
> -- >8 --
> Subject: [PATCH] Testsuite: Fix ambiguous "break" due to libinproctrace
> 
> Some of GDB's trace test cases define a function end() and place a
> breakpoint there with "break end".  However, when libinproctrace is linked
> to the binary, there are multiple methods named "end", such as
> std::string::end() from the C++ library or format_pieces::end() from
> common/format.h.  GDB then creates multiple breakpoints instead of just a
> single one, and some FAILs result, such as these:
> 
>   FAIL: gdb.trace/trace-mt.exp: ftrace on: break end
>   FAIL: gdb.trace/trace-mt.exp: ftrace off: break end
> 
> Fix this by adding the "-qualified" option to the break commands.  For
> consistency, change all occurrences of "break end" (and similar) in all
> trace test cases, even if the current behavior does not cause problems.
> Also, consequently use the gdb_breakpoint convenience proc.
> 
> gdb/testsuite/ChangeLog:
> 
> 	* gdb.trace/actions-changed.exp: Call gdb_breakpoint with the
> 	"qualified" option when setting breakpoints.
> 	* gdb.trace/backtrace.exp: Likewise.
> 	* gdb.trace/circ.exp: Likewise.
> 	* gdb.trace/collection.exp: Likewise.
> 	* gdb.trace/disconnected-tracing.exp: Likewise.
> 	* gdb.trace/ftrace-lock.exp: Likewise.
> 	* gdb.trace/ftrace.exp: Likewise.
> 	* gdb.trace/infotrace.exp: Likewise.
> 	* gdb.trace/packetlen.exp: Likewise.
> 	* gdb.trace/passc-dyn.exp: Likewise.
> 	* gdb.trace/qtro.exp: Likewise.
> 	* gdb.trace/read-memory.exp: Likewise.
> 	* gdb.trace/report.exp: Likewise.
> 	* gdb.trace/signal.exp: Likewise.
> 	* gdb.trace/status-stop.exp: Likewise.
> 	* gdb.trace/strace.exp: Likewise.
> 	* gdb.trace/tfind.exp: Likewise.
> 	* gdb.trace/trace-break.exp: Likewise.
> 	* gdb.trace/trace-condition.exp: Likewise.
> 	* gdb.trace/trace-mt.exp: Likewise.
> 	* gdb.trace/tstatus.exp: Likewise.
> 	* gdb.trace/tsv.exp: Likewise.
> 	* gdb.trace/unavailable-dwarf-piece.exp: Likewise.
> 	* gdb.trace/unavailable.exp: Likewise.
> 	* gdb.trace/while-dyn.exp: Likewise.

Hi Andreas,

Since the gdb_breakpoint proc accepts the multi-location printout, we may
not even need the "qualified", just using gdb_breakpoint would be sufficient.
But I think it's not bad either to use "qualified", as it makes the test more
robust.  It makes sure the test doesn't stop on another random end function/method.

So this LGTM, thanks.

Simon

  reply	other threads:[~2018-03-16 21:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-14 16:12 [PATCH 0/3] Some gdbserver test suite fixes Andreas Arnez
2018-03-14 16:13 ` [PATCH 2/3] Testsuite: Rename "end()" to avoid libinproctrace C++ symbol clash Andreas Arnez
2018-03-15 21:58   ` Simon Marchi
2018-03-16 19:47     ` Andreas Arnez
2018-03-16 21:57       ` Simon Marchi [this message]
2018-03-19 12:15         ` Andreas Arnez
2018-03-26 14:44       ` Pedro Alves
2018-03-14 16:13 ` [PATCH 1/3] Fix tspeed test case: copy libinproctrace to target Andreas Arnez
2018-03-15 21:40   ` Simon Marchi
2018-03-16 19:41     ` Andreas Arnez
2018-03-14 16:13 ` [PATCH 3/3] Fix a FAIL in attach.exp under native-extended-gdbserver Andreas Arnez
2018-03-15 22:17   ` Simon Marchi
2018-04-25  9:32     ` Andreas Arnez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a31c0b89-dbcf-fb40-d8ec-aee748e61e3c@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=arnez@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).