diff options
author | Aleksandar Ristovski <aristovski@qnx.com> | 2015-10-21 10:37:33 -0400 |
---|---|---|
committer | Aleksandar Ristovski <aristovski@qnx.com> | 2015-10-21 10:37:33 -0400 |
commit | a9889169e5b21efb8c42105fc62461be43968d64 (patch) | |
tree | d269afcd6d625ac1df1f9786992e42f029063bb4 /gdb/nto-tdep.c | |
parent | 2b35fb28f397a26c0da03f7579116d28af2af824 (diff) | |
download | gdb-a9889169e5b21efb8c42105fc62461be43968d64.zip gdb-a9889169e5b21efb8c42105fc62461be43968d64.tar.gz gdb-a9889169e5b21efb8c42105fc62461be43968d64.tar.bz2 |
[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-tdep.c')
-rw-r--r-- | gdb/nto-tdep.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c index 62eb88a..e50d302 100644 --- a/gdb/nto-tdep.c +++ b/gdb/nto-tdep.c @@ -46,6 +46,8 @@ static char default_nto_target[] = ""; struct nto_target_ops current_nto_target; +static const struct inferior_data *nto_inferior_data_reg; + static char * nto_target (void) { @@ -477,3 +479,53 @@ nto_read_auxv_from_initial_stack (CORE_ADDR initial_stack, gdb_byte *readbuf, } return len_read; } + +/* Allocate new nto_inferior_data object. */ + +static struct nto_inferior_data * +nto_new_inferior_data (void) +{ + struct nto_inferior_data *const inf_data + = XCNEW (struct nto_inferior_data); + + return inf_data; +} + +/* Free inferior data. */ + +static void +nto_inferior_data_cleanup (struct inferior *const inf, void *const dat) +{ + xfree (dat); +} + +/* Return nto_inferior_data for the given INFERIOR. If not yet created, + construct it. */ + +struct nto_inferior_data * +nto_inferior_data (struct inferior *const inferior) +{ + struct inferior *const inf = inferior ? inferior : current_inferior (); + struct nto_inferior_data *inf_data; + + gdb_assert (inf != NULL); + + inf_data = inferior_data (inf, nto_inferior_data_reg); + if (inf_data == NULL) + { + set_inferior_data (inf, nto_inferior_data_reg, + (inf_data = nto_new_inferior_data ())); + } + + return inf_data; +} + +/* Provide a prototype to silence -Wmissing-prototypes. */ +extern initialize_file_ftype _initialize_nto_tdep; + +void +_initialize_nto_tdep (void) +{ + nto_inferior_data_reg + = register_inferior_data_with_cleanup (NULL, nto_inferior_data_cleanup); +} |