From: Gary Benson <gbenson@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PING][PATCH] Use exec_file_find to prepend gdb_sysroot in follow_exec
Date: Mon, 27 Apr 2015 10:38:00 -0000 [thread overview]
Message-ID: <20150427103809.GA13233@blade.nx> (raw)
In-Reply-To: <1429277318-26646-1-git-send-email-gbenson@redhat.com>
Ping:
https://sourceware.org/ml/gdb-patches/2015-04/msg00674.html
Gary Benson wrote:
> Hi all,
>
> This commit updates follow_exec to use exec_file_find to prefix
> the new executable's filename with gdb_sysroot rather than doing
> it longhand.
>
> Built and regtested on RHEL6.6 x86_64.
>
> Ok to commit?
>
> Cheers,
> Gary
>
>
> gdb/ChangeLog:
>
> * infrun.c (solist.h): New include.
> (follow_exec): Use exec_file_find to prefix execd_pathname
> with gdb_sysroot.
> ---
> gdb/ChangeLog | 6 ++++++
> gdb/infrun.c | 18 +++++++++++-------
> 2 files changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/gdb/infrun.c b/gdb/infrun.c
> index 7870f70..f09e2da 100644
> --- a/gdb/infrun.c
> +++ b/gdb/infrun.c
> @@ -60,6 +60,7 @@
> #include "target-descriptions.h"
> #include "target-dcache.h"
> #include "terminal.h"
> +#include "solist.h"
>
> /* Prototypes for local functions */
>
> @@ -1133,15 +1134,18 @@ follow_exec (ptid_t ptid, char *execd_pathname)
>
> breakpoint_init_inferior (inf_execd);
>
> - if (gdb_sysroot && *gdb_sysroot)
> + if (gdb_sysroot != NULL && *gdb_sysroot != '\0')
> {
> - char *name = alloca (strlen (gdb_sysroot)
> - + strlen (execd_pathname)
> - + 1);
> + int fd = -1;
> + char *name;
>
> - strcpy (name, gdb_sysroot);
> - strcat (name, execd_pathname);
> - execd_pathname = name;
> + name = exec_file_find (execd_pathname, &fd);
> + if (fd >= 0)
> + close (fd);
> +
> + execd_pathname = alloca (strlen (name) + 1);
> + strcpy (execd_pathname, name);
> + xfree (name);
> }
>
> /* Reset the shared library package. This ensures that we get a
> --
> 1.7.1
>
--
http://gbenson.net/
next prev parent reply other threads:[~2015-04-27 10:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-17 13:28 [PATCH] " Gary Benson
2015-04-27 10:38 ` Gary Benson [this message]
2015-04-27 15:59 ` Pedro Alves
2015-04-28 11:35 ` Gary Benson
2015-04-28 11:56 ` Pedro Alves
2015-04-28 21:50 ` [PATCH] Allow passing fd == NULL to exec_file_find and solib_find Gary Benson
2015-04-29 11:22 ` Pedro Alves
2015-04-29 15:24 ` Gary Benson
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=20150427103809.GA13233@blade.nx \
--to=gbenson@redhat.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