public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Dov Grobgeld <dov.grobgeld@gmail.com>, Matt Rice <ratmice@gmail.com>
Cc: GDB <gdb@sourceware.org>
Subject: Re: x64 machine code and stack frames
Date: Fri, 22 Jan 2016 10:37:00 -0000	[thread overview]
Message-ID: <56A2064E.6050803@redhat.com> (raw)
In-Reply-To: <CA++fsGGbUyCjnJ8Ff0PmMuSNtre5Jtf5Qb=k4=caFytrj8p4SQ@mail.gmail.com>

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 <ratmice@gmail.com> wrote:
>>
>>
>> On Thu, Jan 21, 2016 at 11:45 AM, Dov Grobgeld <dov.grobgeld@gmail.com>
>> 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

      reply	other threads:[~2016-01-22 10:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-21 19:45 Dov Grobgeld
     [not found] ` <CACTLOFpnvXky3guqoNwcQyxY0c_5AENUpYY2xvo7Yu26Ya=J5g@mail.gmail.com>
2016-01-22  6:47   ` Dov Grobgeld
2016-01-22 10:37     ` Pedro Alves [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56A2064E.6050803@redhat.com \
    --to=palves@redhat.com \
    --cc=dov.grobgeld@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=ratmice@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).