aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorManish Goregaokar <manish@mozilla.com>2016-06-29 15:42:28 +0530
committerManish Goregaokar <manish@mozilla.com>2016-06-29 16:19:04 +0530
commita405c2281ad29b5c7f9f2a4d58b7cfef2b74ba99 (patch)
tree67b9a0b51881ca0fdd9cecad25223f65900fb645 /gdb
parentd691934d08a4132506a19ac8d7565f1a0461a80a (diff)
downloadfsf-binutils-gdb-a405c2281ad29b5c7f9f2a4d58b7cfef2b74ba99.zip
fsf-binutils-gdb-a405c2281ad29b5c7f9f2a4d58b7cfef2b74ba99.tar.gz
fsf-binutils-gdb-a405c2281ad29b5c7f9f2a4d58b7cfef2b74ba99.tar.bz2
Use strtok_r instead of strsep in rust_get_disr_info
strsep doesn't exist on Windows. 2016-06-29 Manish Goregaokar <manish@mozilla.com> gdb/ChangeLog: * rust-lang.c (rust_get_disr_info): Use strtok_r instead of strsep.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/rust-lang.c8
2 files changed, 10 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c99ed23..e30e099 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2016-06-29 Manish Goregaokar <manish@mozilla.com>
+
+gdb/ChangeLog:
+ * rust-lang.c (rust_get_disr_info): Use strtok_r instead of strsep.
+
2016-06-28 Yao Qi <yao.qi@linaro.org>
* aarch64-tdep.c (aarch64_displaced_step_b): Use int64_t for
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 23ddd5a..c01687a 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -121,7 +121,7 @@ rust_get_disr_info (struct type *type, const gdb_byte *valaddr,
if (strncmp (TYPE_FIELD_NAME (type, 0), RUST_ENUM_PREFIX,
strlen (RUST_ENUM_PREFIX)) == 0)
{
- char *name, *tail, *token;
+ char *tail, *token, *name, *saveptr;
unsigned long fieldno;
struct type *member_type;
LONGEST value;
@@ -145,7 +145,9 @@ rust_get_disr_info (struct type *type, const gdb_byte *valaddr,
traversed in order to find the field (which may be several fields deep)
and the variantname is the name of the variant of the case when the
field is zero. */
- while ((token = strsep (&tail, "$")) != NULL)
+ for (token = strtok_r (tail, "$", &saveptr);
+ token != NULL;
+ token = strtok_r (NULL, "$", &saveptr))
{
if (sscanf (token, "%lu", &fieldno) != 1)
{
@@ -161,7 +163,7 @@ rust_get_disr_info (struct type *type, const gdb_byte *valaddr,
member_type = TYPE_FIELD_TYPE (member_type, fieldno);
}
- if (token >= name + strlen (TYPE_FIELD_NAME (type, 0)))
+ if (token == NULL)
error (_("Invalid form for %s"), RUST_ENUM_PREFIX);
value = unpack_long (member_type, valaddr + embedded_offset);