From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25112 invoked by alias); 10 Dec 2007 18:08:38 -0000 Received: (qmail 25100 invoked by uid 22791); 10 Dec 2007 18:08:36 -0000 X-Spam-Check-By: sourceware.org Received: from ug-out-1314.google.com (HELO ug-out-1314.google.com) (66.249.92.172) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 10 Dec 2007 18:08:32 +0000 Received: by ug-out-1314.google.com with SMTP id h2so3311841ugf for ; Mon, 10 Dec 2007 10:08:30 -0800 (PST) Received: by 10.86.61.13 with SMTP id j13mr492169fga.1197310110049; Mon, 10 Dec 2007 10:08:30 -0800 (PST) Received: by 10.86.86.9 with HTTP; Mon, 10 Dec 2007 10:08:30 -0800 (PST) Message-ID: <4053daab0712101008o5fd3fdbcuf565761652f23c0d@mail.gmail.com> Date: Mon, 10 Dec 2007 18:41:00 -0000 From: "Pedro Alves" To: "Pierre Muller" Subject: Re: [RFC] Enhance backtrace for microsoft system DLL calls Cc: gdb-patches@sourceware.org In-Reply-To: <000001c83b4a$573b4560$05b1d020$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <000001c83b4a$573b4560$05b1d020$@u-strasbg.fr> X-Google-Sender-Auth: 1c604ca3c92b319f 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-12/txt/msg00156.txt.bz2 > @@ -650,6 +650,17 @@ i386_analyze_frame_setup (CORE_ADDR pc, > > read_memory_nobpt (pc, &op, 1); > > + if (op == 0x8b) /* Ignore no-op instruction `mov %edi, %edi' */ > + { > + read_memory_nobpt (pc + 1, &op, 1); > + if (op == 0xff) > + { > + pc += 2; > + read_memory_nobpt (pc, &op, 1); > + } > + else > + op = 0x8b; > + } > if (op == 0x55) /* pushl %ebp */ > { > /* Take into account that we've executed the `pushl %ebp' that > > > Oh, I forgot to ask on the previous mail -- Is there a reason you don't read both bytes in one go? /* small hot patching description here. */ gdb_byte hot_patch[2] = { 0x8b, 0xff }; read_memory_nobpt (pc, buf, 2); if (memcmp (hot_patch, buf) == 0) pc += 2; read_memory_nobpt (pc, &op, 1); if (op == 0x55) /* pushl %ebp */ ... and since this isn't really frame setup code, it could be moved into a separate function called from i386_analyze_prologue, probably even before i386_follow_jump, as this is put really at the start of the function -- Pedro Alves