Module Name: src Committed By: christos Date: Wed Apr 11 20:21:35 UTC 2012
Modified Files: src/external/gpl3/gdb/dist/gdb: nbsd-thread.c Log Message: remove more unused SA userland thread stuff. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/external/gpl3/gdb/dist/gdb/nbsd-thread.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/gpl3/gdb/dist/gdb/nbsd-thread.c diff -u src/external/gpl3/gdb/dist/gdb/nbsd-thread.c:1.13 src/external/gpl3/gdb/dist/gdb/nbsd-thread.c:1.14 --- src/external/gpl3/gdb/dist/gdb/nbsd-thread.c:1.13 Wed Apr 4 09:33:19 2012 +++ src/external/gpl3/gdb/dist/gdb/nbsd-thread.c Wed Apr 11 16:21:35 2012 @@ -580,269 +580,6 @@ nbsd_thread_create_inferior (struct targ } -static int -waiter_cb (td_thread_t *th, void *s) -{ - int ret; - td_thread_info_t ti; - - if ((ret = td_thr_info (th, &ti)) == 0) - { - wrap_here (NULL); - printf_filtered (" %d", ti.thread_id); - } - - return 0; -} - -/* Worker bee for thread state command. This is a callback function that - gets called once for each user thread (ie. not kernel thread) in the - inferior. Print anything interesting that we can think of. */ - -static int -info_cb (td_thread_t *th, void *s) -{ - int ret; - td_thread_info_t ti, ti2; -#ifdef notyet - td_sync_t *ts; - td_sync_info_t tsi; -#endif - char name[32]; - - if ((ret = td_thr_info (th, &ti)) == 0) - { - if (ti.thread_type != TD_TYPE_USER) - return 0; - td_thr_getname(th, name, 32); - printf_filtered ("%p: thread %4d ", ti.thread_addr, ti.thread_id); - if (name[0] != '\0') - printf_filtered("(%s) ", name); - - switch (ti.thread_state) - { - default: - case TD_STATE_UNKNOWN: - printf_filtered ("<unknown state> "); - break; - case TD_STATE_RUNNING: - printf_filtered ("running "); - break; - case TD_STATE_RUNNABLE: - printf_filtered ("active "); - break; - case TD_STATE_BLOCKED: - printf_filtered ("in kernel"); - break; - case TD_STATE_SLEEPING: - printf_filtered ("sleeping "); - break; - case TD_STATE_ZOMBIE: - printf_filtered ("zombie "); - break; - } - - if (ti.thread_state == TD_STATE_SLEEPING) - { -#ifdef notyet - td_thr_sleepinfo (th, &ts); - td_sync_info (ts, &tsi); - if (tsi.sync_type == TD_SYNC_JOIN) - { - td_thr_info (tsi.sync_data.join.thread, &ti2); - printf ("joining thread %d ", ti2.thread_id); - } - else - { - printf_filtered ("on %s at %p ", - syncnames[tsi.sync_type], - (void *)tsi.sync_addr); - } -#endif - } - -#ifdef notyet - if (ti.thread_hasjoiners) - { - printf_filtered ("(being joined by"); - td_thr_join_iter (th, waiter_cb, NULL); - printf_filtered (")"); - } -#endif - printf_filtered ("\n"); - } - else - warning ("info nbsd-thread: failed to get info for thread."); - - return 0; -} - - -/* List some state about each user thread in the inferior. */ - -static void -nbsd_thread_examine_all_cmd (char *args, int from_tty) -{ - int val; - - if (nbsd_thread_active) - { - val = td_thr_iter (main_ta, info_cb, args); - if (val != 0) - error ("nbsd_thread_examine_all_cmd: td_thr_iter: %s", - td_err_string (val)); - } - else - printf_filtered ("Thread debugging not active.\n"); -} - -static void -nbsd_thread_examine_cmd (char *exp, int from_tty) -{ - CORE_ADDR addr; - td_thread_t *th; - int ret; - - if (!nbsd_thread_active) - { - warning ("Thread debugging not active.\n"); - return; - } - - if (exp != NULL && *exp != '\000') - { - addr = parse_and_eval_address (exp); - if (from_tty) - *exp = 0; - } - else - return; - - if ((ret = td_map_pth2thr (main_ta, (pthread_t)(uintptr_t)addr, &th)) != 0) - error ("nbsd_thread_examine_command: td_map_pth2thr: %s", - td_err_string (ret)); - - info_cb (th, NULL); -} - - -static void -nbsd_thread_sync_cmd (char *exp, int from_tty) -{ - CORE_ADDR addr; -#ifdef notyet - td_sync_t *ts; - td_sync_info_t tsi; -#endif - td_thread_info_t ti; - int ret; - - if (!nbsd_thread_active) - { - warning ("Thread debugging not active.\n"); - return; - } - - if (exp != NULL && *exp != '\000') - { - addr = parse_and_eval_address (exp); - if (from_tty) - *exp = 0; - } - else - return; - -#ifdef notyet - if ((ret = td_map_addr2sync (main_ta, (caddr_t)addr, &ts)) != 0) - error ("nbsd_thread_sync_cmd: td_map_addr2sync: %s", td_err_string (ret)); - - if ((ret = td_sync_info (ts, &tsi)) != 0) - error ("nbsd_thread_sync_cmd: td_sync_info: %s", td_err_string (ret)); - - printf_filtered ("%p: %s", (void *)addr, syncnames[tsi.sync_type]); - - if (tsi.sync_type == TD_SYNC_MUTEX) - { - if (!tsi.sync_data.mutex.locked) - printf_filtered (" unlocked"); - else - { - td_thr_info (tsi.sync_data.mutex.owner, &ti); - printf_filtered (" locked by thread %d", ti.thread_id); - } - } - else if (tsi.sync_type == TD_SYNC_SPIN) - { - if (!tsi.sync_data.spin.locked) - printf_filtered (" unlocked"); - else - printf_filtered (" locked (waiters not tracked)"); - } - else if (tsi.sync_type == TD_SYNC_JOIN) - { - td_thr_info (tsi.sync_data.join.thread, &ti); - printf_filtered (" %d", ti.thread_id); - } - else if (tsi.sync_type == TD_SYNC_RWLOCK) - { - if (!tsi.sync_data.rwlock.locked) - printf_filtered (" unlocked"); - else - { - printf_filtered (" locked"); - if (tsi.sync_data.rwlock.readlocks > 0) - printf_filtered (" by %d reader%s", - tsi.sync_data.rwlock.readlocks, - (tsi.sync_data.rwlock.readlocks > 1) ? "s" : ""); - else - { - td_thr_info (tsi.sync_data.rwlock.writeowner, &ti); - printf_filtered (" by writer %d", ti.thread_id); - } - } - } - else - printf_filtered("Unknown sync object type %d", tsi.sync_type); - - if (tsi.sync_haswaiters) - { - printf_filtered (" waiters:"); - if ((ret = td_sync_waiters_iter (ts, waiter_cb, NULL)) != 0) - error ("nbsd_thread_sync_cmd: td_sync_info: %s", - td_err_string (ret)); - } - - printf_filtered ("\n"); -#endif -} - -int -tsd_cb (pthread_key_t key, void (*destructor)(void *), void *ignore) -{ - struct minimal_symbol *ms; - char *name; - - printf_filtered ("Key %3d ", key); - - /* XXX What does GDB use to print a function? */ - ms = lookup_minimal_symbol_by_pc ((CORE_ADDR)(uintptr_t)destructor); - - if (!ms) - name = "???"; - else - name = SYMBOL_PRINT_NAME (ms); - - printf_filtered ("Destructor %p <%s>\n", destructor, name); - - return 0; -} - -static void -nbsd_thread_tsd_cmd (char *exp, int from_tty) -{ - td_tsd_iter (main_ta, tsd_cb, NULL); -} - /* * Process operation callbacks */ @@ -1041,27 +778,10 @@ init_nbsd_thread_ops (void) void _initialize_nbsd_thread (void) { - static struct cmd_list_element *thread_examine_list = NULL; - init_nbsd_thread_ops (); init_nbsd_proc_callbacks (); add_target (&nbsd_thread_ops); - add_cmd ("tsd", class_run, nbsd_thread_tsd_cmd, - "Show the thread-specific data keys and destructors for the process.\n", - &thread_cmd_list); - - add_cmd ("sync", class_run, nbsd_thread_sync_cmd, - "Show the synchronization object at the given address.\n", - &thread_cmd_list); - - add_prefix_cmd ("examine", class_run, nbsd_thread_examine_cmd, - "Show the thread at the given address.\n", - &thread_examine_list, "examine ", 1, &thread_cmd_list); - - add_cmd ("all", class_run, nbsd_thread_examine_all_cmd, - "Show all threads.", - &thread_examine_list); /* Hook into new_objfile notification. */ observer_attach_new_objfile (nbsd_thread_new_objfile);