Re: [DynInst_API:] ParseAPI and PE files


Date: Thu, 17 Apr 2014 10:40:23 -0500
From: Bill Williams <bill@xxxxxxxxxxx>
Subject: Re: [DynInst_API:] ParseAPI and PE files
On 04/16/2014 06:13 AM, E.Robbins wrote:
Hi,
we are trying to use the ParseAPI with PE files. Even with the simple example in the ParseAPI manual, we get an error:

[SymtabCodeSource.C] FATAL: can't create Symtab object for file <executable name>

It appears that the SymtabCodeSource does not like PE files. Is this a known issue, and/or is there a work around?

Ed--

Not only is this not a known issue, but it's known to work--the SymtabCodeSource is used internally by Dyninst for all of its parsing, and Windows isn't *that* broken. (At least not if you're working from any remotely stable point, it's not.)

I've been seeing issues with path names with some frequency, though; Symtab will open paths of the standard drive-letter form. Both the \\device\whatever and the cygwin forms do not get converted automatically, and that can prevent Symtab from opening a file.

If <executable name> is in drive-letter form, absolute path, exists, permissions are good, etc, then this merits further investigation. Are you working on 8.1.2, master, the 8.2 branch...?

Oh. One other thing--if you're trying to analyze PE files on Linux, that's not presently going to work. It might be possible, if you have a Linux system with the necessary Windows headers present and you know of a replacement for the debug SDK, to coerce a Linux build of Symtab to speak PE. You could probably pull the text section out via objdump or similar and stuff it into a fake ELF file. I think I also have an memory-backed CodeSource implementation floating around somewhere that you could use as a starting point--as long as you can find the text section and either don't care about symbols or can find them without Windows headers, mocking up a CodeSource that speaks PE on Linux is a simple matter of engineering. It's engineering we haven't done because parsing PE on Linux is not of much use to Dyninst without a *very* full-featured cross-format Symtab backing it, such that we could rewrite PE files on Linux.

Thanks,
Ed
_______________________________________________
Dyninst-api mailing list
Dyninst-api@xxxxxxxxxxx
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api



--
--bw

Bill Williams
Paradyn Project
bill@xxxxxxxxxxx
[← Prev in Thread] Current Thread [Next in Thread→]