This is the mail archive of the
frysk@sourceware.org
mailing list for the frysk project.
Re: Elfutils module reporting
- From: Nurdin Premji <npremji at redhat dot com>
- To: Roland McGrath <roland at redhat dot com>
- Cc: frysk <frysk at sourceware dot org>
- Date: Mon, 16 Jul 2007 18:00:10 -0400
- Subject: Re: Elfutils module reporting
- References: <20070716204031.42CC84D05BE@magilla.localdomain>
Roland McGrath wrote:
The expected pattern is that you do:
dwfl_report_begin
dwfl_report_foo all modules that are in the address space now
dwfl_report_end
i.e., just like with a fresh Dwfl, but dwfl_report_begin instead of dwfl_begin.
This preserves the existing data structures for modules that haven't
changed since before dwfl_report_begin, and removes any old modules that
you didn't report again.
dwfl_report_begin_add is intended for something like gdb's add-symbol-file,
where you are always just adding one new thing as opposed to re-synch'ing
to the new set of mappings after they've changed. It's just a shorthand
and mild optimization for re-reporting all the existing modules after
dwfl_report_begin.
I could add something like a dwfl_report_remove to de-report a reported
module in a reporting loop (which after dwfl_report_begin_add would be
equivalent to removing the preexisting module). But I'd rather exercise
the interface as it stands a bit more before deciding to add a
microoptimization.
I got an assertion failure at the dwfl_report_end stage
/home/yyz/npremji/mainworkspace/frysk/frysk-imports/elfutils/libdwfl/dwfl_module.c:249:
dwfl_report_end: Assertion `i == dwfl->nmodules' failed.
Please send me a small C test program to reproduce this bug.
Thanks,
Roland
Try this. It was tested against elfutils 0.128 in fedora 7.
#include <libdwfl.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
int main()
{
static char *flags = "-:.debug:/usr/lib/debug";
Dwfl_Callbacks *cbs = (Dwfl_Callbacks *) malloc(sizeof (Dwfl_Callbacks));
cbs->find_elf = dwfl_linux_proc_find_elf;
cbs->find_debuginfo = dwfl_standard_find_debuginfo;
cbs->debuginfo_path = &flags;
Dwfl* dwfl = dwfl_begin(cbs);
dwfl_report_begin(dwfl);
dwfl_report_module(dwfl, "module1", 0, 10);
dwfl_report_end(dwfl, NULL, NULL);
dwfl_report_begin(dwfl);
dwfl_report_module(dwfl, "module1", 0, 10);
dwfl_report_end(dwfl, NULL, NULL);
}