summaryrefslogtreecommitdiff
path: root/gdb/nto-procfs.c
diff options
context:
space:
mode:
authorAleksandar Ristovski <aristovski@qnx.com>2015-10-21 10:37:33 -0400
committerAleksandar Ristovski <aristovski@qnx.com>2015-10-21 10:37:33 -0400
commita9889169e5b21efb8c42105fc62461be43968d64 (patch)
treed269afcd6d625ac1df1f9786992e42f029063bb4 /gdb/nto-procfs.c
parent2b35fb28f397a26c0da03f7579116d28af2af824 (diff)
downloadbinutils-gdb-a9889169e5b21efb8c42105fc62461be43968d64.tar.gz
[nto] Fix nto target stopped by watchpoint.
Fix 'stopped by watchpoint' detection: add inferior data, use inferior data for storing last stopped flags needed for detection. gdb/ChangeLog: * nto-procfs.c (procfs_wait): Set stopped_flags nad stopped_pc. (procfs_stopped_by_watchpoint): Use flags stored in inferior data. * nto-tdep.c (nto_new_inferior_data_reg): New definition. (nto_new_inferior_data, nto_inferior_data_cleanup, nto_inferior_data): New functions. (_initialize_nto_tdep): New forward declaration, new function. * nto-tdep.h (struct nto_inferior_data): New struct. (nto_inferior_data): New function declaration.
Diffstat (limited to 'gdb/nto-procfs.c')
-rw-r--r--gdb/nto-procfs.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 82b428c0783..6ab78e35b0a 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -784,6 +784,9 @@ procfs_wait (struct target_ops *ops,
devctl (ctl_fd, DCMD_PROC_STATUS, &status, sizeof (status), 0);
}
+ nto_inferior_data (NULL)->stopped_flags = status.flags;
+ nto_inferior_data (NULL)->stopped_pc = status.ip;
+
if (status.flags & _DEBUG_FLAG_SSTEP)
{
ourstatus->kind = TARGET_WAITKIND_STOPPED;
@@ -1626,5 +1629,21 @@ procfs_insert_hw_watchpoint (struct target_ops *self,
static int
procfs_stopped_by_watchpoint (struct target_ops *ops)
{
- return 0;
+ /* NOTE: nto_stopped_by_watchpoint will be called ONLY while we are
+ stopped due to a SIGTRAP. This assumes gdb works in 'all-stop' mode;
+ future gdb versions will likely run in 'non-stop' mode in which case
+ we will have to store/examine statuses per thread in question.
+ Until then, this will work fine. */
+
+ struct inferior *inf = current_inferior ();
+ struct nto_inferior_data *inf_data;
+
+ gdb_assert (inf != NULL);
+
+ inf_data = nto_inferior_data (inf);
+
+ return inf_data->stopped_flags
+ & (_DEBUG_FLAG_TRACE_RD
+ | _DEBUG_FLAG_TRACE_WR
+ | _DEBUG_FLAG_TRACE_MODIFY);
}