- /* Now that we have a list of task id's, we can print them */
- pt = task_list;
- while (pt)
- {
- temp_task = pt->task_id;
-
- /* read the atcb in the inferior */
- READ_MEMORY ((CORE_ADDR) temp_task, atcb);
-
- /* store the thread id for future use */
- pt->thread = EXTRACT_ADDRESS (atcb.thread);
-
-#if defined (linux)
- pt->lwp = (void *) THREAD_TO_PID (atcb.thread, 0);
-#else
- pt->lwp = EXTRACT_ADDRESS (atcb.lwp);
-#endif
-
- /* print a star if this task is the current one */
- if (thread_id)
-#if defined (__WIN32__) || defined (SGI) || defined (hpux)
- printf_filtered (pt->lwp == thread_id ? "*" : " ");
-#else
- printf_filtered (pt->thread == thread_id ? "*" : " ");
-#endif
-
- /* print the gdb task id */
- printf_filtered ("%3d", pt->task_num);
-
- /* print the Ada task id */
-#ifndef VXWORKS_TARGET
- printf_filtered (" %9lx", (long) temp_task);
-#else
-#ifdef TARGET_64
- printf_filtered (" %#9lx", (unsigned long) pt->thread & 0x3ffffffffff);
-#else
- printf_filtered (" %#9lx", (long) pt->thread);
-#endif
-#endif
-
- /* print the parent gdb task id */
- printf_filtered
- (" %4d", get_entry_number (EXTRACT_ADDRESS (atcb.parent)));
-
- /* print the base priority of the task */
- printf_filtered (" %3d", EXTRACT_INT (atcb.priority));
-
-#if defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET)
- if (pt->task_num == 1 || atcb.state == Terminated)
- {
- printf_filtered (" Unknown");
- goto next;
- }
-
- read_memory ((CORE_ADDR) atcb.thread, &thr, sizeof (thr));
- current_thread = atcb.thread;
- regs.regs[SP_REGNUM] = 0;
- if (dec_thread_get_registers (®s, NULL) == 0)
- {
- pt->stack_per = (100 * ((long) thr.__stack_base -
- regs.regs[SP_REGNUM])) / thr.__stack_size;
- /* if the thread is terminated but still there, the
- stack_base/size values are erroneous. Try to patch it */
- if (pt->stack_per < 0 || pt->stack_per > 100)
- pt->stack_per = 0;
- }
-
- /* print information about stack space used in the thread */
- if (thr.__stack_size < 1024 * 1024)
- {
- size = thr.__stack_size / 1024;
- car = 'K';
- }
- else if (thr.__stack_size < 1024 * 1024 * 1024)
- {
- size = thr.__stack_size / 1024 / 1024;
- car = 'M';
- }
- else /* Who knows... */
- {
- size = thr.__stack_size / 1024 / 1024 / 1024;
- car = 'G';
- }
- printf_filtered (" %4d%c %2d", size, car, pt->stack_per);
- next:
-#endif
-
- /* print the current state of the task */
-
- /* check if this task is accepting a rendezvous */
- if (atcb.call == NULL)
- caller = NULL;
- else
- {
- READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.call), call);
- caller = EXTRACT_ADDRESS (call.self);
- }
-
- if (caller != NULL)
- printf_filtered (" Accepting RV with %-4d",
- get_entry_number (caller));
- else
- {
- state = atcb.state;
-#if defined (__WIN32__) || defined (SGI) || defined (hpux)
- if (state == Runnable && (thread_id && pt->lwp == thread_id))
-#else
- if (state == Runnable && (thread_id && pt->thread == thread_id))
-#endif
- /* Replace "Runnable" by "Running" if this is the current task */
- printf_filtered (" %-22s", "Running");
- else
- printf_filtered (" %-22s", ada_task_states[state]);
- }
-
- /* finally, print the name of the task */
- if (atcb.image.P_ARRAY != NULL)
- {
- READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_BOUNDS),
- bounds);
- bounds[1] = EXTRACT_INT (bounds[1]);
- read_memory ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_ARRAY),
- (char *) &image, bounds[1]);
- printf_filtered (" %.*s\n", bounds[1], image);
- }
- else
- printf_filtered (" <no name>\n");