This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] [2/4] Remove libgdb API (gdb_list_thread_ids)


Hi,

This simple patch removes/renames gdb_list_thread_ids.

Keith

ChangeLog
2012-01-12  Keith Seitz  <keiths@redhat.com>

	* gdb.h (gdb_list_thread_ids): Remove declaration.
	* gdbhtread.h (list_thread_ids): Add declaration.
	* mi/mi-main.c (mi_cmd_thread_select): Use list_thread_ids
	instead of gdb_list_thread_ids.
	* thread.c (do_captured_list_thread_ids): Renamed to ...
	(list_thread_ids): ... this. Make return value void.
	(gdb_list_thread_ids): Remove.
diff --git a/gdb/gdb.h b/gdb/gdb.h
index dcd00c1..1611cbe 100644
--- a/gdb/gdb.h
+++ b/gdb/gdb.h
@@ -46,8 +46,4 @@ enum gdb_rc {
 enum gdb_rc gdb_thread_select (struct ui_out *uiout, char *tidstr,
 			       char **error_message);
 
-/* Print a list of known thread ids.  */
-enum gdb_rc gdb_list_thread_ids (struct ui_out *uiout,
-				 char **error_message);
-
 #endif
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index fb8de16..7854cee 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -389,4 +389,6 @@ extern struct thread_info* inferior_thread (void);
 
 extern void update_thread_list (void);
 
+extern void list_thread_ids (struct ui_out *uiout);
+
 #endif /* GDBTHREAD_H */
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index cc68c9e..2ae688b 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -483,19 +483,10 @@ mi_cmd_thread_select (char *command, char **argv, int argc)
 void
 mi_cmd_thread_list_ids (char *command, char **argv, int argc)
 {
-  enum gdb_rc rc;
-  char *mi_error_message;
-
   if (argc != 0)
     error (_("-thread-list-ids: No arguments required."));
 
-  rc = gdb_list_thread_ids (current_uiout, &mi_error_message);
-
-  if (rc == GDB_RC_FAIL)
-    {
-      make_cleanup (xfree, mi_error_message);
-      error ("%s", mi_error_message);
-    }
+  list_thread_ids (current_uiout);
 }
 
 void
diff --git a/gdb/thread.c b/gdb/thread.c
index 9a29383..1f59a83 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -478,9 +478,9 @@ any_live_thread_of_process (int pid)
 }
 
 /* Print a list of thread ids currently known, and the total number of
-   threads.  To be used from within catch_errors.  */
-static int
-do_captured_list_thread_ids (struct ui_out *uiout, void *arg)
+   threads.  */
+void
+list_thread_ids (struct ui_out *uiout)
 {
   struct thread_info *tp;
   int num = 0;
@@ -508,18 +508,6 @@ do_captured_list_thread_ids (struct ui_out *uiout, void *arg)
   if (current_thread != -1)
     ui_out_field_int (uiout, "current-thread-id", current_thread);
   ui_out_field_int (uiout, "number-of-threads", num);
-  return GDB_RC_OK;
-}
-
-/* Official gdblib interface function to get a list of thread ids and
-   the total number.  */
-enum gdb_rc
-gdb_list_thread_ids (struct ui_out *uiout, char **error_message)
-{
-  if (catch_exceptions_with_msg (uiout, do_captured_list_thread_ids, NULL,
-				 error_message, RETURN_MASK_ALL) < 0)
-    return GDB_RC_FAIL;
-  return GDB_RC_OK;
 }
 
 /* Return true if TP is an active thread.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]