From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6030 invoked by alias); 16 May 2008 15:32:00 -0000 Received: (qmail 24627 invoked by uid 22791); 16 May 2008 15:28:35 -0000 X-Spam-Check-By: sourceware.org Received: from qnxmail.qnx.com (HELO nimbus.ott.qnx.com) (209.226.137.76) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 16 May 2008 15:28:16 +0000 Received: from [10.42.100.129] (min.ott.qnx.com [10.42.100.129]) by nimbus.ott.qnx.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id K6WT333G; Fri, 16 May 2008 11:28:11 -0400 Message-ID: <482DA814.7030703@qnx.com> Date: Fri, 16 May 2008 15:32:00 -0000 From: Aleksandar Ristovski User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: gdb@sourceware.org Subject: Frame lost after 'leave' and before 'ret' instruction on i386? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-05/txt/msg00124.txt.bz2 Hello, I noticed that after 'leave' asm instruction (and before 'ret') one frame will be lost (skipped). For example: (gdb) disassemble doSth Dump of assembler code for function doSth: 0x080484f4 : push %ebp 0x080484f5 : mov %esp,%ebp 0x080484f7 : sub $0x8,%esp 0x080484fa : sub $0xc,%esp 0x080484fd : push $0x8048570 0x08048502 : call 0x8048348 0x08048507 : add $0x10,%esp 0x0804850a : leave 0x0804850b : ret End of assembler dump. (gdb) info registers ... eip 0x804850b 0x804850b ... (gdb) bt #0 0x080483c3 in doSth () at main.c:6 #1 0xb7ebffdc in __libc_start_main () from /lib/libc.so.6 #2 0x08048331 in _start () (note 'main' that really made the call is missing... e.g., just before "leave" was executed: (gdb) bt #0 doSth () at main.c:6 #1 0x080483da in main () at main.c:10 ) What happens is, we have restored the stack pointer but gdb is unaware of that fact and tries to unwind using already unwound value... how is this supposed to work?