Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Gary Benson <gbenson@redhat.com>
To: gdb-patches@sourceware.org
Cc: Mike Frysinger <vapier@gentoo.org>
Subject: [OB PATCH] Remove gdb_sysroot NULL checks
Date: Thu, 25 Jun 2015 08:35:00 -0000	[thread overview]
Message-ID: <1435221326-28053-1-git-send-email-gbenson@redhat.com> (raw)
In-Reply-To: <20150624103025.GA11787@blade.nx>

Hi all,

Since fed040c6a50399617d8265cbddc7fd21b3f134ef gdb_sysroot is
never NULL.  This commit removes all gdb_sysroot NULL checks.

Pushed as obvious.

Cheers,
Gary

--
gdb/ChangeLog:

	* exec.c (exec_file_locate_attach): Remove gdb_sysroot NULL check.
	* infrun.c (follow_exec): Likewise.
	* remote.c (remote_filesystem_is_local): Likewise.
	* solib.c (solib_find_1): Likewise.
---
 gdb/ChangeLog |    7 +++++++
 gdb/exec.c    |    3 +--
 gdb/infrun.c  |    2 +-
 gdb/remote.c  |    3 +--
 gdb/solib.c   |   29 ++++++++++++-----------------
 5 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/gdb/exec.c b/gdb/exec.c
index 8a4ab6f..3dfc437 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -154,8 +154,7 @@ exec_file_locate_attach (int pid, int from_tty)
 
   /* If gdb_sysroot is not empty and the discovered filename
      is absolute then prefix the filename with gdb_sysroot.  */
-  if (gdb_sysroot != NULL && *gdb_sysroot != '\0'
-      && IS_ABSOLUTE_PATH (exec_file))
+  if (*gdb_sysroot != '\0' && IS_ABSOLUTE_PATH (exec_file))
     full_exec_path = exec_file_find (exec_file, NULL);
 
   if (full_exec_path == NULL)
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 233d0f8..792f847 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1133,7 +1133,7 @@ follow_exec (ptid_t ptid, char *execd_pathname)
 
   breakpoint_init_inferior (inf_execd);
 
-  if (gdb_sysroot != NULL && *gdb_sysroot != '\0')
+  if (*gdb_sysroot != '\0')
     {
       char *name = exec_file_find (execd_pathname, NULL);
 
diff --git a/gdb/remote.c b/gdb/remote.c
index f15d75e..68dd99d 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -10538,8 +10538,7 @@ remote_filesystem_is_local (struct target_ops *self)
      this case we treat the remote filesystem as local if the
      sysroot is exactly TARGET_SYSROOT_PREFIX and if the stub
      does not support vFile:open.  */
-  if (gdb_sysroot != NULL
-      && strcmp (gdb_sysroot, TARGET_SYSROOT_PREFIX) == 0)
+  if (strcmp (gdb_sysroot, TARGET_SYSROOT_PREFIX) == 0)
     {
       enum packet_support ps = packet_support (PACKET_vFile_open);
 
diff --git a/gdb/solib.c b/gdb/solib.c
index 0010c2f..ed1bc25 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -159,23 +159,18 @@ solib_find_1 (char *in_pathname, int *fd, int is_solib)
   struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
   char *sysroot = gdb_sysroot;
 
-  if (sysroot != NULL)
-    {
-      /* If the absolute prefix starts with "target:" but the
-	 filesystem accessed by the target_fileio_* methods
-	 is the local filesystem then we strip the "target:"
-	 prefix now and work with the local filesystem.  This
-	 ensures that the same search algorithm is used for
-	 all local files regardless of whether a "target:"
-	 prefix was used.  */
-      if (is_target_filename (sysroot) && target_filesystem_is_local ())
-	sysroot += strlen (TARGET_SYSROOT_PREFIX);
-
-      if (*sysroot == '\0')
-	sysroot = NULL;
-    }
-
-  if (sysroot != NULL)
+  /* If the absolute prefix starts with "target:" but the filesystem
+     accessed by the target_fileio_* methods is the local filesystem
+     then we strip the "target:" prefix now and work with the local
+     filesystem.  This ensures that the same search algorithm is used
+     for all local files regardless of whether a "target:" prefix was
+     used.  */
+  if (is_target_filename (sysroot) && target_filesystem_is_local ())
+    sysroot += strlen (TARGET_SYSROOT_PREFIX);
+
+  if (*sysroot == '\0')
+    sysroot = NULL;
+  else
     {
       int prefix_len = strlen (sysroot);
 
-- 
1.7.1


  reply	other threads:[~2015-06-25  8:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-21 18:08 [PATCH] gdb: sim: handle target sysroot prefix Mike Frysinger
2015-06-22  9:50 ` Gary Benson
2015-06-23 15:28   ` Mike Frysinger
2015-06-24 10:30     ` Gary Benson
2015-06-25  8:35       ` Gary Benson [this message]
2015-06-23 15:29 ` [PATCH] gdb: microblaze: delete useless stubs Mike Frysinger
2015-06-23 15:31   ` Mike Frysinger
2015-06-23 17:39   ` Michael Eager
2015-06-23 15:29 ` [PATCH v2] gdb: sim: handle target sysroot prefix Mike Frysinger
2015-06-24 10:31   ` Gary Benson
2015-06-24 13:47   ` Pedro Alves
2015-06-24 14:32     ` Mike Frysinger

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=1435221326-28053-1-git-send-email-gbenson@redhat.com \
    --to=gbenson@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=vapier@gentoo.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