Re: The step-Over (next) command seems repetitively displaying same statement execution
Jitendra Pawar <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <CAO9sCwTnTUiSxpA3Qvtp7G3oXGi=WsNj8DCr=Cccj6reOPFLtg@mail.gmail.com> |
Hello Eli, I am sorry, I forgot to mention that. Compilation command is: " gcc hello.c -g " thats it. gcc version is: 4.6.3 gdb version is: GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04 Thanks, - Jitendra Pawar On Tue, Dec 22, 2015 at 9:51 PM, Eli Zaretskii <[email protected]> wrote: >> Date: Tue, 22 Dec 2015 17:33:16 +0530 >> From: Jitendra Pawar <[email protected]> >> >> $ gdb -q a.out >> Reading symbols from /home/jitendra/work/roughwork/a.out...done. >> (gdb) br main >> Breakpoint 1 at 0x40054c: file hello.c, line 9. >> (gdb) run >> Starting program: /home/itendrap/work/roughwork/a.out >> warning: no loadable sections found in added symbol-file >> system-supplied DSO at 0x7ffff7ffa000 >> >> Breakpoint 1, main () at t.c:9 >> 9 c = (char*) malloc (12); >> (gdb) n >> 9 c = (char*) malloc (12); >> (gdb) n >> 11 memcpy(c, "Hello World", 12); >> (gdb) n >> 13 printf("%s\n", c); >> (gdb) n >> Hello World >> 14 } >> (gdb) >> ------------------------------------------------------------------------ >> >> Can anyone please explain whats going wrong here? Why the malloc >> statement 'c = (char*) malloc (12);' gets repeated? > > What compilation command and switches did you use to compile this > program?