Handle "p S::method()::static_var" in the C++ parser
[deliverable/binutils-gdb.git] / gdb / procfs.c
index b03809c7b7154b190f63768b78aa72b71a627956..504d74c05fba3c648cff9e3256621d8e2986d871 100644 (file)
@@ -5100,7 +5100,6 @@ procfs_info_proc (struct target_ops *ops, const char *args,
   struct cleanup *old_chain;
   procinfo *process  = NULL;
   procinfo *thread   = NULL;
-  char    **argv     = NULL;
   char     *tmp      = NULL;
   int       pid      = 0;
   int       tid      = 0;
@@ -5121,24 +5120,19 @@ procfs_info_proc (struct target_ops *ops, const char *args,
     }
 
   old_chain = make_cleanup (null_cleanup, 0);
-  if (args)
-    {
-      argv = gdb_buildargv (args);
-      make_cleanup_freeargv (argv);
-    }
-  while (argv != NULL && *argv != NULL)
+  gdb_argv built_argv (args);
+  for (char *arg : argv)
     {
-      if (isdigit (argv[0][0]))
+      if (isdigit (arg[0]))
        {
-         pid = strtoul (argv[0], &tmp, 10);
+         pid = strtoul (arg, &tmp, 10);
          if (*tmp == '/')
            tid = strtoul (++tmp, NULL, 10);
        }
-      else if (argv[0][0] == '/')
+      else if (arg[0] == '/')
        {
-         tid = strtoul (argv[0] + 1, NULL, 10);
+         tid = strtoul (arg + 1, NULL, 10);
        }
-      argv++;
     }
   if (pid == 0)
     pid = ptid_get_pid (inferior_ptid);
@@ -5322,7 +5316,6 @@ procfs_do_thread_registers (bfd *obfd, ptid_t ptid,
   gdb_gregset_t gregs;
   gdb_fpregset_t fpregs;
   unsigned long merged_pid;
-  struct cleanup *old_chain;
 
   merged_pid = ptid_get_lwp (ptid) << 16 | ptid_get_pid (ptid);
 
@@ -5331,7 +5324,7 @@ procfs_do_thread_registers (bfd *obfd, ptid_t ptid,
      once it is implemented in this platform:
      gdbarch_iterate_over_regset_sections().  */
 
-  old_chain = save_inferior_ptid ();
+  scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
   inferior_ptid = ptid;
   target_fetch_registers (regcache, -1);
 
@@ -5358,8 +5351,6 @@ procfs_do_thread_registers (bfd *obfd, ptid_t ptid,
                                              &fpregs,
                                              sizeof (fpregs));
 
-  do_cleanups (old_chain);
-
   return note_data;
 }
 
This page took 0.035729 seconds and 4 git commands to generate.