From: "Maciej W. Rozycki" <macro@mips.com>
To: Jim Blandy <jimb@codesourcery.com>
Cc: gdb-patches@sourceware.org, "Maciej W. Rozycki" <macro@linux-mips.org>
Subject: Re: Target-specific command logging facility
Date: Fri, 30 Nov 2007 13:55:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.61.0711291837460.3161@perivale.mips.com> (raw)
In-Reply-To: <m3tzn4kj7w.fsf@codesourcery.com>
On Thu, 29 Nov 2007, Jim Blandy wrote:
> This looks good; I have some minor suggestions.
Thanks for your review.
> I think it's better style to have the conditional in the definition of
> target_log_command itself, so that every caller doesn't have to test
> whether current target happens to have such a function. I grant this
> is the only caller, but people do look at existing code for precedent.
Well, I have no strong preference and your suggestion sounds reasonable
indeed.
So can I assume the change below is OK then? Tested using the
mipsisa32-sde-elf target, with the mips-sim-sde32/-EB and
mips-sim-sde32/-EL boards with no regressions.
2006-02-13 Maciej W. Rozycki <macro@mips.com>
* target.c (update_current_target): Inherit to_log_command.
* target.h (struct target_ops). Add to_log_command.
(target_log_command): New macro.
* top.c (execute_command): Call target_log_command() rather than
serial_log_command().
* monitor.c (init_base_monitor_ops): Initialize to_log_command.
* remote-m32r-sdi.c (init_m32r_ops): Likewise.
* remote-mips.c (_initialize_remote_mips): Likewise.
* remote.c (init_remote_ops): Likewise.
Maciej
14616.diff
Index: binutils-quilt/src/gdb/target.h
===================================================================
--- binutils-quilt.orig/src/gdb/target.h 2007-11-30 11:47:30.000000000 +0000
+++ binutils-quilt/src/gdb/target.h 2007-11-30 12:04:46.000000000 +0000
@@ -404,6 +404,7 @@
int);
struct exception_event_record *(*to_get_current_exception_event) (void);
char *(*to_pid_to_exec_file) (int pid);
+ void (*to_log_command) (const char *);
enum strata to_stratum;
int to_has_all_memory;
int to_has_memory;
@@ -1130,6 +1131,14 @@
extern const struct target_desc *target_read_description (struct target_ops *);
+/* Command logging facility. */
+
+#define target_log_command(p) \
+ do \
+ if (current_target.to_log_command) \
+ (*current_target.to_log_command) (p); \
+ while (0)
+
/* Routines for maintenance of the target structures...
add_target: Add a target to the list of all possible targets.
Index: binutils-quilt/src/gdb/remote-m32r-sdi.c
===================================================================
--- binutils-quilt.orig/src/gdb/remote-m32r-sdi.c 2007-11-30 11:47:30.000000000 +0000
+++ binutils-quilt/src/gdb/remote-m32r-sdi.c 2007-11-30 11:48:02.000000000 +0000
@@ -1599,6 +1599,7 @@
m32r_ops.to_create_inferior = m32r_create_inferior;
m32r_ops.to_mourn_inferior = m32r_mourn_inferior;
m32r_ops.to_stop = m32r_stop;
+ m32r_ops.to_log_command = serial_log_command;
m32r_ops.to_stratum = process_stratum;
m32r_ops.to_has_all_memory = 1;
m32r_ops.to_has_memory = 1;
Index: binutils-quilt/src/gdb/remote-mips.c
===================================================================
--- binutils-quilt.orig/src/gdb/remote-mips.c 2007-11-30 11:47:30.000000000 +0000
+++ binutils-quilt/src/gdb/remote-mips.c 2007-11-30 11:48:02.000000000 +0000
@@ -3333,6 +3333,7 @@
mips_ops.to_load = mips_load;
mips_ops.to_create_inferior = mips_create_inferior;
mips_ops.to_mourn_inferior = mips_mourn_inferior;
+ mips_ops.to_log_command = serial_log_command;
mips_ops.to_stratum = process_stratum;
mips_ops.to_has_all_memory = 1;
mips_ops.to_has_memory = 1;
Index: binutils-quilt/src/gdb/monitor.c
===================================================================
--- binutils-quilt.orig/src/gdb/monitor.c 2007-11-30 11:47:30.000000000 +0000
+++ binutils-quilt/src/gdb/monitor.c 2007-11-30 11:48:02.000000000 +0000
@@ -2233,6 +2233,7 @@
monitor_ops.to_mourn_inferior = monitor_mourn_inferior;
monitor_ops.to_stop = monitor_stop;
monitor_ops.to_rcmd = monitor_rcmd;
+ monitor_ops.to_log_command = serial_log_command;
monitor_ops.to_stratum = process_stratum;
monitor_ops.to_has_all_memory = 1;
monitor_ops.to_has_memory = 1;
Index: binutils-quilt/src/gdb/top.c
===================================================================
--- binutils-quilt.orig/src/gdb/top.c 2007-11-30 11:47:30.000000000 +0000
+++ binutils-quilt/src/gdb/top.c 2007-11-30 11:48:02.000000000 +0000
@@ -385,7 +385,7 @@
if (p == NULL)
return;
- serial_log_command (p);
+ target_log_command (p);
while (*p == ' ' || *p == '\t')
p++;
Index: binutils-quilt/src/gdb/remote.c
===================================================================
--- binutils-quilt.orig/src/gdb/remote.c 2007-11-30 11:47:30.000000000 +0000
+++ binutils-quilt/src/gdb/remote.c 2007-11-30 11:48:03.000000000 +0000
@@ -6315,6 +6315,7 @@
remote_ops.to_stop = remote_stop;
remote_ops.to_xfer_partial = remote_xfer_partial;
remote_ops.to_rcmd = remote_rcmd;
+ remote_ops.to_log_command = serial_log_command;
remote_ops.to_get_thread_local_address = remote_get_thread_local_address;
remote_ops.to_stratum = process_stratum;
remote_ops.to_has_all_memory = 1;
Index: binutils-quilt/src/gdb/target.c
===================================================================
--- binutils-quilt.orig/src/gdb/target.c 2007-11-30 11:47:30.000000000 +0000
+++ binutils-quilt/src/gdb/target.c 2007-11-30 11:48:03.000000000 +0000
@@ -448,6 +448,7 @@
INHERIT (to_enable_exception_callback, t);
INHERIT (to_get_current_exception_event, t);
INHERIT (to_pid_to_exec_file, t);
+ INHERIT (to_log_command, t);
INHERIT (to_stratum, t);
INHERIT (to_has_all_memory, t);
INHERIT (to_has_memory, t);
next prev parent reply other threads:[~2007-11-30 13:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-29 15:44 Maciej W. Rozycki
2007-11-29 18:20 ` Jim Blandy
2007-11-30 13:55 ` Maciej W. Rozycki [this message]
2007-12-07 15:07 ` Maciej W. Rozycki
2007-12-07 15:36 ` Daniel Jacobowitz
2007-12-07 15:45 ` Maciej W. Rozycki
2007-12-07 16:21 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.61.0711291837460.3161@perivale.mips.com \
--to=macro@mips.com \
--cc=gdb-patches@sourceware.org \
--cc=jimb@codesourcery.com \
--cc=macro@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox