public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
* Dwfl Callbacks, how would I pass a ByteBuffer to find_elf (possibly  through user_data).
@ 2007-05-17 18:04 Nurdin
  2007-05-18  7:14 ` Dwfl Callbacks Roland McGrath
  2007-05-18 16:53 ` getting vDSO image into libdwfl Roland McGrath
  0 siblings, 2 replies; 4+ messages in thread
From: Nurdin @ 2007-05-17 18:04 UTC (permalink / raw)
  To: Frysk List

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-05-24 20:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-17 18:04 Dwfl Callbacks, how would I pass a ByteBuffer to find_elf (possibly through user_data) Nurdin
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

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).