From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21922 invoked by alias); 30 May 2008 13:07:20 -0000 Received: (qmail 21382 invoked by uid 22791); 30 May 2008 13:07:18 -0000 X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.154) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 30 May 2008 13:06:59 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.2/jtpda-5.5pre1) with ESMTP id m4UD6oim063334 ; Fri, 30 May 2008 15:06:51 +0200 (CEST) Received: from mailserver.u-strasbg.fr (ms2.u-strasbg.fr [IPv6:2001:660:2402::142]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id m4UD6o0L079054 ; Fri, 30 May 2008 15:06:50 +0200 (CEST) Received: from d620muller (laocoon.u-strasbg.fr [130.79.112.72]) by mailserver.u-strasbg.fr (8.13.8/jtpda-5.5pre1) with ESMTP id m4UD6lkK093242 ; Fri, 30 May 2008 15:06:50 +0200 (CEST) From: "Pierre Muller" To: "'Mark Kettenis'" Cc: , , References: <004f01c8ac58$06a1ddb0$13e59910$@u-strasbg.fr> <000c01c8c246$de300f50$9a902df0$@u-strasbg.fr> <200805301157.m4UBvOL5009408@brahms.sibelius.xs4all.nl> In-Reply-To: <200805301157.m4UBvOL5009408@brahms.sibelius.xs4all.nl> Subject: RE: [PING2] : [RFC/RFA] PING: skip __main Date: Fri, 30 May 2008 18:18:00 -0000 Message-ID: <001901c8c256$06f8be00$14ea3a00$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Content-Language: en-us X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (mailhost.u-strasbg.fr [IPv6:2001:660:2402::154]); Fri, 30 May 2008 15:06:51 +0200 (CEST) X-Virus-Status: Clean 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: 2008-05/txt/msg00771.txt.bz2 Thanks for the fast reply. > I'm afraid I think that skip_main_constructor_call is too long as a name. I am perfectly willing to use something shorter, the only problem is to find something that would still be of clear meaning. maybe skip_main_prologue would be better? > I'd also appreciate it if you could seperate local variable > declarations from the stations that follow by a blank line. Otherwise > this looks ok to me. Does this apply to both uninitialized and initialized variables? Would the code hereafter be correct, or did I add too many empty lines? +/* Check that the code pointed to by PC corresponds to a call to + __main, skip it if so. Return PC otherwise. */ + +CORE_ADDR +i386_skip_main_constructor_call (struct gdbarch *gdbarch, CORE_ADDR pc) +{ + gdb_byte op; + + target_read_memory (pc, &op, 1); + if (op == 0xe8) + { + gdb_byte buf[4]; + + if (target_read_memory (pc + 1, buf, sizeof buf) == 0) + { + CORE_ADDR call_dest = pc + 5 + extract_unsigned_integer (buf, 4); + + struct minimal_symbol *s = lookup_minimal_symbol_by_pc (call_dest); + + if (s != NULL + && SYMBOL_LINKAGE_NAME (s) != NULL + && strcmp (SYMBOL_LINKAGE_NAME (s), "__main") == 0) + pc += 5; + } + } + + return pc; +} + Thanks again for the reply. Pierre Muller Pascal language support maintainer for GDB