• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisióna9889169e5b21efb8c42105fc62461be43968d64 (tree)
Tiempo2015-10-21 23:37:33
AutorAleksandar Ristovski <aristovski@qnx....>
CommiterAleksandar Ristovski

Log Message

[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.

Cambiar Resumen

Diferencia incremental

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,14 @@
1+2015-10-21 Aleksandar Ristovski <aristovski@qnx.com>
2+
3+ * nto-procfs.c (procfs_wait): Set stopped_flags nad stopped_pc.
4+ (procfs_stopped_by_watchpoint): Use flags stored in inferior data.
5+ * nto-tdep.c (nto_new_inferior_data_reg): New definition.
6+ (nto_new_inferior_data, nto_inferior_data_cleanup, nto_inferior_data):
7+ New functions.
8+ (_initialize_nto_tdep): New forward declaration, new function.
9+ * nto-tdep.h (struct nto_inferior_data): New struct.
10+ (nto_inferior_data): New function declaration.
11+
112 2015-10-20 Jan Kratochvil <jan.kratochvil@redhat.com>
213
314 * findvar.c (address_from_register): Check REGNUM validity.
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -784,6 +784,9 @@ procfs_wait (struct target_ops *ops,
784784 devctl (ctl_fd, DCMD_PROC_STATUS, &status, sizeof (status), 0);
785785 }
786786
787+ nto_inferior_data (NULL)->stopped_flags = status.flags;
788+ nto_inferior_data (NULL)->stopped_pc = status.ip;
789+
787790 if (status.flags & _DEBUG_FLAG_SSTEP)
788791 {
789792 ourstatus->kind = TARGET_WAITKIND_STOPPED;
@@ -1626,5 +1629,21 @@ procfs_insert_hw_watchpoint (struct target_ops *self,
16261629 static int
16271630 procfs_stopped_by_watchpoint (struct target_ops *ops)
16281631 {
1629- return 0;
1632+ /* NOTE: nto_stopped_by_watchpoint will be called ONLY while we are
1633+ stopped due to a SIGTRAP. This assumes gdb works in 'all-stop' mode;
1634+ future gdb versions will likely run in 'non-stop' mode in which case
1635+ we will have to store/examine statuses per thread in question.
1636+ Until then, this will work fine. */
1637+
1638+ struct inferior *inf = current_inferior ();
1639+ struct nto_inferior_data *inf_data;
1640+
1641+ gdb_assert (inf != NULL);
1642+
1643+ inf_data = nto_inferior_data (inf);
1644+
1645+ return inf_data->stopped_flags
1646+ & (_DEBUG_FLAG_TRACE_RD
1647+ | _DEBUG_FLAG_TRACE_WR
1648+ | _DEBUG_FLAG_TRACE_MODIFY);
16301649 }
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -46,6 +46,8 @@ static char default_nto_target[] = "";
4646
4747 struct nto_target_ops current_nto_target;
4848
49+static const struct inferior_data *nto_inferior_data_reg;
50+
4951 static char *
5052 nto_target (void)
5153 {
@@ -477,3 +479,53 @@ nto_read_auxv_from_initial_stack (CORE_ADDR initial_stack, gdb_byte *readbuf,
477479 }
478480 return len_read;
479481 }
482+
483+/* Allocate new nto_inferior_data object. */
484+
485+static struct nto_inferior_data *
486+nto_new_inferior_data (void)
487+{
488+ struct nto_inferior_data *const inf_data
489+ = XCNEW (struct nto_inferior_data);
490+
491+ return inf_data;
492+}
493+
494+/* Free inferior data. */
495+
496+static void
497+nto_inferior_data_cleanup (struct inferior *const inf, void *const dat)
498+{
499+ xfree (dat);
500+}
501+
502+/* Return nto_inferior_data for the given INFERIOR. If not yet created,
503+ construct it. */
504+
505+struct nto_inferior_data *
506+nto_inferior_data (struct inferior *const inferior)
507+{
508+ struct inferior *const inf = inferior ? inferior : current_inferior ();
509+ struct nto_inferior_data *inf_data;
510+
511+ gdb_assert (inf != NULL);
512+
513+ inf_data = inferior_data (inf, nto_inferior_data_reg);
514+ if (inf_data == NULL)
515+ {
516+ set_inferior_data (inf, nto_inferior_data_reg,
517+ (inf_data = nto_new_inferior_data ()));
518+ }
519+
520+ return inf_data;
521+}
522+
523+/* Provide a prototype to silence -Wmissing-prototypes. */
524+extern initialize_file_ftype _initialize_nto_tdep;
525+
526+void
527+_initialize_nto_tdep (void)
528+{
529+ nto_inferior_data_reg
530+ = register_inferior_data_with_cleanup (NULL, nto_inferior_data_cleanup);
531+}
--- a/gdb/nto-tdep.h
+++ b/gdb/nto-tdep.h
@@ -142,6 +142,16 @@ struct private_thread_info
142142 char name[1];
143143 };
144144
145+/* Per-inferior data, common for both procfs and remote. */
146+struct nto_inferior_data
147+{
148+ /* Last stopped flags result from wait function */
149+ unsigned int stopped_flags;
150+
151+ /* Last known stopped PC */
152+ CORE_ADDR stopped_pc;
153+};
154+
145155 /* Generic functions in nto-tdep.c. */
146156
147157 void nto_init_solib_absolute_prefix (void);
@@ -171,4 +181,7 @@ char *nto_extra_thread_info (struct target_ops *self, struct thread_info *);
171181 LONGEST nto_read_auxv_from_initial_stack (CORE_ADDR inital_stack,
172182 gdb_byte *readbuf,
173183 LONGEST len, size_t sizeof_auxv_t);
184+
185+struct nto_inferior_data *nto_inferior_data (struct inferior *inf);
186+
174187 #endif