Fix handling of null stap semaphores
[deliverable/binutils-gdb.git] / gdb / xml-syscall.c
index d144f82fbf23165f7ba2fd2334aef9627cdf9b31..8cca875c740b38071731744341b6b52305c79750 100644 (file)
@@ -1,7 +1,7 @@
 /* Functions that provide the mechanism to parse a syscall XML file
    and get its values.
 
-   Copyright (C) 2009-2019 Free Software Foundation, Inc.
+   Copyright (C) 2009-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -221,9 +221,10 @@ syscall_create_syscall_desc (struct syscalls_info *syscalls_info,
   /*  Add syscall to its groups.  */
   if (groups != NULL)
     {
-      for (char *group = strtok (groups, ",");
+      char *saveptr;
+      for (char *group = strtok_r (groups, ",", &saveptr);
           group != NULL;
-          group = strtok (NULL, ","))
+          group = strtok_r (NULL, ",", &saveptr))
        syscall_group_add_syscall (syscalls_info, sysdesc, group);
     }
 }
@@ -316,7 +317,8 @@ static struct syscalls_info *
 xml_init_syscalls_info (const char *filename)
 {
   gdb::optional<gdb::char_vector> full_file
-    = xml_fetch_content_from_file (filename, gdb_datadir);
+    = xml_fetch_content_from_file (filename,
+                                  const_cast<char *>(gdb_datadir.c_str ()));
   if (!full_file)
     return NULL;
 
@@ -336,7 +338,7 @@ init_syscalls_info (struct gdbarch *gdbarch)
   /* Should we re-read the XML info for this target?  */
   if (syscalls_info != NULL && !syscalls_info->my_gdb_datadir.empty ()
       && filename_cmp (syscalls_info->my_gdb_datadir.c_str (),
-                      gdb_datadir) != 0)
+                      gdb_datadir.c_str ()) != 0)
     {
       /* The data-directory changed from the last time we used it.
         It means that we have to re-read the XML info.  */
@@ -361,7 +363,7 @@ init_syscalls_info (struct gdbarch *gdbarch)
     {
       if (xml_syscall_file != NULL)
        warning (_("Could not load the syscall XML file `%s/%s'."),
-                gdb_datadir, xml_syscall_file);
+                gdb_datadir.c_str (), xml_syscall_file);
       else
        warning (_("There is no XML file to open."));
 
This page took 0.030473 seconds and 4 git commands to generate.