From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14784 invoked by alias); 18 Dec 2010 18:21:33 -0000 Received: (qmail 14776 invoked by uid 22791); 18 Dec 2010 18:21:33 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 18 Dec 2010 18:21:28 +0000 Received: from kpbe15.cbf.corp.google.com (kpbe15.cbf.corp.google.com [172.25.105.79]) by smtp-out.google.com with ESMTP id oBIILPMp031919 for ; Sat, 18 Dec 2010 10:21:26 -0800 Received: from qwj8 (qwj8.prod.google.com [10.241.195.72]) by kpbe15.cbf.corp.google.com with ESMTP id oBIILOVR005756 for ; Sat, 18 Dec 2010 10:21:24 -0800 Received: by qwj8 with SMTP id 8so1745914qwj.24 for ; Sat, 18 Dec 2010 10:21:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.224.60.199 with SMTP id q7mr2217223qah.148.1292696484186; Sat, 18 Dec 2010 10:21:24 -0800 (PST) Received: by 10.220.210.12 with HTTP; Sat, 18 Dec 2010 10:21:24 -0800 (PST) In-Reply-To: References: Date: Sat, 18 Dec 2010 18:21:00 -0000 Message-ID: Subject: Re: Trace each statement From: Doug Evans To: Haitao Dan Cc: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-System-Of-Record: true X-IsSubscribed: yes 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 X-SW-Source: 2010-12/txt/msg00055.txt.bz2 On Sat, Dec 18, 2010 at 10:19 AM, Doug Evans wrote: > On Thu, Dec 16, 2010 at 3:37 AM, Haitao Dan wrote: >> Dear All, >> >> Is there a way to output the execution path of the run of a c program using GDB? >> >> Thank you very much! > > This is a simplistic example that can be built on if you want. Heh, setting aside the fact that I can't cut-n-paste very well. > $ gcc -g trace-prog.c -o trace-prog > $ ./gdb --batch -q -x trace-prog.gdb trace-prog.x32 Add or remove the .x32 suffix as you wish.