Hi Jonathan I am interested in find evaluate the value of argument in the function. $C displays only the stack, this can be viewed by even pstack. I also tried <address>::dis this address of frame in the stack. But I am more interested in analyzing the function argument at this time.
For Example. My Sample code ================ #include <stdio.h> int main() { char *temp; strcpy(temp,"Hello Oviya!"); printf("%s\n", temp); return 0; } pstack of corefile ================= core 'core' of 7253: ./testdump ff2b30c4 strcpy (0, 2087c, 0, 48656c6c, 22718, ff29bbd0) + 2f8 000106b8 main (1, ffbef8a4, ffbef8ac, 20800, 0, 0) + 18 00010678 _start (0, 0, 0, 0, 0, 0) + 108 Gdb trace ============ gdb testdump core GNU gdb 6.5 Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "sparc-sun-solaris2.8"... Reading symbols from /usr/lib/libc.so.1...done. Loaded symbols for /lib/libc.so.1 Reading symbols from /usr/lib/libdl.so.1...done. Loaded symbols for /lib/libdl.so.1 Reading symbols from /usr/platform/SUNW,Ultra-1/lib/libc_psr.so.1...done. Loaded symbols for /usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1 Reading symbols from /usr/lib/ld.so.1...done. Loaded symbols for /usr/lib/ld.so.1 Core was generated by `./testdump'. Program terminated with signal 11, Segmentation fault. #0 0xff2b30c4 in strcpy () from /lib/libc.so.1 (gdb) bt #0 0xff2b30c4 in strcpy () from /lib/libc.so.1 #1 0x000106c0 in main () at testdump.c:10 (gdb) f 1 #1 0x000106c0 in main () at testdump.c:10 10 strcpy(temp,"Hello Oviya!"); (gdb) p temp $1 = 0x0 ------------------------------------------------ In this example I am able to identify the arguments of strcpy and trying to print the value of temp. mdb trace ============ > $c libc.so.1`strcpy+0x2f8(0, 2087c, 0, 48656c6c, 22718, ff29bbd0) main+0x18(1, ffbef8a4, ffbef8ac, 20800, 0, 0) _start+0x108(0, 0, 0, 0, 0, 0) > $C ffbef798 libc.so.1`strcpy+0x2f8(0, 2087c, 0, 48656c6c, 22718, ff29bbd0) ffbef7d8 main+0x18(1, ffbef8a4, ffbef8ac, 20800, 0, 0) ffbef840 _start+0x108(0, 0, 0, 0, 0, 0) This trace has many arguments (6 arguments) how to identify the temp and its value. What are these 6 arguments means? Regards, Oviaprasad D -----Original Message----- From: Jonathan Adams [mailto:jonathan.ad...@sun.com] Sent: Monday, June 22, 2009 9:41 PM To: Oviaprasad Dharuman (WT01 - Telecom Equipment) Cc: mdb-discuss at opensolaris.org Subject: Re: [mdb-discuss] Setting Frame and printing the function argument On Mon, Jun 22, 2009 at 09:59:25AM +0530, oviaprasad.dharuman at wipro.com wrote: > Hi All, > > I am new to this group. I frequently use gdb to debug my core > files. Can you please any one tell me how to move to particular frame in > the stack and how to print the value of argument that was passed to > particular function. $C will output the stack, as well as any known arguments. Unlike gdb, mdb is a mostly-stateless debugger. There's no concept of moving up and down the stack. Cheers, - jonathan > Regards, > Oviaprasad D > > 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 > _______________________________________________ > mdb-discuss mailing list > mdb-discuss at opensolaris.org 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