From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24588 invoked by alias); 30 May 2008 15:33:59 -0000 Received: (qmail 24579 invoked by uid 22791); 30 May 2008 15:33:58 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 30 May 2008 15:33:41 +0000 Received: from brahms.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by brahms.sibelius.xs4all.nl (8.14.3/8.14.3) with ESMTP id m4UFWGnj009759; Fri, 30 May 2008 17:32:16 +0200 (CEST) Received: (from kettenis@localhost) by brahms.sibelius.xs4all.nl (8.14.3/8.14.3/Submit) id m4UFWGBv003126; Fri, 30 May 2008 17:32:16 +0200 (CEST) Date: Sat, 31 May 2008 23:40:00 -0000 Message-Id: <200805301532.m4UFWGBv003126@brahms.sibelius.xs4all.nl> From: Mark Kettenis To: muller@ics.u-strasbg.fr CC: pedro@codesourcery.com, drow@false.org, gdb-patches@sourceware.org In-reply-to: <001901c8c256$06f8be00$14ea3a00$@u-strasbg.fr> (muller@ics.u-strasbg.fr) Subject: Re: [PING2] : [RFC/RFA] PING: skip __main References: <004f01c8ac58$06a1ddb0$13e59910$@u-strasbg.fr> <000c01c8c246$de300f50$9a902df0$@u-strasbg.fr> <200805301157.m4UBvOL5009408@brahms.sibelius.xs4all.nl> <001901c8c256$06f8be00$14ea3a00$@u-strasbg.fr> 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/msg00777.txt.bz2 > From: "Pierre Muller" > Date: Fri, 30 May 2008 15:06:51 +0200 > > > 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? Actually, I think it is. The functionality can be used for other prologue skipping that's not really related to constructors as well. > > 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? Please remove the blank line before the "struct minimal_symbol *s" declaration. > +/* 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; > +} > +