diff options
author | Joel Brobecker <brobecker@gnat.com> | 2010-09-22 22:50:54 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2010-09-22 22:50:54 +0000 |
commit | 39383a48f726a69d632f4899acaccb0ba5f5a61b (patch) | |
tree | 272bf33c9328a6481c46003b93861ec387f1d340 /gdb/ada-tasks.c | |
parent | 7a360e83fc3bfe89586d408f2107242c85a0daf8 (diff) | |
download | gdb-39383a48f726a69d632f4899acaccb0ba5f5a61b.zip gdb-39383a48f726a69d632f4899acaccb0ba5f5a61b.tar.gz gdb-39383a48f726a69d632f4899acaccb0ba5f5a61b.tar.bz2 |
[Ada] Do not compute task ptid when debugging core file
After thread support over core files was added for GNU/Linux was added,
we started noticing the following type of crash when trying to perform
task switches (this is a bit accademic, since task switching is not
supported when debugging core files - this is what our testcase was
verifying).
(please check out the comment inside ada-tasks.c:task_command for
more details on this topic)
The reason for the crash comes from the fact that the GNU/Linux thread
layer now gets pushed on the target stack, causing the associated
to_get_ada_task_ptid target method to be activated. This routine
makes the assumption that, for all threads, the private area is not
NULL. This is incorrect in the case of core files, as the core layer
creates some threads with no private data.
But, taking a step back, we don't need to try to compute the task ptid,
as we'll never be using it anyways (we only use it for task switching).
So the fix is to avoid the ptid computation altogether when debugging
a core file.
gdb/ChangeLog:
* ada-tasks.c (read_atcb): Do not compute the task ptid when
debugging a core file.
Diffstat (limited to 'gdb/ada-tasks.c')
-rw-r--r-- | gdb/ada-tasks.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index f57f44f..8e42252 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -583,9 +583,18 @@ read_atcb (CORE_ADDR task_id, struct ada_task_info *task_info) } } - /* And finally, compute the task ptid. */ - - if (ada_task_is_alive (task_info)) + /* 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)) task_info->ptid = ptid_from_atcb_common (common_value); else task_info->ptid = null_ptid; |