This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Use CORE_ADDR in to_trace_find


Hi,
During the ctf patches review, Doug pointed out that some parameters
are of type ULONGEST instead of CORE_ADDR, as a result of being called
by target_ops method 'to_trace_find', which uses ULONGEST.  This patch is to
change the type of parameters 'addr1' and 'addr2' of 'to_trace_find'
to CORE_ADDR and update function tfind_1.  The callers of tfind_1 pass
CORE_ADDR argument to it, so the callers are not updated.

The target_ops method 'to_trace_find' was added by this patch

  [PATCH] Target vector for tracepoint operations
  http://sourceware.org/ml/gdb-patches/2010-01/msg00129.html

and the type of parameter 'addr1' and 'addr2' is ULONGEST.  The patch
didn't mention why ULONGEST is used instead of CORE_ADDR.  However, at
that moment, we pass CORE_ADDR arguments.  It should be safe to change
parameter type from ULONGEST to CORE_ADDR.  Regression tested on
x86_64 with native and gdbserver.  Is it OK?

gdb:

2013-03-31  Yao Qi  <yao@codesourcery.com>

	* remote.c (remote_trace_find): Change type of parameters 'addr1'
	and 'addr2' to CORE_ADDR.
	* target.c (update_current_target): Update.
	* target.h (struct target_ops) <to_trace_find>: Change parameter
	type to CORE_ADDR.
	* tracepoint.c (tfind_1): Change type of parameters 'addr1' and
	'addr2' to CORE_ADDR.
	(tfile_trace_find): Likewise.
	(tfile_get_traceframe_address): Change return type to CORE_ADDR.
	Change local variable 'addr' to type CORE_ADDR.
	* tracepoint.h (tfind_1): Update declaration.
---
 gdb/remote.c     |    2 +-
 gdb/target.c     |    2 +-
 gdb/target.h     |    2 +-
 gdb/tracepoint.c |   10 +++++-----
 gdb/tracepoint.h |    2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/gdb/remote.c b/gdb/remote.c
index b8a7a1a..21ecd10 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -10791,7 +10791,7 @@ remote_trace_stop (void)
 
 static int
 remote_trace_find (enum trace_find_type type, int num,
-		   ULONGEST addr1, ULONGEST addr2,
+		   CORE_ADDR addr1, CORE_ADDR addr2,
 		   int *tpp)
 {
   struct remote_state *rs = get_remote_state ();
diff --git a/gdb/target.c b/gdb/target.c
index 9193c97..4d9da88 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -902,7 +902,7 @@ update_current_target (void)
 	    (void (*) (void))
 	    tcomplain);
   de_fault (to_trace_find,
-	    (int (*) (enum trace_find_type, int, ULONGEST, ULONGEST, int *))
+	    (int (*) (enum trace_find_type, int, CORE_ADDR, CORE_ADDR, int *))
 	    return_minus_one);
   de_fault (to_get_trace_state_variable_value,
 	    (int (*) (int, LONGEST *))
diff --git a/gdb/target.h b/gdb/target.h
index ee3fbff..36f6107 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -783,7 +783,7 @@ struct target_ops
       TPP.  If no trace frame matches, return -1.  May throw if the
       operation fails.  */
     int (*to_trace_find) (enum trace_find_type type, int num,
-			  ULONGEST addr1, ULONGEST addr2, int *tpp);
+			  CORE_ADDR addr1, CORE_ADDR addr2, int *tpp);
 
     /* Get the value of the trace state variable number TSV, returning
        1 if the value is known and writing the value itself into the
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 9a2425b..ce06a66 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2259,7 +2259,7 @@ disconnect_tracing (int from_tty)
 /* Worker function for the various flavors of the tfind command.  */
 void
 tfind_1 (enum trace_find_type type, int num,
-	 ULONGEST addr1, ULONGEST addr2,
+	 CORE_ADDR addr1, CORE_ADDR addr2,
 	 int from_tty)
 {
   int target_frameno = -1, target_tracept = -1;
@@ -4691,10 +4691,10 @@ tfile_get_tracepoint_status (struct breakpoint *tp, struct uploaded_tp *utp)
    value of a collected PC register, but if not available, we
    improvise.  */
 
-static ULONGEST
+static CORE_ADDR
 tfile_get_traceframe_address (off_t tframe_offset)
 {
-  ULONGEST addr = 0;
+  CORE_ADDR addr = 0;
   short tpnum;
   struct tracepoint *tp;
   off_t saved_offset = cur_offset;
@@ -4726,14 +4726,14 @@ tfile_get_traceframe_address (off_t tframe_offset)
 
 static int
 tfile_trace_find (enum trace_find_type type, int num,
-		  ULONGEST addr1, ULONGEST addr2, int *tpp)
+		  CORE_ADDR addr1, CORE_ADDR addr2, int *tpp)
 {
   short tpnum;
   int tfnum = 0, found = 0;
   unsigned int data_size;
   struct tracepoint *tp;
   off_t offset, tframe_offset;
-  ULONGEST tfaddr;
+  CORE_ADDR tfaddr;
 
   if (num == -1)
     {
diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h
index c7eef7b..8df906f 100644
--- a/gdb/tracepoint.h
+++ b/gdb/tracepoint.h
@@ -383,7 +383,7 @@ extern void tvariables_info_1 (void);
 extern void save_trace_state_variables (struct ui_file *fp);
 
 extern void tfind_1 (enum trace_find_type type, int num,
-		     ULONGEST addr1, ULONGEST addr2,
+		     CORE_ADDR addr1, CORE_ADDR addr2,
 		     int from_tty);
 
 extern void trace_save_tfile (const char *filename,
-- 
1.7.7.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]