Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>,
	GDB Patches <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@ericsson.com>
Subject: Re: [PATCH v2 2/2] Make gdbserver work with filename-only binaries
Date: Wed, 21 Feb 2018 12:29:00 -0000	[thread overview]
Message-ID: <87f198c5-3963-1c54-ff16-e3dcc8c9e632@redhat.com> (raw)
In-Reply-To: <20180212195733.23639-3-sergiodj@redhat.com>

Hi Sergio,

A few quick comments below.  

> @@ -3539,6 +3564,13 @@ captured_main (int argc, char *argv[])
>    const char *selftest_filter = NULL;
>  #endif
>  
> +  current_directory = getcwd (NULL, 0);
> +  if (current_directory == NULL)
> +    {
> +      warning (_("%s: error finding working directory"),
> +	       safe_strerror (errno));

I think it's much more usual to put the strerror string at the
end of the warning rather than at the beginning.

I.e., something like:

   warning (_("Could not find working directory: %s"),
       safe_strerror (errno));

See

  $ (cd gdb; git grep -3 "warning (" *.c | grep strerr -C 3)

for example.

From the ongoing discussion, it sounded like this hunk may change
in the next iteration, but I thought I'd still comment as it
may help with future patches.


> +    }


> +# We only test things locally, and on native-gdbserver
> +if { [is_remote target] || [is_remote host] || ![use_gdb_stub] } {
> +    return 0
> +}


I don't see why to restrict this to "only on native-gdbserver".  The test
is calling gdbserver_start etc. manually, so it should work when testing
with any local board, I think?  I.e., when testing with native or
extended-remote too.  For the latter, tests will usually call "disconnect".

> +
> +if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } {
> +    return -1
> +}
> +
> +set target_exec [gdbserver_download_current_prog]
> +set target_execname [file tail $target_exec]
> +# We temporarily copy the file to our current directory
> +file copy -force $target_exec [pwd]
> +set res [gdbserver_start "" $target_execname]

Please remind me -- is the current directory here usually
the testcase's output dir?  I.e., is it guaranteed that
the current directory here is not going to be the same
directory of another testcase running in parallel at
the same time?

> +
> +set gdbserver_protocol [lindex $res 0]
> +set gdbserver_gdbport [lindex $res 1]
> +gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport
> +
> +if { [runto_main] } {
> +    pass "load filename without absolute path"
> +} else {
> +    fail "load filename without absolute path"
> +}

runto_main here looks a bit odd to me.  You're manually connecting
with gdb_target_cmd, bypassing whatever the current board file
may want to do, but then you're using a routine that call back
into the board file to do random things to prepare for running.

I think you should set a breakpoint at main and continue to
it without using runto_main.  Note how no other test in gdb.server/
uses runto_main.

Thanks,
Pedro Alves


  parent reply	other threads:[~2018-02-21 12:29 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-10  1:42 [PATCH 0/2] " Sergio Durigan Junior
2018-02-10  1:42 ` [PATCH 2/2] " Sergio Durigan Junior
2018-02-12  4:18   ` Simon Marchi
2018-02-12 19:16     ` Sergio Durigan Junior
2018-02-21  8:05       ` Joel Brobecker
2018-02-12 19:57   ` [PATCH 0/2] " Sergio Durigan Junior
2018-02-12 19:57     ` [PATCH v2 2/2] " Sergio Durigan Junior
2018-02-13  4:35       ` Simon Marchi
2018-02-22 18:37         ` Sergio Durigan Junior
2018-02-21 12:29       ` Pedro Alves [this message]
2018-02-27  0:20         ` Sergio Durigan Junior
2018-02-28  3:32           ` Sergio Durigan Junior
2018-02-12 19:57     ` [PATCH v2 1/2] Create new common/pathstuff.[ch] Sergio Durigan Junior
2018-02-28  3:27   ` [PATCH v3 0/2] Make gdbserver work with filename-only binaries Sergio Durigan Junior
2018-02-28  3:27     ` [PATCH v3 1/2] Create new common/pathstuff.[ch] Sergio Durigan Junior
2018-02-28  5:02       ` Simon Marchi
2018-02-28 16:46         ` Sergio Durigan Junior
2018-02-28 16:39       ` Sergio Durigan Junior
2018-02-28  3:27     ` [PATCH v3 2/2] Make gdbserver work with filename-only binaries Sergio Durigan Junior
2018-02-28  3:58       ` Sergio Durigan Junior
2018-02-28  5:33         ` Simon Marchi
2018-02-28  7:09           ` Metzger, Markus T
2018-02-28 16:30             ` Sergio Durigan Junior
2018-02-28  5:46       ` Simon Marchi
2018-02-28 16:29         ` Sergio Durigan Junior
2018-02-28 16:40           ` Sergio Durigan Junior
2018-03-01  2:23     ` [PATCH v3 0/2] " Sergio Durigan Junior
2018-03-01  2:55       ` Joel Brobecker
2018-03-01 13:08         ` Christophe Lyon
2018-03-01 13:18           ` Simon Marchi
2018-03-01 19:50           ` Sergio Durigan Junior
2018-03-01 20:20           ` [PATCH] Conditionally include "<windows.h>" on common/pathstuff.c (and unbreak build on mingw*) Sergio Durigan Junior
2018-03-01 20:47             ` Simon Marchi
2018-03-02 11:46               ` Christophe Lyon
2018-03-02 12:35                 ` Sergio Durigan Junior
2018-03-02 11:11             ` Yao Qi
2018-03-02 12:29               ` Sergio Durigan Junior
2018-03-02 12:37                 ` Sergio Durigan Junior
2018-03-05 12:07                   ` Yao Qi
2018-03-02 13:32             ` Eli Zaretskii
2018-03-02 15:15               ` Simon Marchi
2018-03-02 18:20                 ` Sergio Durigan Junior
2018-03-03  7:36                   ` Eli Zaretskii
2018-03-01 17:37         ` [PATCH v3 0/2] Make gdbserver work with filename-only binaries Sergio Durigan Junior
2018-03-02  3:20           ` Joel Brobecker
2018-02-28 16:47   ` [obvious/pushed] Change order of error message printed when gdbserver can't find CWD Sergio Durigan Junior
2018-02-10  1:42 ` [PATCH 1/2] Create new common/pathstuff.[ch] Sergio Durigan Junior
2018-02-11 22:14   ` Simon Marchi
2018-02-12 19:01     ` Sergio Durigan Junior
2018-02-21  7:56   ` Joel Brobecker
2018-02-22 18:43     ` Sergio Durigan Junior

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=87f198c5-3963-1c54-ff16-e3dcc8c9e632@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sergiodj@redhat.com \
    --cc=simon.marchi@ericsson.com \
    /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