aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog15
-rw-r--r--gdb/ada-lang.h2
-rw-r--r--gdb/ada-tasks.c55
-rw-r--r--gdb/ravenscar-thread.c2
4 files changed, 42 insertions, 32 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1cf2f07..4e429f4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,18 @@
+2019-02-19 Tom Tromey <tromey@adacore.com>
+
+ * ravenscar-thread.c
+ (ravenscar_thread_target::update_thread_list): Don't call
+ ada_build_task_list.
+ * ada-lang.h (ada_build_task_list): Don't declare.
+ * ada-tasks.c (struct ada_tasks_inferior_data)
+ <task_list_valid_p>: Now bool.
+ (read_known_tasks, ada_task_list_changed)
+ (ada_tasks_invalidate_inferior_data): Update.
+ (read_known_tasks_array): Return bool.
+ (read_known_tasks_list): Likewise.
+ (read_known_tasks): Return void.
+ (ada_build_task_list): Now static.
+
2019-02-18 Andrew Burgess <andrew.burgess@embecosm.com>
* gdbtypes.c (type_align): Allow alignment of TYPE_CODE_METHODPTR
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 14470d5..ee03dbd 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -411,8 +411,6 @@ extern void iterate_over_live_ada_tasks
extern const char *ada_get_tcb_types_info (void);
-extern int ada_build_task_list (void);
-
extern void print_ada_task_info (struct ui_out *uiout,
char *taskno_str,
struct inferior *inf);
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 440e32b..ccabc631 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -26,6 +26,8 @@
#include "progspace.h"
#include "objfiles.h"
+static int ada_build_task_list ();
+
/* The name of the array in the GNAT runtime where the Ada Task Control
Block of each task is stored. */
#define KNOWN_TASKS_NAME "system__tasking__debug__known_tasks"
@@ -230,7 +232,7 @@ struct ada_tasks_inferior_data
/* When nonzero, this flag indicates that the task_list field
below is up to date. When set to zero, the list has either
not been initialized, or has potentially become stale. */
- int task_list_valid_p = 0;
+ bool task_list_valid_p = false;
/* The list of Ada tasks.
@@ -803,9 +805,9 @@ add_ada_task (CORE_ADDR task_id, struct inferior *inf)
}
/* Read the Known_Tasks array from the inferior memory, and store
- it in the current inferior's TASK_LIST. Return non-zero upon success. */
+ it in the current inferior's TASK_LIST. Return true upon success. */
-static int
+static bool
read_known_tasks_array (struct ada_tasks_inferior_data *data)
{
const int target_ptr_byte = TYPE_LENGTH (data->known_tasks_element);
@@ -826,13 +828,13 @@ read_known_tasks_array (struct ada_tasks_inferior_data *data)
add_ada_task (task_id, current_inferior ());
}
- return 1;
+ return true;
}
/* Read the known tasks from the inferior memory, and store it in
- the current inferior's TASK_LIST. Return non-zero upon success. */
+ the current inferior's TASK_LIST. Return true upon success. */
-static int
+static bool
read_known_tasks_list (struct ada_tasks_inferior_data *data)
{
const int target_ptr_byte = TYPE_LENGTH (data->known_tasks_element);
@@ -843,7 +845,7 @@ read_known_tasks_list (struct ada_tasks_inferior_data *data)
/* Sanity check. */
if (pspace_data->atcb_fieldno.activation_link < 0)
- return 0;
+ return false;
/* Build a new list by reading the ATCBs. Read head of the list. */
read_memory (data->known_tasks_addr, known_tasks, target_ptr_byte);
@@ -864,7 +866,7 @@ read_known_tasks_list (struct ada_tasks_inferior_data *data)
pspace_data->atcb_fieldno.activation_link));
}
- return 1;
+ return true;
}
/* Set all fields of the current inferior ada-tasks data pointed by DATA.
@@ -962,11 +964,10 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
}
/* Read the known tasks from the current inferior's memory, and store it
- in the current inferior's data TASK_LIST.
- Return non-zero upon success. */
+ in the current inferior's data TASK_LIST. */
-static int
-read_known_tasks (void)
+static void
+read_known_tasks ()
{
struct ada_tasks_inferior_data *data =
get_ada_tasks_inferior_data (current_inferior ());
@@ -983,29 +984,27 @@ read_known_tasks (void)
ada_tasks_inferior_data_sniffer (data);
gdb_assert (data->known_tasks_kind != ADA_TASKS_UNKNOWN);
+ /* Step 3: Set task_list_valid_p, to avoid re-reading the Known_Tasks
+ array unless needed. */
switch (data->known_tasks_kind)
{
- case ADA_TASKS_NOT_FOUND: /* Tasking not in use in inferior. */
- return 0;
- case ADA_TASKS_ARRAY:
- return read_known_tasks_array (data);
- case ADA_TASKS_LIST:
- return read_known_tasks_list (data);
+ case ADA_TASKS_NOT_FOUND: /* Tasking not in use in inferior. */
+ break;
+ case ADA_TASKS_ARRAY:
+ data->task_list_valid_p = read_known_tasks_array (data);
+ break;
+ case ADA_TASKS_LIST:
+ data->task_list_valid_p = read_known_tasks_list (data);
+ break;
}
-
- /* Step 3: Set task_list_valid_p, to avoid re-reading the Known_Tasks
- array unless needed. Then report a success. */
- data->task_list_valid_p = 1;
-
- return 1;
}
/* Build the task_list by reading the Known_Tasks array from
the inferior, and return the number of tasks in that list
(zero means that the program is not using tasking at all). */
-int
-ada_build_task_list (void)
+static int
+ada_build_task_list ()
{
struct ada_tasks_inferior_data *data;
@@ -1361,7 +1360,7 @@ ada_task_list_changed (struct inferior *inf)
{
struct ada_tasks_inferior_data *data = get_ada_tasks_inferior_data (inf);
- data->task_list_valid_p = 0;
+ data->task_list_valid_p = false;
}
/* Invalidate the per-program-space data. */
@@ -1380,7 +1379,7 @@ ada_tasks_invalidate_inferior_data (struct inferior *inf)
struct ada_tasks_inferior_data *data = get_ada_tasks_inferior_data (inf);
data->known_tasks_kind = ADA_TASKS_UNKNOWN;
- data->task_list_valid_p = 0;
+ data->task_list_valid_p = false;
}
/* The 'normal_stop' observer notification callback. */
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 05a8320..cb4f26a 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -374,8 +374,6 @@ ravenscar_add_thread (struct ada_task_info *task)
void
ravenscar_thread_target::update_thread_list ()
{
- ada_build_task_list ();
-
/* Do not clear the thread list before adding the Ada task, to keep
the thread that the process stratum has included into it
(m_base_ptid) and the running thread, that may not have been included