From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28014 invoked by alias); 13 Feb 2003 17:02:14 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 27994 invoked from network); 13 Feb 2003 17:02:13 -0000 Received: from unknown (HELO serdis.dis.ulpgc.es) (193.145.145.17) by 172.16.49.205 with SMTP; 13 Feb 2003 17:02:13 -0000 Received: from siglo21.dis.ulpgc.es (IDENT:root@siglo21.dis.ulpgc.es [193.145.145.16]) by serdis.dis.ulpgc.es (8.10.2/8.9.2) with ESMTP id h1DHDdY15193; Thu, 13 Feb 2003 17:13:40 GMT Received: (from nobody@localhost) by siglo21.dis.ulpgc.es (8.11.6/8.9.3) id h1DHvbE01132; Thu, 13 Feb 2003 17:57:37 GMT Date: Thu, 13 Feb 2003 17:02:00 -0000 Message-Id: <200302131757.h1DHvbE01132@siglo21.dis.ulpgc.es> X-Authentication-Warning: siglo21.dis.ulpgc.es: nobody set sender to a2782@dis.ulpgc.es using -f From: a2782@dis.ulpgc.es To: gdb@sources.redhat.com, a2782@dis.ulpgc.es Reply-To: a2782@dis.ulpgc.es MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit User-Agent: IMP/PHP3 Imap webMail Program 2.0.11 Subject: Problems in the edge of functions X-SW-Source: 2003-02/txt/msg00211.txt.bz2 Hi to all! I\'m using GDB to design a didactic graphic environment over it (as DDD). But I have found that, when I put a breakpoint in the first machine instruction of a function (push %ebp) and I ask the debugger for the information of the frames, GDB \"lies\". An example: void foo() <-- breakpoint { int b = 2; } int main() { int a = 10; foo(); } (in i386 code: .globl foo foo: pushl %ebp <-- breakpoint movl %esp, %ebp subl $8, %esp movl $2, -4(%ebp) leave ret .globl main main: pushl %ebp movl %esp, %ebp subl $24, %esp movl $10, -4(%ebp) call foo leave ret ) If I type \"info locals\" when the program stops in the breakpoint, GDB returns: \"b = 10\" (it should return \"b = 14726457264\"). It\'s evident that GDB is looking in the position where it thinks that \'b\' should be (but in this position we find \'a\'). The reason why this occurs is that the stack has not been updated (the stack updates with the instructions \'mov %esp, %ebp\', and \'subl $8, %esp\', but they haven\'t been executed). However, if I type \'x /1wx 0x0bfff...\' and \'info registers\', I\'ll be able to discover the real state of the stack. There\'s a similar problem with the instruction \'leave\'. My question is: is this a bug? Or is there a way of solving it? Thanks in advance!