[Crash-utility] [PATCH] Use /usr/bin/nm -D
Dave Anderson
anderson at redhat.com
Mon Aug 25 15:25:58 UTC 2008
----- "Bernhard Walle" <bwalle at suse.de> wrote:
> * Dave Anderson [2008-08-25 09:27]:
> >
> >
> > Unfortunately on an unstripped version, it drops all ~3000 ' t '
> symbols and
> > only dumps type 'T' symbols. Probably it should run -Bn first, or
> recognize
> > otherwise that it's been stripped, and if it dumps no symbols,
> [re]try it
> > with -DBn?
>
> Ah, ok, I just checked with running crash that the output still
> works,
> but did not compare nm and nm -D.
>
> What about the new patch?
>
Hmmm, seems to be a of a lot of work for something that could be
done in just a few lines? Since the first -Bn attempt with fd 2
redirected to /dev/null returns nothing to fgets(), how about just
recognizing that, rewriting the command string, and continue?
Something like:
- sprintf(buf, "/usr/bin/nm -Bn %s, thisfile);
+ sprintf(buf, "/usr/bin/nm -Bn %s 2> /dev/null", thisfile);
if (!(pipe = popen(buf, "r"))) {
perror("pipe");
break;
}
+ if (!(fgets(buf, 80, pipe)))
+ pclose(pipe);
+ sprintf(buf, "/usr/bin/nm -DBn %s", thisfile);
+ if (!(pipe = popen(buf, "r"))) {
+ perror("pipe");
+ break;
+ }
+ }
last_vaddr = 0;
BZERO(symbol, BUFSIZE);
It probably could be made even simpler than that if a quick-and-dirty
pre-examination of thisfile could be done to determine whether it's
stripped or not?
Dave
More information about the Crash-utility
mailing list