From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12885 invoked by alias); 25 Feb 2007 03:20:39 -0000 Received: (qmail 12875 invoked by uid 22791); 25 Feb 2007 03:20:38 -0000 X-Spam-Check-By: sourceware.org Received: from elrond.portugalmail.pt (HELO elrond.portugalmail.pt) (195.245.179.181) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 25 Feb 2007 03:20:24 +0000 Received: from localhost (localhost [127.0.0.1]) by elrond.portugalmail.pt (Postfix) with ESMTP id B7F1E34001; Sun, 25 Feb 2007 03:20:17 +0000 (WET) Received: from elrond.portugalmail.pt ([127.0.0.1]) by localhost (elrond.portugalmail.pt [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ong-+Ac2JHpj; Sun, 25 Feb 2007 03:20:17 +0000 (WET) Received: from [127.0.0.1] (62.169.107.209.rev.optimus.pt [62.169.107.209]) (Authenticated sender: pedro_alves@portugalmail.pt) by elrond.portugalmail.pt (Postfix) with ESMTP id 7FF0933223; Sun, 25 Feb 2007 03:20:13 +0000 (WET) Message-ID: <45E1006A.4020004@portugalmail.pt> Date: Sun, 25 Feb 2007 03:20:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.8.0.9) Gecko/20061207 Thunderbird/1.5.0.9 Mnenhy/0.7.4.0 MIME-Version: 1.0 To: Pedro Alves , gdb-patches@sourceware.org Subject: Re: [gdbserver] Use enum target_signal in _send_signal. References: <45E0C90C.7030101@portugalmail.pt> <20070225021135.GA20988@caradoc.them.org> In-Reply-To: <20070225021135.GA20988@caradoc.them.org> Content-Type: multipart/mixed; boundary="------------040800060402020507040805" X-Antivirus: avast! (VPS 000716-3, 23-02-2007), Outbound message X-Antivirus-Status: Clean X-IsSubscribed: yes 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-02/txt/msg00309.txt.bz2 This is a multi-part message in MIME format. --------------040800060402020507040805 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1657 Daniel Jacobowitz escreveu: > On Sat, Feb 24, 2007 at 11:23:56PM +0000, Pedro Alves wrote: >> Hi all, >> >> This patch converts the send_signal function in target_ops to use enum >> target_signal >> instead of the real target number. I originally needed this for the >> WinCE gdbserver port. >> Windows CE doesn't have signals support, and doesn't define SIGINT in >> any header. >> Because of that, remote-utils.c wouldn't compile. I still want to have >> support of stopping >> a debuggee - this patch paves the way to that, with minimal interface >> changes. I will handle >> TARGET_SIGNAL_INT in the send_signal handler on the target side. >> >> Ok? > > Maybe this is the wrong abstraction entirely? Because most signals > are passed to the continue / resume support, maybe the target method > here doesn't need a signal number at all. We could replace it with > just send_interrupt. > > What do you think? > I agree. I looked at shoehorning this into target_ops->(*resume)() with TARGET_SIGNAL_INT, but that would be wrong, as resume expects an already stopped process, and send_signal was used to do the actual stopping. How does this look? Cheers, Pedro Alves --- gdb/gdbserver/ChangeLog: * target.h (target_ops): Rename send_signal to request_interrupt, and remove enum target_signal parameter. * linux-low.c (linux_request_interrupt): Rename from linux_send_signal, and always send SIGINT. * spu-low.c (spu_request_interrupt): Rename from spu_send_signal, and always send SIGINT. * remote-utils.c (putpkt_binary): Call request_interrupt, instead of send_signal. (input_interrupt): Likewise. --------------040800060402020507040805 Content-Type: text/plain; name="target_signal.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="target_signal.diff" Content-length: 3259 Index: src/gdb/gdbserver/linux-low.c =================================================================== --- src.orig/gdb/gdbserver/linux-low.c 2007-02-25 02:51:24.000000000 +0000 +++ src/gdb/gdbserver/linux-low.c 2007-02-25 02:56:42.000000000 +0000 @@ -1514,7 +1514,7 @@ } static void -linux_send_signal (int signum) +linux_request_interrupt (void) { extern unsigned long signal_pid; @@ -1523,10 +1523,10 @@ struct process_info *process; process = get_thread_process (current_inferior); - kill_lwp (process->lwpid, signum); + kill_lwp (process->lwpid, SIGINT); } else - kill_lwp (signal_pid, signum); + kill_lwp (signal_pid, SIGINT); } /* Copy LEN bytes from inferior's auxiliary vector starting at OFFSET @@ -1660,7 +1660,7 @@ linux_read_memory, linux_write_memory, linux_look_up_symbols, - linux_send_signal, + linux_request_interrupt, linux_read_auxv, linux_insert_watchpoint, linux_remove_watchpoint, Index: src/gdb/gdbserver/spu-low.c =================================================================== --- src.orig/gdb/gdbserver/spu-low.c 2007-02-25 02:51:24.000000000 +0000 +++ src/gdb/gdbserver/spu-low.c 2007-02-25 02:57:20.000000000 +0000 @@ -551,9 +551,9 @@ /* Send signal to inferior. */ static void -spu_send_signal (int signo) +spu_request_interrupt (void) { - syscall (SYS_tkill, current_tid, signo); + syscall (SYS_tkill, current_tid, SIGINT); } static const char * @@ -576,7 +576,7 @@ spu_read_memory, spu_write_memory, spu_look_up_symbols, - spu_send_signal, + spu_request_interrupt, NULL, NULL, NULL, Index: src/gdb/gdbserver/target.h =================================================================== --- src.orig/gdb/gdbserver/target.h 2007-02-25 02:51:24.000000000 +0000 +++ src/gdb/gdbserver/target.h 2007-02-25 02:58:00.000000000 +0000 @@ -127,8 +127,10 @@ void (*look_up_symbols) (void); - /* Send a signal to the inferior process, however is appropriate. */ - void (*send_signal) (int); + /* Send an interrupt request to the inferior process, + however is appropriate. */ + + void (*request_interrupt) (void); /* Read auxiliary vector data from the inferior process. Index: src/gdb/gdbserver/remote-utils.c =================================================================== --- src.orig/gdb/gdbserver/remote-utils.c 2007-02-25 02:51:24.000000000 +0000 +++ src/gdb/gdbserver/remote-utils.c 2007-02-25 02:54:26.000000000 +0000 @@ -549,7 +549,7 @@ /* Check for an input interrupt while we're here. */ if (buf3[0] == '\003') - (*the_target->send_signal) (SIGINT); + (*the_target->request_interrupt) (); } while (buf3[0] != '+'); @@ -572,7 +572,7 @@ /* Come here when we get an input interrupt from the remote side. This interrupt should only be active while we are waiting for the child to do something. About the only thing that should come through is a ^C, which - will cause us to send a SIGINT to the child. */ + will cause us to request child interruption. */ static void input_interrupt (int unused) @@ -599,7 +599,7 @@ return; } - (*the_target->send_signal) (SIGINT); + (*the_target->request_interrupt) (); } } #endif --------------040800060402020507040805--