aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-tasks.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@adacore.com>2017-12-13 22:36:42 -0500
committerJoel Brobecker <brobecker@adacore.com>2017-12-13 23:00:03 -0500
commite05fa6f9df82886043e1f1df30e0b9be3fee2d55 (patch)
tree448b0849c1e54c331c8d8f37993cbd0363662f4c /gdb/ada-tasks.c
parentb3e7dd3c9d05064d845afafe52a7539948823788 (diff)
downloadgdb-e05fa6f9df82886043e1f1df30e0b9be3fee2d55.zip
gdb-e05fa6f9df82886043e1f1df30e0b9be3fee2d55.tar.gz
gdb-e05fa6f9df82886043e1f1df30e0b9be3fee2d55.tar.bz2
(Ada) Add support for task switching when debugging core files
The reasons for not supporting task switching when debugging core files appear to now mostly be OBE. In particular, on GNU/Linux, the thread layer is now able to retrieve the same thread info as in the live process. So, this patch is mostly about just removing the guard that limited the use of task switching to live processes. gdb/ChangeLog: * ada-tasks.c (read_atcb): Properly set task_info->ptid when !target_has_execution as well. (task_command): Remove error when !target_has_execution. gdb/testsuite/ChangeLog: * gdb.ada/task_switch_in_core: New testcase.
Diffstat (limited to 'gdb/ada-tasks.c')
-rw-r--r--gdb/ada-tasks.c34
1 files changed, 5 insertions, 29 deletions
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index eac6c5b..cd324b7 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -783,18 +783,10 @@ read_atcb (CORE_ADDR task_id, struct ada_task_info *task_info)
= value_as_long (value_field (common_value,
pspace_data->atcb_fieldno.base_cpu));
- /* And finally, compute the task ptid. Note that there are situations
- where this cannot be determined:
- - The task is no longer alive - the ptid is irrelevant;
- - We are debugging a core file - the thread is not always
- completely preserved for us to link back a task to its
- underlying thread. Since we do not support task switching
- when debugging core files anyway, we don't need to compute
- that task ptid.
- In either case, we don't need that ptid, and it is just good enough
- to set it to null_ptid. */
-
- if (target_has_execution && ada_task_is_alive (task_info))
+ /* And finally, compute the task ptid. Note that there is not point
+ in computing it if the task is no longer alive, in which case
+ it is good enough to set its ptid to the null_ptid. */
+ if (ada_task_is_alive (task_info))
task_info->ptid = ptid_from_atcb_common (common_value);
else
task_info->ptid = null_ptid;
@@ -1366,23 +1358,7 @@ task_command (const char *taskno_str, int from_tty)
if (taskno_str == NULL || taskno_str[0] == '\0')
display_current_task_id ();
else
- {
- /* Task switching in core files doesn't work, either because:
- 1. Thread support is not implemented with core files
- 2. Thread support is implemented, but the thread IDs created
- after having read the core file are not the same as the ones
- that were used during the program life, before the crash.
- As a consequence, there is no longer a way for the debugger
- to find the associated thead ID of any given Ada task.
- So, instead of attempting a task switch without giving the user
- any clue as to what might have happened, just error-out with
- a message explaining that this feature is not supported. */
- if (!target_has_execution)
- error (_("\
-Task switching not supported when debugging from core files\n\
-(use thread support instead)"));
- task_command_1 (taskno_str, from_tty, current_inferior ());
- }
+ task_command_1 (taskno_str, from_tty, current_inferior ());
}
/* Indicate that the given inferior's task list may have changed,