From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4933 invoked by alias); 29 Nov 2007 15:44:37 -0000 Received: (qmail 4918 invoked by uid 22791); 29 Nov 2007 15:44:34 -0000 X-Spam-Check-By: sourceware.org Received: from dmz.mips-uk.com (HELO dmz.mips-uk.com) (194.74.144.194) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 29 Nov 2007 15:44:30 +0000 Received: from internal-mx1 ([192.168.192.240] helo=ukservices1.mips.com) by dmz.mips-uk.com with esmtp (Exim 3.35 #1 (Debian)) id 1IxlYx-0002uy-00; Thu, 29 Nov 2007 15:44:27 +0000 Received: from perivale.mips.com ([192.168.192.200]) by ukservices1.mips.com with esmtp (Exim 3.36 #1 (Debian)) id 1IxlYu-0003Nn-00; Thu, 29 Nov 2007 15:44:24 +0000 Received: from macro (helo=localhost) by perivale.mips.com with local-esmtp (Exim 4.63) (envelope-from ) id 1IxlYu-0007kV-0k; Thu, 29 Nov 2007 15:44:24 +0000 Date: Thu, 29 Nov 2007 15:44:00 -0000 From: "Maciej W. Rozycki" To: gdb-patches@sourceware.org cc: "Maciej W. Rozycki" Subject: Target-specific command logging facility Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MIPS-Technologies-UK-MailScanner: Found to be clean X-MIPS-Technologies-UK-MailScanner-From: macro@mips.com Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-11/txt/msg00545.txt.bz2 Hello, In preparation for submitting support for the MDI target I propose the following enhancement to the command logging facility. Right now serial_log_command() is called unconditionally which does nothing if the serial target subsystem is not being used. I propose to change this behaviour and provide a (*to_log_command)() member of the target vector so that the callee may be selected as appropriate. The change below is meant to preserve the current semantics -- all the currently supported targets that make use of the serial target subsystem initialise the new member to serial_log_command(). Tested using the mipsisa32-sde-elf target, with the mips-sim-sde32/-EB and mips-sim-sde32/-EL boards with no regressions. 2007-11-29 Maciej W. Rozycki * 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() if available 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. OK to apply? Maciej 14616.diff Index: binutils-quilt/src/gdb/target.h =================================================================== --- binutils-quilt.orig/src/gdb/target.h 2007-04-16 13:04:50.000000000 +0100 +++ binutils-quilt/src/gdb/target.h 2007-04-16 13:06:27.000000000 +0100 @@ -402,6 +402,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; @@ -1201,6 +1202,10 @@ extern const struct target_desc *target_read_description (struct target_ops *); +/* Command logging facility. */ + +#define target_log_command current_target.to_log_command + /* 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-04-16 12:14:49.000000000 +0100 +++ binutils-quilt/src/gdb/remote-m32r-sdi.c 2007-04-16 13:06:27.000000000 +0100 @@ -1595,6 +1595,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-04-16 13:04:50.000000000 +0100 +++ binutils-quilt/src/gdb/remote-mips.c 2007-04-16 13:06:27.000000000 +0100 @@ -3321,6 +3321,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-04-16 12:14:49.000000000 +0100 +++ binutils-quilt/src/gdb/monitor.c 2007-04-16 13:06:27.000000000 +0100 @@ -2229,6 +2229,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-04-16 12:14:49.000000000 +0100 +++ binutils-quilt/src/gdb/top.c 2007-04-16 13:06:27.000000000 +0100 @@ -387,7 +387,8 @@ if (p == NULL) return; - serial_log_command (p); + if (target_log_command) + target_log_command (p); while (*p == ' ' || *p == '\t') p++; Index: binutils-quilt/src/gdb/remote.c =================================================================== --- binutils-quilt.orig/src/gdb/remote.c 2007-04-16 13:04:49.000000000 +0100 +++ binutils-quilt/src/gdb/remote.c 2007-04-16 13:06:27.000000000 +0100 @@ -6153,6 +6153,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-04-16 13:04:51.000000000 +0100 +++ binutils-quilt/src/gdb/target.c 2007-04-16 13:06:27.000000000 +0100 @@ -451,6 +451,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);