public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [patch] Turn on dbg msg of IPA along with gdbserver's
@ 2012-01-04  3:40 Yao Qi
  2012-01-04 12:02 ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Yao Qi @ 2012-01-04  3:40 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 586 bytes --]

Hi,
We are still unable to change IPA's debug flag `debug_threads', because
it is within inferior's address space.  Since gdbserver has been a good
mechanism to access gdb_agent_XXX variables in inferior's space, we can
do similar thing to turn on IPA's debug flag.

This patch renames debug flag `debug_threads' to `gdb_agent_debug', and
let gdbserver to set it if `debug_threads' (in gdbserver's space) is
true.  For the user's perspective, if gdbserver option --debug is on,
IPA's debugging message comes into the gdbserver's debug message.

OK for mainline?

-- 
Yao (齐尧)

[-- Attachment #2: 0003-set-debug-flag-for-ipa.patch --]
[-- Type: text/x-patch, Size: 1962 bytes --]

2012-01-04  Yao Qi  <yao@codesourcery.com>

	* tracepoint.c [IN_PROCESS_AGENT] (debug_threads): Macro
	defined.
	(struct ipa_sym_addresses): New field `addr_debug'.
	(symbol_list): New element IPA_SYM(debug).
	(tracepoint_look_up_symbols): Set `gdb_agent_debug'
	if `debug_threads' is true.
	[IN_PROCESS_AGENT] (gdb_agent_debug): New global
	variable.
---
 gdb/gdbserver/tracepoint.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 524fa77..360c14b 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -67,9 +67,13 @@ trace_vdebug (const char *fmt, ...)
   va_end (ap);
 }
 
+#ifdef IN_PROCESS_AGENT
+#define debug_threads gdb_agent_debug
+#endif
+
 #define trace_debug_1(level, fmt, args...)	\
   do {						\
-    if (level <= debug_threads)			\
+    if (level <= debug_threads)		\
       trace_vdebug ((fmt), ##args);		\
   } while (0)
 
@@ -179,6 +183,7 @@ struct ipa_sym_addresses
   CORE_ADDR addr_ust_loaded;
   CORE_ADDR addr_helper_thread_id;
   CORE_ADDR addr_cmd_buf;
+  CORE_ADDR addr_debug;
 };
 
 #define STRINGIZE_1(STR) #STR
@@ -226,6 +231,7 @@ static struct
   IPA_SYM(ust_loaded),
   IPA_SYM(helper_thread_id),
   IPA_SYM(cmd_buf),
+  IPA_SYM(debug),
 };
 
 struct ipa_sym_addresses ipa_sym_addrs;
@@ -348,6 +354,14 @@ tracepoint_look_up_symbols (void)
     }
 
   all_tracepoint_symbols_looked_up = 1;
+
+  /* If the debug option of gdbserver is turned on, turn IPA's debug
+     option on as well.  */
+  if (debug_threads)
+    write_inferior_memory (ipa_sym_addrs.addr_debug,
+			   (unsigned char *) &debug_threads,
+			   sizeof (debug_threads));
+
 }
 
 #endif
@@ -366,7 +380,7 @@ tracepoint_look_up_symbols (void)
    GDBserver side.  */
 
 #ifdef IN_PROCESS_AGENT
-int debug_threads = 0;
+int gdb_agent_debug = 0;
 
 int
 read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
-- 
1.7.0.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-01-06  6:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-04  3:40 [patch] Turn on dbg msg of IPA along with gdbserver's Yao Qi
2012-01-04 12:02 ` Pedro Alves
2012-01-04 14:55   ` Yao Qi
2012-01-05 14:47     ` Pedro Alves
2012-01-06  6:01       ` [committed] : " Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).