Message ID | 1459912543-15328-4-git-send-email-simon.marchi@polymtl.ca |
---|---|
State | Changes Requested, archived |
Headers |
Received: (qmail 47046 invoked by alias); 6 Apr 2016 03:15:50 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 46890 invoked by uid 89); 6 Apr 2016 03:15:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=BAYES_00, SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=Hx-spam-relays-external:sk:cable-1, H*r:sk:cable-1, H*RU:sk:cable-1 X-HELO: smtp.electronicbox.net Received: from smtp.electronicbox.net (HELO smtp.electronicbox.net) (96.127.255.82) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 06 Apr 2016 03:15:48 +0000 Received: from localhost.localdomain (cable-192.222.137.139.electronicbox.net [192.222.137.139]) by smtp.electronicbox.net (Postfix) with ESMTP id 1EAF3440E81; Tue, 5 Apr 2016 23:15:46 -0400 (EDT) From: Simon Marchi <simon.marchi@polymtl.ca> To: gdb-patches@sourceware.org Cc: Simon Marchi <simon.marchi@polymtl.ca> Subject: [PATCH 4/4] Fix solib-display.exp remote check Date: Tue, 5 Apr 2016 23:15:43 -0400 Message-Id: <1459912543-15328-4-git-send-email-simon.marchi@polymtl.ca> In-Reply-To: <1459912543-15328-1-git-send-email-simon.marchi@polymtl.ca> References: <1459912543-15328-1-git-send-email-simon.marchi@polymtl.ca> |
Commit Message
Simon Marchi
April 6, 2016, 3:15 a.m. UTC
This test currently uses [is_remote target] to check if the test is supported. This is not quite correct, as you could run the test with an extended-remote gdbserver configuration and a remote target [1]. The test uses "run", which makes it inappropriate for stub-like targets, so that's what it should check instead. [1] I managed to do it, but the current testsuite code does not make it easy to make such a board file... gdb/testsuite/ChangeLog: * gdb.base/solib-display.exp: Don't check for [is_remote target], check for $use_gdb_stub instead. --- gdb/testsuite/gdb.base/solib-display.exp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
Comments
On 04/06/2016 04:15 AM, Simon Marchi wrote:
> The test uses "run"
Does it have to? Can't we use "kill" followed by runto_main
again, instead of gdb_start_cmd ?
Why did you move the check to within the loop? I thought one
could check [target_info exists use_gdb_stub] at the top?
I'd find the patch OK with that. It'd be nicer to avoid
gdb_start_cmd in the first place, but use_gdb_stub is still
an improvement.
Thanks,
Pedro Alves
On 2016-04-11 14:27, Pedro Alves wrote: > On 04/06/2016 04:15 AM, Simon Marchi wrote: > >> The test uses "run" > > Does it have to? Can't we use "kill" followed by runto_main > again, instead of gdb_start_cmd ? I'll check. > Why did you move the check to within the loop? I thought one > could check [target_info exists use_gdb_stub] at the top? > I'd find the patch OK with that. It'd be nicer to avoid > gdb_start_cmd in the first place, but use_gdb_stub is still > an improvement. You're right, I didn't think to check [target_info exists use_gdb_stub] directly. The global variable use_gdb_stub is only available after having spawned gdb, which is why I moved it.
On 04/11/2016 08:26 PM, Simon Marchi wrote: > On 2016-04-11 14:27, Pedro Alves wrote: >> On 04/06/2016 04:15 AM, Simon Marchi wrote: > ... >> Why did you move the check to within the loop? I thought one >> could check [target_info exists use_gdb_stub] at the top? >> I'd find the patch OK with that. It'd be nicer to avoid >> gdb_start_cmd in the first place, but use_gdb_stub is still >> an improvement. > > You're right, I didn't think to check [target_info exists use_gdb_stub] > directly. The global variable use_gdb_stub is only available after > having spawned gdb, which is why I moved it. Maybe it's be simpler for users to wrap this in a proc, like: proc use_gdb_stub {} { global use_gdb_stub if [target_info exists use_gdb_stub] { return $use_gdb_stub } return 0 } Then consistently use the proc. Thanks, Pedro Alves
On 04/11/2016 10:32 PM, Pedro Alves wrote: > On 04/11/2016 08:26 PM, Simon Marchi wrote: >> On 2016-04-11 14:27, Pedro Alves wrote: >>> On 04/06/2016 04:15 AM, Simon Marchi wrote: >> > > ... > >>> Why did you move the check to within the loop? I thought one >>> could check [target_info exists use_gdb_stub] at the top? >>> I'd find the patch OK with that. It'd be nicer to avoid >>> gdb_start_cmd in the first place, but use_gdb_stub is still >>> an improvement. >> >> You're right, I didn't think to check [target_info exists use_gdb_stub] >> directly. The global variable use_gdb_stub is only available after >> having spawned gdb, which is why I moved it. > > Maybe it's be simpler for users to wrap this in a proc, like: > > proc use_gdb_stub {} { > global use_gdb_stub > > if [target_info exists use_gdb_stub] { > return $use_gdb_stub > } > return 0 > } > > Then consistently use the proc. Or rather: proc use_gdb_stub {} { global use_gdb_stub if [info exists use_gdb_stub] { return $use_gdb_stub } return [target_info exists use_gdb_stub] } Thanks, Pedro Alves
On 2016-04-11 14:27, Pedro Alves wrote: > On 04/06/2016 04:15 AM, Simon Marchi wrote: > >> The test uses "run" > > Does it have to? Can't we use "kill" followed by runto_main > again, instead of gdb_start_cmd ? I tried to change the test so that it uses kill, followed with gdb_run_cmd combined with a breakpoint at main (runto_main wouldn't work, since it doesn't expect the variable display before the prompt). The problem with native-gdbserver (and probabley any stub target) is that when you run again, it launches a new gdbserver and connects to it. Right after connecting, gdb tries to display the variables, but since we're stopped before the libs are loaded, we get: warning: Unable to display "a_global": No symbol "a_global" in current context. warning: Unable to display "b_global": No symbol "b_global" in current context. warning: Unable to display "c_global": No symbol "c_global" in current context. and gdb trashes the displays. The rest of the test fails because it expects the displays to be there (I think that's the point of that test). So for now at least, I'd keep the test like this, disabled for stub targets. > Why did you move the check to within the loop? I thought one > could check [target_info exists use_gdb_stub] at the top? > I'd find the patch OK with that. It'd be nicer to avoid > gdb_start_cmd in the first place, but use_gdb_stub is still > an improvement. I have sent a mini-series as an update, including your use_gdb_stub procedure suggestion. https://sourceware.org/ml/gdb-patches/2016-05/msg00018.html Thanks, Simon
On 05/02/2016 07:19 PM, Simon Marchi wrote: > On 2016-04-11 14:27, Pedro Alves wrote: >> On 04/06/2016 04:15 AM, Simon Marchi wrote: >> >>> The test uses "run" >> >> Does it have to? Can't we use "kill" followed by runto_main >> again, instead of gdb_start_cmd ? > > I tried to change the test so that it uses kill, followed with > gdb_run_cmd combined with a breakpoint at main (runto_main wouldn't > work, since it doesn't expect the variable display before the prompt). > > The problem with native-gdbserver (and probabley any stub target) is > that when you run again, it launches a new gdbserver and connects to it. > Right after connecting, gdb tries to display the variables, but since > we're stopped before the libs are loaded, we get: > > warning: Unable to display "a_global": No symbol "a_global" in current > context. > warning: Unable to display "b_global": No symbol "b_global" in current > context. > warning: Unable to display "c_global": No symbol "c_global" in current > context. > > and gdb trashes the displays. The rest of the test fails because it > expects the displays to be there (I think that's the point of that > test). So for now at least, I'd keep the test like this, disabled for > stub targets. Thanks for the investigation. I think it'd be nice to add this info as a comment in the test file. Thanks, Pedro Alves
On 2016-05-02 14:28, Pedro Alves wrote: > Thanks for the investigation. I think it'd be nice to > add this info as a comment in the test file. > > Thanks, > Pedro Alves What about: # This test is currently not supported for stub targets, because it uses the # start command (through gdb_start_cmd). In theory, it could be changed to # use something else (kill + gdb_run_cmd with a manual breakpoint at main). # However, when we try that with the native-gdbserver board, we see that the # test fails and gdb outputs this upon connection: # # warning: Unable to display "a_global": No symbol "a_global" in current context. # warning: Unable to display "b_global": No symbol "b_global" in current context. # warning: Unable to display "c_global": No symbol "c_global" in current context. # # This is because the initial stop is done before the shared libraries are # loaded. If there were some stub targets for which this use case would be # supported, then the test could probably be modified to avoid using start.
On 05/02/2016 08:52 PM, Simon Marchi wrote: > On 2016-05-02 14:28, Pedro Alves wrote: >> Thanks for the investigation. I think it'd be nice to >> add this info as a comment in the test file. >> >> Thanks, >> Pedro Alves > > What about: > > # This test is currently not supported for stub targets, because it uses > the > # start command (through gdb_start_cmd). In theory, it could be changed to > # use something else (kill + gdb_run_cmd with a manual breakpoint at main). > # However, when we try that with the native-gdbserver board, we see that > the > # test fails and gdb outputs this upon connection: > # > # warning: Unable to display "a_global": No symbol "a_global" in > current context. > # warning: Unable to display "b_global": No symbol "b_global" in > current context. > # warning: Unable to display "c_global": No symbol "c_global" in > current context. > # > # This is because the initial stop is done before the shared libraries are > # loaded. If there were some stub targets for which this use case would be > # supported, then the test could probably be modified to avoid using start. LGTM, though I'd drop the last sentence. One could argue that this _should_ work, and that gdb could re-enable the displays when the shared libraries are loaded, akin to shared library breakpoints. Thanks, Pedro Alves
diff --git a/gdb/testsuite/gdb.base/solib-display.exp b/gdb/testsuite/gdb.base/solib-display.exp index 7f65617..42ad08c 100644 --- a/gdb/testsuite/gdb.base/solib-display.exp +++ b/gdb/testsuite/gdb.base/solib-display.exp @@ -28,7 +28,7 @@ # (and thus aren't affected by shared library unloading) are not # disabled prematurely. -if { [skip_shlib_tests] || [is_remote target] } { +if { [skip_shlib_tests] } { return 0 } @@ -72,6 +72,11 @@ foreach libsepdebug {NO IN SEP} { with_test_prefix "$libsepdebug" { clean_restart $executable + # This test uses run, so it's pointless to test on stub targets. + if $use_gdb_stub { + return 0 + } + if ![runto_main] then { fail "Can't run to main" return 0