From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12260 invoked by alias); 19 May 2010 22:42:07 -0000 Received: (qmail 12251 invoked by uid 22791); 19 May 2010 22:42:05 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_05,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 19 May 2010 22:42:01 +0000 Received: from vapier.localnet (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 1B7551B4003; Wed, 19 May 2010 22:42:00 +0000 (UTC) From: Mike Frysinger To: gdb@sourceware.org Subject: Re: How does gdb deal with bizarre frame descriptions? Date: Wed, 19 May 2010 22:42:00 -0000 User-Agent: KMail/1.13.1 (Linux/2.6.33.2; KDE/4.4.1; x86_64; ; ) Cc: Tom Horsley References: <20100518160554.32fa67fc@tomh.ccur.com> In-Reply-To: <20100518160554.32fa67fc@tomh.ccur.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1429684.6kVlLxadvf"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201005191842.00180.vapier@gentoo.org> 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: 2010-05/txt/msg00058.txt.bz2 --nextPart1429684.6kVlLxadvf Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-length: 1190 On Tuesday 18 May 2010 16:05:54 Tom Horsley wrote: > I've been looking at the frame info for a main program > compiled on ubuntu with g++ (4.4.3), and the frame description > info, both for the eh_frame CFA and the DW_AT_frame_base > attribute is totally bizarre. The frame pointer is described > as being at *(ebp - 16) (for a certain range of addresses). >=20 > If I debug this program with gdb, it seems to get the frame > info correct, and apparently believes the frame pointer > is the ebp register (which seems to make sense if I > disassemble the code). If I look in *(ebp - 16) I see > trash. >=20 > What the devil is gdb doing to get this right? Is it > utterly ignoring the trash generated by the compiler and > deducing the frame description by disassembling the > prologue code or something? >=20 > gdb version: GNU gdb (GDB) 7.1-ubuntu > g++ version: gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) > architecture: i686 look at the frames sections of the gdb internals manual as it describes the= =20 algorithms gdb uses (or rather, the framework gdb has that each arch/port=20 extends). you can also use 'set debug frame 1' to get more insight on the frame=20 construction. -mike --nextPart1429684.6kVlLxadvf Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. Content-length: 836 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) iQIcBAABAgAGBQJL9Gk4AAoJEEFjO5/oN/WBq9MQAKNnQnw5PMTbUOPPk7jujgav cUaaegbzNBiK4R4+HcE+Kg99vdQ1ttPiO5ZVfKi+h6+tB4XsMwACOpexfx0ISnmM 5Rgp9KvoVTT6Q/pQR2Bt3C0H7HW82VHSIl9vnXaMvssm5IRE5jZC13mXzIHepkG7 M60SNgbdn14XNqvsNtH0Zmsryzy2f6T7cRyqnBe/1lVk6fQGU9/qPduoT/cHQU/a qAjY99mzxL+KbnWuL/5Ad0WGf0ieTua2Ljq1oibF3NOMUyXgsIiPncgiqVWlZpMG PbX8SaL7Vu2kJtaEWSgA9tI3oGCbZhidXdvAOkyE2c+Nnl9NOhBi32Zn6WVa4L5D P8f75XBRhx653v8Ra/whFO9pY4+YLT/TjNWrG0ObP/2DAtiX3hYUiSbyg4G2oww7 lTnunGzPc/7LL/t8Z/z7Y8Ppf3Aocl3gU8EQd4aWODAlLpx8uppHp9TqDXOGigrM muDwC397wgUOPyblXDED2t/u83iOSkosu6RyF4XdBokssm6z3tKaQEpezenD0Iq7 s5DhMihxjZa1VKpAUf/GIjtKxrkbQqlZvIrAVizgNqTpPh6Uk+YE7qlUednYYmeT aHo4kA4k36TZMaCYli1ijiCkZ+jRQpOkNOgdUs1AaRpDmfNN4c4cakvCOmrX9/gm AOeApS3JZ8RVshkgDNIW =3u6x -----END PGP SIGNATURE----- --nextPart1429684.6kVlLxadvf--