From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 49696 invoked by alias); 22 Jan 2016 10:37:07 -0000 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 Received: (qmail 49675 invoked by uid 89); 22 Jan 2016 10:37:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=ratmicegmailcom, ratmice@gmail.com, dovgrobgeldgmailcom, dov.grobgeld@gmail.com X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 22 Jan 2016 10:37:05 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 66FFC3B75A; Fri, 22 Jan 2016 10:37:04 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0MAb2QN012042; Fri, 22 Jan 2016 05:37:03 -0500 Message-ID: <56A2064E.6050803@redhat.com> Date: Fri, 22 Jan 2016 10:37:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Dov Grobgeld , Matt Rice CC: GDB Subject: Re: x64 machine code and stack frames References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-01/txt/msg00048.txt.bz2 On 01/22/2016 06:46 AM, Dov Grobgeld wrote: > Thanks. Indeed it sounds like the right direction. I have to figure > out how it works in a mixed environment with both static DWARF based > code as well as dynamically allocated code. > > On Fri, Jan 22, 2016 at 4:27 AM, Matt Rice wrote: >> >> >> On Thu, Jan 21, 2016 at 11:45 AM, Dov Grobgeld >> wrote: >>> >>> Hello, >>> >>> I've inherited some clever x64 machine code for linux that creates an >>> machine code wrapper around a c-function call. I guess that in higher >>> language terms the code might be called a decorator or a closure. The >>> code is functioning well, but with the unfortunate artifact that when >>> the wrapper is called, it gobbles the stack trace in gdb. >>> >>> From what I have learned from the net gdb uses >>> https://en.wikipedia.org/wiki/DWARF as a guide for separating the >>> stack frames in the stack. This works well for static code, but >>> obviously code generated and called at run time isn't registered in >>> the DWARF framework. >>> >>> My question is if there is any way to rescue the stack trace in this >>> situation? >> >> >> While i haven't really used it before & can't comment on the particulars, >> It sounds like you should be using the jit interface to make gdb aware of >> the symbols generated at runtime. >> >> https://sourceware.org/gdb/onlinedocs/gdb/JIT-Interface.html And for unwinding itself, the new Python unwinder API is something to look at too, if you want to try to avoid DWARF: https://sourceware.org/gdb/current/onlinedocs/gdb/Unwinding-Frames-in-Python.html Thanks, Pedro Alves