Hi Bill,

The backtrace info is as follows:

#0  Dyninst::PatchAPI::AddrSpace::findObject (this=0x0, co=0x8071648)
    at /home/tad/Desktop/Dyninst/Dyninst-8.2.1/patchAPI/src/AddrSpace.C:104
#1  0xb7e18deb in Dyninst::PatchAPI::PatchParseCallback::add_edge_cb (
    this=0x8089890, block=0x8087708, edge=0x8082958,
    type=Dyninst::ParseAPI::ParseCallback::target)
    at
/home/tad/Desktop/Dyninst/Dyninst-8.2.1/patchAPI/src/ParseCallback.C:148
#2  0xb7e7cfb3 in add_edge_cb (t=Dyninst::ParseAPI::ParseCallback::target,
    e=0x8082958, b=0x8087708, this=0x8075c78)
    at
/home/tad/Desktop/Dyninst/Dyninst-8.2.1/parseAPI/src/ParseCallback.C:254
#3  Dyninst::ParseAPI::ParseCallbackManager::addEdge (this=0x8075c78,
    b=0x8087708, e=0x8082958, t=Dyninst::ParseAPI::ParseCallback::target)
    at
/home/tad/Desktop/Dyninst/Dyninst-8.2.1/parseAPI/src/ParseCallback.C:147
#4  0xb7e5e9fe in Dyninst::ParseAPI::Parser::link (this=0x8074f20,
    src=0x8087708, dst=0x80875c0, et=Dyninst::ParseAPI::RET, sink=false)
    at /home/tad/Desktop/Dyninst/Dyninst-8.2.1/parseAPI/src/Parser.C:1720
#5  0xb7e744b9 in Dyninst::ParseAPI::CodeObject::add_edge (this=0x8071648,
    src=0x8087708, trg=0x80875c0, et=Dyninst::ParseAPI::RET)
    at /home/tad/Desktop/Dyninst/Dyninst-8.2.1/parseAPI/src/CodeObject.C:184
#6  0xb7e6d4a6 in Dyninst::ParseAPI::Function::delayed_link_return (
    this=0x8076088, o=0x8071648, retblk=0x8087708)
    at /home/tad/Desktop/Dyninst/Dyninst-8.2.1/parseAPI/src/Function.C:358
#7  0xb7e6dc80 in Dyninst::ParseAPI::Function::blocks_int (this=0x8076088)
    at /home/tad/Desktop/Dyninst/Dyninst-8.2.1/parseAPI/src/Function.C:306
---Type <return> to continue, or q <return> to quit---
#8  0xb7e65843 in Dyninst::ParseAPI::Parser::finalize (this=0x8074f20,
    f=0x8076088)
    at /home/tad/Desktop/Dyninst/Dyninst-8.2.1/parseAPI/src/Parser.C:653
#9  0xb7e6c87e in Dyninst::ParseAPI::Function::finalize (this=0x8076088)
    at /home/tad/Desktop/Dyninst/Dyninst-8.2.1/parseAPI/src/Function.C:184
#10 0xb7e063e8 in num_blocks (this=0x8076088)
    at /home/tad/Desktop/Dyninst/Dyninst-8.2.1/parseAPI/h/CFG.h:489
#11 Dyninst::PatchAPI::PatchFunction::blocks (this=0x808b270)
    at
/home/tad/Desktop/Dyninst/Dyninst-8.2.1/patchAPI/src/PatchFunction.C:54
#12 0x0804915f in main ()

On Wed, Mar 11, 2015 at 12:00 PM, Bill Williams <[email protected]> wrote:

> On 03/10/2015 08:26 PM, Donghai wrote:
>
>> Hi,
>>
>> I use a very simple program to test the first example of PatchAPI.
>>
>> Unfortunately, the dyninst gets crash on this example. More
>>
>> specifically, func->blocks() cause the system segment fault.
>>
>> The code is pasted as follows, can someone give me some hint?
>>
>> Thanks.
>>
>>  Can you send us a stack trace from gdb of the fault?
>
> It seems likely that some of our parseAPI optimizations are not playing
> nicely with this example, and that we're assuming data structures are
> populated before they actually are. If adding co->parse() before you create
> the PatchObject eliminates the crash, that's a good way to check whether
> we're being inappropriately lazy.
>
>
>> Best
>> Hai
>>
>> ParseAPI::SymtabCodeSource *sts;
>> ParseAPI::CodeObject *co;
>> Address code_base = 0x8048000;
>>
>> sts = new ParseAPI::SymtabCodeSource( argv[1] );
>> co = new ParseAPI::CodeObject( sts );
>>
>> PatchObject *obj = PatchObject::create(co, code_base);
>>
>> // Find all functions in the object
>> std::vector<PatchFunction*> all;
>> obj->funcs(back_inserter(all));
>>
>> for (std::vector<PatchFunction*>::iterator fi = all.begin();
>>       fi != all.end(); fi++) {
>>    // Print out each function's name
>>    PatchFunction* func = *fi;
>>    std::cout << func->name() << std::endl;
>>
>>    const PatchFunction::Blockset& blks = func->blocks();
>>    for (PatchFunction::BlockSet::iterator bi = blks.begin();
>>         bi != blks.end(); bi++) {
>>      // Print out each block's size
>>      PatchBlock* blk = *bi;
>>      std::cout << "\tBlock size:" << blk->size() << std::endl;
>>    }
>> }
>>
>>
>> _______________________________________________
>> Dyninst-api mailing list
>> [email protected]
>> https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api
>>
>>
>
> --
> --bw
>
> Bill Williams
> Paradyn Project
> [email protected]
> _______________________________________________
> Dyninst-api mailing list
> [email protected]
> https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api
>
_______________________________________________
Dyninst-api mailing list
[email protected]
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api

Reply via email to