From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17193 invoked by alias); 31 Aug 2010 20:24:59 -0000 Received: (qmail 16985 invoked by uid 22791); 31 Aug 2010 20:24:45 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,TW_CP,TW_NX,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 31 Aug 2010 20:24:40 +0000 Received: (qmail 12457 invoked from network); 31 Aug 2010 20:24:39 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 31 Aug 2010 20:24:39 -0000 From: Pedro Alves To: Joel Brobecker Subject: Re: [RFA 3/3] gdbserver support for powerpc-lynxos (4.x) Date: Tue, 31 Aug 2010 20:24:00 -0000 User-Agent: KMail/1.13.2 (Linux/2.6.33-29-realtime; KDE/4.4.2; x86_64; ; ) Cc: gdb-patches@sourceware.org References: <1277315177-17869-1-git-send-email-brobecker@adacore.com> <201007271713.22677.pedro@codesourcery.com> <20100831193731.GN2986@adacore.com> In-Reply-To: <20100831193731.GN2986@adacore.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201008312124.37086.pedro@codesourcery.com> 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: 2010-08/txt/msg00576.txt.bz2 On Tuesday 31 August 2010 20:37:31, Joel Brobecker wrote: > Note that I'm adding a new varialble "srv_extra_libs" in configure.srv. > I need this because I need to link against -linet. Perhaps the right way > of doing things might have been to use a configure check... I think this comment is stale. > + status->kind = TARGET_WAITKIND_EXITED; > + status->value.integer = target_signal_from_host (WEXITSTATUS (wstat)); This target_signal_from_host call is wrong here. The program's exit status is not a signal (see gdb/target.c:store_waitstatus). > + /* SIGTRAP events are generated for situations other than single-step/ > + breakpoint events (Eg. new-thread events). Handle those other types > + of events, and resume the execution if necessary. */ > + if (status->kind == TARGET_WAITKIND_STOPPED > + && status->value.integer == target_signal_from_host (SIGTRAP)) Just write TARGET_SIGNAL_TRAP. > +static int > +lynx_kill (int pid) > +{ > + ptid_t ptid = lynx_ptid_build (pid, 0); > + struct target_waitstatus status; > + > + lynx_ptrace (PTRACE_KILL, ptid, 0, 0, 0); > + lynx_wait (ptid, &status, 0); > + return 0; > +} Should call the_target->mourn (process); > +/* Implement the detach target_ops method. */ > + > +static int > +lynx_detach (int pid) > +{ > + ptid_t ptid = lynx_ptid_build (pid, 0); > + > + lynx_ptrace (PTRACE_DETACH, ptid, 0, 0, 0); > + return 0; > +} Should call the_target->mourn (process); > + buf = lynx_ptrace (PTRACE_PEEKTEXT, inferior_ptid, addr, 0, 0); > + if (errno) > + return errno; lynx_ptrace is not taking care of preserving the errno set by the ptrace call: > + result = ptrace (request, pid, addr, data, addr2); > + if (debug_threads) > + printf (" -> %d (=0x%x)\n", result, result); > + > + return result; > +} ... that printf call clobbers errno when debug_threads is on. And you should use "fprintf (stderr, " for debug output throughout. > + memcpy (myaddr + (addr - memaddr) + skip, (gdb_byte *)&buf + skip, You should have a space after the cast (there are more instances of this). Other than that it looks fine to me. -- Pedro Alves