|
From: tarun k. <tar...@ya...> - 2004-06-23 20:11:39
|
when i run valgrind using the --gdb-attach option like: prompt>valgrind --gdb-attach=yes filenmae Then, whenever valgrind finds an error it gives the following option ----Attach to GDB ? --- [ Return /N/n/Y/y/C/c ] ---- Entering y opens up the gdb. But my question is how does it help in finding out where (which line of code) the error is. Because the point where gdb stops is not my code.. Any hints ?? Thank you so much !! Tarun __________________________________ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail |
|
From: Nicholas N. <nj...@ca...> - 2004-06-23 21:33:59
|
On Wed, 23 Jun 2004, tarun kapoor wrote: > when i run valgrind using the --gdb-attach option > like: > > prompt>valgrind --gdb-attach=yes filenmae > > Then, whenever valgrind finds an error it gives the > following option > ----Attach to GDB ? --- [ Return /N/n/Y/y/C/c ] ---- > > Entering y opens up the gdb. > > But my question is how does it help in finding out > where (which line of code) the error is. Because the > point where gdb stops is not my code.. Is the error in your code? N |
|
From: tarun k. <tar...@ya...> - 2004-06-24 02:54:54
|
Yeah. The error is in my code. My code is: int *ptr = new int[4]; ptr[5]=100; So according to me the debugger should somehow break on the second line of the code. Any hints ?? Thanks !! Tarun --- Nicholas Nethercote <nj...@ca...> wrote: > On Wed, 23 Jun 2004, tarun kapoor wrote: > > > when i run valgrind using the --gdb-attach option > > like: > > > > prompt>valgrind --gdb-attach=yes filenmae > > > > Then, whenever valgrind finds an error it gives > the > > following option > > ----Attach to GDB ? --- [ Return /N/n/Y/y/C/c ] > ---- > > > > Entering y opens up the gdb. > > > > But my question is how does it help in finding out > > where (which line of code) the error is. Because > the > > point where gdb stops is not my code.. > > Is the error in your code? > > N > __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail |
|
From: Olly B. <ol...@su...> - 2004-06-25 12:01:51
|
On 2004-06-24, tarun kapoor <tar...@ya...> wrote:
> Yeah. The error is in my code. My code is:
>
> int *ptr = new int[4];
> ptr[5]=100;
>
> So according to me the debugger should somehow break
> on the second line of the code.
Umm, just to check - have you tried typing "bt" into gdb to get a
backtrace?
The debugger normally puts you in a valgrind function, but the location
in your code should be one of the calling functions. Here's what I get:
(gdb) bt
#0 vg_do_syscall3 (syscallno=134518492, arg1=3221222776, arg2=1076694808,
arg3=1077661256) at vg_mylibc.c:91
#1 0x00006a02 in ?? ()
#2 0x0804851e in main () at tmp.cc:3
And tmp.cc line 3 is: ptr[5]=100;
If that doesn't help, post the backtrace "bt" reports.
Cheers,
Olly
|