From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3479 invoked by alias); 22 Dec 2015 16:21:15 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 3470 invoked by uid 89); 22 Dec 2015 16:21:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.1 required=5.0 tests=AWL,BAYES_50,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=UD:t.c, char*, system-supplied, symbol-file X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 22 Dec 2015 16:21:14 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aBPgS-0007lN-8S for gdb@sourceware.org; Tue, 22 Dec 2015 11:21:12 -0500 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33066) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBPgS-0007lJ-5U; Tue, 22 Dec 2015 11:21:08 -0500 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1552 helo=HOME-C4E4A596F7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aBPgR-00042k-81; Tue, 22 Dec 2015 11:21:07 -0500 Date: Tue, 22 Dec 2015 16:21:00 -0000 Message-Id: <83bn9iqwrt.fsf@gnu.org> From: Eli Zaretskii To: Jitendra Pawar CC: gdb@sourceware.org In-reply-to: (message from Jitendra Pawar on Tue, 22 Dec 2015 17:33:16 +0530) Subject: Re: The step-Over (next) command seems repetitively displaying same statement execution Reply-to: Eli Zaretskii References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-IsSubscribed: yes X-SW-Source: 2015-12/txt/msg00031.txt.bz2 > Date: Tue, 22 Dec 2015 17:33:16 +0530 > From: Jitendra Pawar > > $ 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?