From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8393 invoked by alias); 30 May 2008 14:47:05 -0000 Received: (qmail 8373 invoked by uid 22791); 30 May 2008 14:47:04 -0000 X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.157) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 30 May 2008 14:46:44 +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 m4UEkaIQ088309 ; Fri, 30 May 2008 16:46:36 +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 m4UEkanZ073895 ; Fri, 30 May 2008 16:46:36 +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 m4UEkNtU035745 ; Fri, 30 May 2008 16:46:36 +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> <001901c8c256$06f8be00$14ea3a00$@u-strasbg.fr> In-Reply-To: <001901c8c256$06f8be00$14ea3a00$@u-strasbg.fr> Subject: RE: [PING2] : [RFC/RFA] PING: skip __main Date: Fri, 30 May 2008 18:45:00 -0000 Message-ID: <001a01c8c263$f493b1d0$ddbb1570$@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::157]); Fri, 30 May 2008 16:46:36 +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/msg00772.txt.bz2 + 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); Just one small question about this line: I fear that this line is incorrect, shouldn't we use extract_signed_integer here? The address is relative to pc+5 meaning that if main is at a higher address than __main, buf will contain a negative 4byte integer. This will usually not matter (if overflows are allowed), unless CORE_ADDR is 8-byte long, which would then give a value above 0xffffffff. This can happen for cross configured gdb, but also if gdb is configured with --enable-64bit-bfd. I don't even know if these result would be always correct (assuming for instance that main is below __main, but that __main resides above 0x80000000 boundary for example). Maybe the only correct way is to force the operation to be performed with 4-byte integers and take the result, even if overflow occurred. Pierre Muller Pascal language support maintainer for GDB