Re: [DynInst_API:] Static Library Name as parent module of called function


Date: Tue, 12 Jul 2016 13:31:45 -0500
From: Bill Williams <bill@xxxxxxxxxxx>
Subject: Re: [DynInst_API:] Static Library Name as parent module of called function
On 07/12/2016 01:00 PM, Manoj Kumar wrote:
Hello Bill,

Thanks for your response. As suggested, I have tried the following code to retrieve the name of all the BPatch_object instances in BPatch_image.
.
Here, MyLibText.exe (windows binary) is linked with static library "TestLib.Lib"

ÂBPatch_image* image = LoadBinary("D:\\MyLibTest\\Debug\\MyLibTest.exe");
Âstd::vector<BPatch_object *> objs;
Âimage->getObjects(objs);
Âstd::vector<BPatch_object *>::iterator itr_obj = objs.begin();
Âwhile ( itr_obj != objs.end() )
Â{
ÂÂBPatch_object* bp = (*itr_obj);
ÂÂstd::string obj_name = bp->name();
ÂÂitr_obj++;
Â}

This code prints the name of only one object name which is "MyLibTest.exe". Static Library name is not printed. As a result, static library function call can not be mapped to its parent module as "TestLib.Lib".Â

Is there anything missed out? or Do I need to upgrade my Dyninst SDK from 9.0.3 to latest version 9.2 toÂretrieve the parent object name (TestLib.LIB) of static library function call?

Ah. Once something is statically linked, there's no longer a separate BPatch_object for it. I don't think, off the top of my head, that information is recoverable from either ELF or PE, though it might be in the debug information of either. I'll do some digging and get back to you, but that part is working as intended--BPatch_object corresponds to a single executable/shared object on disk, with the set of BPatch_objects corresponding to the set of files mapped into the address space.

If it's possible to recover the intermediate level information of the static library that was linked in to provide some set of object files (BPatch_modules), making that visible is not hard technically; it just requires some interface thought.

--bw

Thanks
Kumar


On Tue, Jul 12, 2016 at 9:56 PM, Bill Williams <bill@xxxxxxxxxxx> wrote:
On 07/12/2016 11:18 AM, Manoj Kumar wrote:
Hello,

I am using DynInst 9.0.3 to do static analysis of windows PE format to extract the function calls. On analyzing the function call of static library line windows binary, I found that module name returned as the source file name from static library not the name of the static library itself as xyz.lib. Is there anyway to know the name of the static library as the parent of the called function using Dyninsy API.

You want the BPatch_object, not the BPatch_module; this was one of the API changes from Dyninst 8 to Dyninst 9.
Thanks for your help.

Thanks
M. Kumar


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


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


[← Prev in Thread] Current Thread [Next in Thread→]