• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修訂f8773be1be076f828b93ac3bebeab3f782e191e4 (tree)
時間2015-06-25 17:54:12
作者Gary Benson <gbenson@redh...>
CommiterGary Benson

Log Message

Correctly notice empty sysroots in solib_find_1

Some parts of solib_find_1 should only operate if the sysroot
is nonempty after processing, but the logic that checked this
happened before trailing slashes were stripped so empty but
non-NULL sysroots were possible. This commit moves the logic
so it correctly notices all empty sysroots.

gdb/ChangeLog:

* solib.c (solib_find_1): Set local variable sysroot to NULL if
it is the empty string after trailing slashes have been stripped.

Change Summary

差異

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
11 2015-06-25 Gary Benson <gbenson@redhat.com>
22
3+ * solib.c (solib_find_1): Set local variable sysroot to NULL if
4+ it is the empty string after trailing slashes have been stripped.
5+
6+2015-06-25 Gary Benson <gbenson@redhat.com>
7+
38 * exec.c (exec_file_locate_attach): Remove gdb_sysroot NULL check.
49 * infrun.c (follow_exec): Likewise.
510 * remote.c (remote_filesystem_is_local): Likewise.
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -158,6 +158,7 @@ solib_find_1 (char *in_pathname, int *fd, int is_solib)
158158 const char *fskind = effective_target_file_system_kind ();
159159 struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
160160 char *sysroot = gdb_sysroot;
161+ int prefix_len, orig_prefix_len;
161162
162163 /* If the absolute prefix starts with "target:" but the filesystem
163164 accessed by the target_fileio_* methods is the local filesystem
@@ -168,17 +169,16 @@ solib_find_1 (char *in_pathname, int *fd, int is_solib)
168169 if (is_target_filename (sysroot) && target_filesystem_is_local ())
169170 sysroot += strlen (TARGET_SYSROOT_PREFIX);
170171
171- if (*sysroot == '\0')
172- sysroot = NULL;
173- else
174- {
175- int prefix_len = strlen (sysroot);
172+ /* Strip any trailing slashes from the absolute prefix. */
173+ prefix_len = orig_prefix_len = strlen (sysroot);
176174
177- /* Remove trailing slashes from absolute prefix. */
178- while (prefix_len > 0
179- && IS_DIR_SEPARATOR (sysroot[prefix_len - 1]))
180- prefix_len--;
175+ while (prefix_len > 0 && IS_DIR_SEPARATOR (sysroot[prefix_len - 1]))
176+ prefix_len--;
181177
178+ if (prefix_len == 0)
179+ sysroot = NULL;
180+ else if (prefix_len != orig_prefix_len)
181+ {
182182 sysroot = savestring (sysroot, prefix_len);
183183 make_cleanup (xfree, sysroot);
184184 }