From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1430 invoked by alias); 10 Dec 2007 17:31:42 -0000 Received: (qmail 1379 invoked by uid 22791); 10 Dec 2007 17:31:42 -0000 X-Spam-Check-By: sourceware.org Received: from nf-out-0910.google.com (HELO nf-out-0910.google.com) (64.233.182.188) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 10 Dec 2007 17:31:38 +0000 Received: by nf-out-0910.google.com with SMTP id b11so1159915nfh for ; Mon, 10 Dec 2007 09:31:35 -0800 (PST) Received: by 10.86.33.10 with SMTP id g10mr5762541fgg.1197307895774; Mon, 10 Dec 2007 09:31:35 -0800 (PST) Received: by 10.86.86.9 with HTTP; Mon, 10 Dec 2007 09:31:35 -0800 (PST) Message-ID: <4053daab0712100931yb44d6e4m51ab3072f1406187@mail.gmail.com> Date: Mon, 10 Dec 2007 17:37: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: 1c72cf0f676d67e8 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/msg00154.txt.bz2 Hi Pierre, Pierre Muller wrote: > I had troubles when trying to backtrace > when the debugge was stopped > inside the windows DLL's. > > After some investigation, I > found out that many exported routines > from the Microsoft operating system > start with a no-op assembler instruction > 'mov %edi,%edi'. That's placed there for hot patching, together with 5 bytes of slack before the function (the idea is to be able to replace that 2 byte op with a jump to 5 bytes back, and patch the 5 bytes with a jump into anywhere in the 32-bit address space.) Something like: nop | nop | nop | hot patching nop | support nop | mov %edi,%edi | <-- function start -----------------------------------+ push %ebp | mov %esp,%ebp | frame setup sub $0x18,%esp | locals, ... Could you add a comment explaining that as well? > The main question is whether this patch is acceptable > for gdb as it is in a i386 common file, while > it most probably only applies to MS operating system. > > The problem is that I found no other location where > this could be done, but maybe someone in the list > has a better overview and a good idea where to put that. > You can put a flag in i386's gdbarch_tdep (look in i386-tdep.h, and i386-cygwin-tdep.c). -- Pedro Alves