From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40317 invoked by alias); 7 Mar 2018 06:17:40 -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 40286 invoked by uid 89); 7 Mar 2018 06:17:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=spreading, H*c:alternative, our X-Spam-User: qpsmtpd, 3 recipients X-HELO: mail-vk0-f47.google.com Received: from mail-vk0-f47.google.com (HELO mail-vk0-f47.google.com) (209.85.213.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Mar 2018 06:17:37 +0000 Received: by mail-vk0-f47.google.com with SMTP id p189so671215vkd.10; Tue, 06 Mar 2018 22:17:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=jicmpXkhXrv+9bLabz/zxCD6NjniiwQs16rxo4FRlHA=; b=LymnPr4SnOCZ1uAaPUUWtLRQI4F0T78LmPiqTPaARvi9IEFx1St/lSYVHAMz/DyGVq WC/8aVACwYBPrm2LnuICOXIUTJoYgva3NGrL4fSaUojUlMkyAbdOf6JVSyIiW8BGFl+J DCadfUc3unoC3m0B2nx3lv5pq8mpK/+x2rwwbtv8/Oy1dFyLX9EzezaD8aRDxPV1NIMF Zb+CM4Nh9+XzfkGc4N0qG+EMg9fBrcdtbq1eFB/0/k5H6WpX215sm+mqrJh0eJtQcgl4 k3WkS3NhjnFlH2rA4CrRJ+UGAGcxlLhGjtMNLBvfWcHPUviUIpuGhdpe6+yLX5FoIF2J Xz1A== X-Gm-Message-State: APf1xPBlfZcfenoRkBtEFnA+xV2oelfcTQJjuE58Y/8uFTLGGaA4Vxpx 2zFJXzLf1twxj4ORENO9oSeDZiAETwl+5oM7KVQ= X-Google-Smtp-Source: AG47ELunjiSmZd5kuJMXSJP2OeJPvd4HdnW69zFEtr87Pj8XMwRwBgkDB1TaK4IgftrbK8oNUvuLeio/eW6vFOWuA3Q= X-Received: by 10.31.125.205 with SMTP id y196mr15212409vkc.57.1520403455761; Tue, 06 Mar 2018 22:17:35 -0800 (PST) MIME-Version: 1.0 Received: by 10.176.14.26 with HTTP; Tue, 6 Mar 2018 22:17:35 -0800 (PST) In-Reply-To: <20180308014408.GA6094@HP> References: <20180308014408.GA6094@HP> From: Satya Prakash Prasad Date: Wed, 07 Mar 2018 06:17:00 -0000 Message-ID: Subject: Re: GDB Trace functions calls when executing a program To: Yubin Ruan Cc: gdb-info@sourceware.org, gdb-faq@sourceware.org, gdb@sourceware.org Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-03/txt/msg00022.txt.bz2 Thanks for the details - please note that I am using Win7 and MingW for our project and the LTTng tools is only for *nix platform. Can you please let me know similar tool for Windows. Also inserting printf in each function call is not possible cause it would take long hours and effort for a code spreading thousands of lines. Regards, Prakash On Thu, Mar 8, 2018 at 7:14 AM, Yubin Ruan wrote: > On Wed, Feb 28, 2018 at 08:49:17PM +0530, Satya Prakash Prasad wrote: > > Please let me know if in GDB there is a way to print function names when > > program is executing - this is to just track / trace the code flow. > > > > Generally in projects which has thousands of lines of code - it is very > > difficult to trace a flow. The first is to decide where to put a > breakpoint > > for analysis. But to know the place to put breakpoint we need to know > where > > to enable it - I mean it should be within a function of a flow. > > > > So can we just enable some command and let the program when running using > > gdb - gdb can simply print functions name as it executes them. > > > > Is the same possible? > > Do you have access to the source? If so, why not simply add a print at the > very beginning of every function call: > > print("function called: %s\n", __FUNC__); > > I know that strace can be used to trace system calls, but not normal > function > calls. Maybe try LTTng: https://lttng.org/ > > Yubin >