From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 103023 invoked by alias); 7 Mar 2018 01:44:28 -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 101269 invoked by uid 89); 7 Mar 2018 01:44:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.8 required=5.0 tests=AWL,BAYES_00,DATE_IN_FUTURE_12_24,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy= X-Spam-User: qpsmtpd, 3 recipients X-HELO: mail-pl0-f67.google.com Received: from mail-pl0-f67.google.com (HELO mail-pl0-f67.google.com) (209.85.160.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Mar 2018 01:44:24 +0000 Received: by mail-pl0-f67.google.com with SMTP id i6-v6so422219plt.7; Tue, 06 Mar 2018 17:44:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=SwqrVbihMgMoHwJZfLfc0ERoZQqB97qSvf5qJC3eU5M=; b=ZcxPfl1FUAxI7o3sdmjQeJrv9rNIayvZcWb9mxMJFlV2vk9kFtP9aT6SmplE82ggQ5 CX+82JD+4OELQew3qByBRHOSBxpHm7mIMZcN4ZuQB1W2tMgWmm4OwozHnX7ekOU2LiTC s2YTIxKrO+T9nJMzFa8ZD8V2/MPjf7PFKMD+4VM+Tnd/nOswVsWKG6H8R+oUzBckuCdE gVgHdH42veVlur5TQotznk9KMO9recAipsu8IwwnN352L1Wzm0YHPQWsdRwVQWco8Q4N EzGgqaFNe6aT8lcsbESL7ENlWVVqVg7ngFNRp2uF+no+nOhYpHyf+GJxHZh2JwS6uab0 apwQ== X-Gm-Message-State: APf1xPAAUSTN1itArC2hvmyAiyhqsXSqdVyBsGXWEcRkIjg9+xgJbD41 0sYBrvvC+kY6d7eX5jD03Q== X-Google-Smtp-Source: AG47ELvq3UrtMJmQbQsS/QC0/wCb1ZqRcU4t8LnIOeT3ZexVW9+8ESXrc2m7HzaDkuJN0jGUkjAWFg== X-Received: by 2002:a17:902:b210:: with SMTP id t16-v6mr18493841plr.373.1520387062558; Tue, 06 Mar 2018 17:44:22 -0800 (PST) Received: from HP ([144.48.7.118]) by smtp.gmail.com with ESMTPSA id u21sm28682287pfg.60.2018.03.06.17.44.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Mar 2018 17:44:21 -0800 (PST) Date: Wed, 07 Mar 2018 01:44:00 -0000 From: Yubin Ruan To: Satya Prakash Prasad Cc: gdb-info@sourceware.org, gdb-faq@sourceware.org, gdb@sourceware.org Subject: Re: GDB Trace functions calls when executing a program Message-ID: <20180308014408.GA6094@HP> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Organization: http://fastdrivers.org User-Agent: Mutt/1.9.3 (2018-01-21) X-IsSubscribed: yes X-SW-Source: 2018-03/txt/msg00020.txt.bz2 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