Hi Girish,

girish.prabhakarrao at wipro.com wrote:
> Hi,
>
> Thanks!!!
>
> Question2. How do get the CTF Info into object files. Will compilation
> with "-g" help??
>   
You'll have to look for how ctfmerge/ctfconvert is used to build,
for instance, the kernel.  You might try google for ctfmerge,
someone might have written a little "how to".

To use dbx, use "-g" on compilation.
Then, you can look at core or running process, or run the app
from within dbx.  For example, to run the app from within dbx,

$ dbx a.out
(dbx) stop at 15   <-- breakpoint at line 15 in the source that build a.out
(2) stop at "foo.c":15
(dbx) run   <-- run a.out
Running: a.out
(process id 1700)
stopped in main at line 15 in file "foo.c"   <-- breakpoint hit
   15       pause();
(dbx) print foo  <-- print the "foo" structure
foo = {
    a = 10
    b = 20
    c = 30
}
(dbx) quit
$ cat foo.c
struct f {
    int a;
    int b;
    int c;
};

struct f foo;

main()
{
    foo.a = 10;
    foo.b = 20;
    foo.c = 30;
    pause();
}

I recommend trying dbx and typing "help".  Most of it is simple,
and not so different from gdb.  Hope that helps.

max

> I am not familiar with dbx I managed to load the source file and the
> core in dbx. 
> I guess I will need to go through the documentation to understand and
> use this? Any quick references :-).
>
> -----Original Message-----
> From: max at bruningsystems.com [mailto:max at bruningsystems.com] 
> Sent: Tuesday, January 13, 2009 1:50 PM
> To: Girish Prabhakarrao (WT01 - Telecom Equipment)
> Cc: mdb-discuss at opensolaris.org
> Subject: Re: [mdb-discuss] help find leaks using purify and mdb???
>
> Hi Girish,
>
> girish.prabhakarrao at wipro.com wrote:
>   
>> Hi,
>>
>> I am trying to fix leaks in my C++ app code.
>>
>> Purify reports the following
>>
>> " MLK: 12800 bytes leaked in 4 blocks
>>
>> This memory was allocated from:
>>
>> malloc [rtlib.o]
>>
>> c2n6Fi_Pv___1 [libCrun.so.1]
>>
>> void*operator new(unsigned) [rtlib.o]
>>
>> MyMethod * ctrRef;
>>
>> => ctrRef = new MyMethod( argstoThread );
>>
>> Block of 3200 bytes (4 times); last block at 0x2d7518
>>
>>
>> I generated a core file by using a gcore and ran a dis command. My 
>> intention is to find out what is the data structure which is not 
>> getting deleted.
>>
>> However I am unable to figure out the structure. Any pointers??????
>>
>> What does illtrap mean?
>>
>>     
>>> * 0x2d7518::dis*
>>>       
>> 0x2d74f0: 0xa5ff53f1
>>
>> 0x2d74f4: illtrap 0xc80
>>
>>     
> The address you are looking at here (0x2d7518) is not code. I don't know
> purify, but I suspect this is the address of a block of data that has 
> not been freed.
> Based on the output above from purify, I suspect MyMethod structures
> are not getting freed. If you have CTF info in the object file, you
> should
> be able to do:
>
> 2d7518::print MyMethod
>
> to print out the data structure. If this doesn't work, maybe try looking
>
> at the dump with
> dbx. If that doesn't work, in mdb use
>
> 2d7518,10/X
>
> And look at the output and match it up with the MyMethod structure. 
> illtrap is not
> (generally) a valid instruction. As far as leaks are concerned, where is
>
> ctrRef deleted
> in the code?
>
> max
>
>
> Please do not print this email unless it is absolutely necessary. 
>
> The information contained in this electronic message and any attachments to 
> this message are intended for the exclusive use of the addressee(s) and may 
> contain proprietary, confidential or privileged information. If you are not 
> the intended recipient, you should not disseminate, distribute or copy this 
> e-mail. Please notify the sender immediately and destroy all copies of this 
> message and any attachments. 
>
> WARNING: Computer viruses can be transmitted via email. The recipient should 
> check this email and any attachments for the presence of viruses. The company 
> accepts no liability for any damage caused by any virus transmitted by this 
> email. 
>
> www.wipro.com
>
>   


Reply via email to