* Elfutils module reporting
@ 2007-07-16 20:05 Nurdin Premji
2007-07-16 20:41 ` Roland McGrath
0 siblings, 1 reply; 4+ messages in thread
From: Nurdin Premji @ 2007-07-16 20:05 UTC (permalink / raw)
To: Roland McGrath, frysk
Roland, I'm trying to refresh dwfl objects in terms of the dwfl_modules.
To optimize code and not create a new dwfl object every time a task changes.
As a first pass I was trying to remove all old modules and re-report new
modules just by using dwfl_report_begin and dwfl_report_end. The
libdwfl.h comments lead me to believe this is all that is necessary to
remove all old modules and report only new modules. I plan to switch to
dwfl_report_begin_add later on and only report modules that have changed.
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.
Looking at the dwfl_module.c file I see that dwfl_report_begin calls
dwfl_report_begin_add, which clears all the modules. I thought that this
function was supposed to preserver all the old modules?
Also how would I go about removing single modules in an updating
scenario? i.e. is there a dwfl_report_remove_module function to link
with dwfl_report_begin_add?
Thank you,
Nurdin.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Elfutils module reporting
2007-07-16 20:05 Elfutils module reporting Nurdin Premji
@ 2007-07-16 20:41 ` Roland McGrath
2007-07-16 22:00 ` Nurdin Premji
0 siblings, 1 reply; 4+ messages in thread
From: Roland McGrath @ 2007-07-16 20:41 UTC (permalink / raw)
To: Nurdin Premji; +Cc: frysk
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Elfutils module reporting
2007-07-16 20:41 ` Roland McGrath
@ 2007-07-16 22:00 ` Nurdin Premji
2007-07-16 22:25 ` Roland McGrath
0 siblings, 1 reply; 4+ messages in thread
From: Nurdin Premji @ 2007-07-16 22:00 UTC (permalink / raw)
To: Roland McGrath; +Cc: frysk
[-- Attachment #1: Type: text/plain, Size: 1441 bytes --]
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.
[-- Attachment #2: dwfltest.c --]
[-- Type: text/x-csrc, Size: 620 bytes --]
#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);
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Elfutils module reporting
2007-07-16 22:00 ` Nurdin Premji
@ 2007-07-16 22:25 ` Roland McGrath
0 siblings, 0 replies; 4+ messages in thread
From: Roland McGrath @ 2007-07-16 22:25 UTC (permalink / raw)
To: Nurdin Premji; +Cc: frysk
I knew there was a reason I wanted a user! ;-)
The reporting interface has never really been used with updates before.
It's a one-line fix.
--- libdwfl/dwfl_module.c 16e7ba3c4f28363c68c66975b4a123da1383e52a
+++ libdwfl/dwfl_module.c dbf8292265056d2e7302f58f09e72dcdac51cf8a
@@ -149,6 +149,7 @@ dwfl_report_module (Dwfl *dwfl, const ch
m->next = *tailp;
m->gc = false;
*tailp = m;
+ ++dwfl->nmodules;
return m;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-07-16 22:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-16 20:05 Elfutils module reporting Nurdin Premji
2007-07-16 20:41 ` Roland McGrath
2007-07-16 22:00 ` Nurdin Premji
2007-07-16 22:25 ` Roland McGrath
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).