public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
From: Nurdin <npremji@redhat.com>
To: Frysk List <frysk@sourceware.org>
Subject: Dwfl Callbacks, how would I pass a ByteBuffer to find_elf (possibly  through user_data).
Date: Thu, 17 May 2007 18:04:00 -0000	[thread overview]
Message-ID: <464C8E1D.6010007@redhat.com> (raw)

The following depends on the patch in bug:
<http://sourceware.org/bugzilla/show_bug.cgi?id=4513>
Specifically the changes to Dwfl.cxx

The problem I am trying to solve is to get the Dwfl_Callback find_elf:

dwfl_frysk_proc_find_elf (Dwfl_Module *mod __attribute__ ((unused)),
              void **userdata __attribute__ ((unused)),
              const char *module_name, Dwarf_Addr base,
              char **file_name, Elf **elfp)

 to use frysk to read a processes memory rather than reading 
/proc/pid/mem. For the vdso case.

In order to do this I must somehow pass the memory from frysk to the 
callback.
What the callback does currently is store the pid in the Dwfl_Module 
name. (as "[vdso pid]")
and then lookup the /proc/pid/mem. It uses a callback with the signature:

read_proc_memory (void *arg, void *data, GElf_Addr address,
          size_t minread, size_t maxread)

So if I can change the void *arg to refer to a byte buffer rather than a 
file descriptor and just read from the byte buffer I should be one step 
closer to getting procedure names for a stack trace using elfutils.

I think the best way to do this is to pass the byte buffer to the 
callback through the void **userdata field, but I'm unsure as to how to 
set that field.

I have thought about having a member in the Dwfl class to hold the byte 
buffer but since neither the read_proc_memory or 
dwfl_frysk_proc_find_elf callback isn't linked to a java method I can't 
use the "this" keyword.

I've also thought about wrapping the Dwfl_Callback in a 
Frysk_Dwfl_Callback struct which has a bytebuffer as well, but I can't 
reference the callback structure in read_proc_memory or 
dwfl_frysk_proc_find_elf.

             reply	other threads:[~2007-05-17 17:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-17 18:04 Nurdin [this message]
2007-05-18  7:14 ` Dwfl Callbacks Roland McGrath
2007-05-18 16:53 ` getting vDSO image into libdwfl Roland McGrath
2007-05-25 16:50   ` Nurdin

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=464C8E1D.6010007@redhat.com \
    --to=npremji@redhat.com \
    --cc=frysk@sourceware.org \
    /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).