From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21649 invoked by alias); 24 Mar 2007 20:05:16 -0000 Received: (qmail 21639 invoked by uid 22791); 24 Mar 2007 20:05:15 -0000 X-Spam-Check-By: sourceware.org Received: from py-out-1112.google.com (HELO py-out-1112.google.com) (64.233.166.179) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 24 Mar 2007 20:05:13 +0000 Received: by py-out-1112.google.com with SMTP id p76so666664pyb for ; Sat, 24 Mar 2007 13:05:11 -0700 (PDT) Received: by 10.35.81.2 with SMTP id i2mr8595203pyl.1174766711813; Sat, 24 Mar 2007 13:05:11 -0700 (PDT) Received: by 10.35.73.12 with HTTP; Sat, 24 Mar 2007 13:05:11 -0700 (PDT) Message-ID: Date: Sat, 24 Mar 2007 20:05:00 -0000 From: "John Zoidberg" To: gdb@sourceware.org Subject: Log every call and exit in embedded system MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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: 2007-03/txt/msg00298.txt.bz2 Hi, I am studying a FOSS embedded OS and would like to understand its callgraph (especially assembly calls during OS initialization). Since this is an embedded OS it means I have no access to profiling or coverage features from GCC. I've also looked into GDB manual for tracing and logging, but didn't found anything that can solve my problem in a direct way. I tried backtrace but couldn't get any usefull information. The idea is to understand its callgraph, so it's a one time operation. I'm not looking for profiling or statistics (of course that being able to do this would be great). ATM, my idea is to create a script that: (1) parses objdump output to get symbols and (2) create a GDB command file that sets a breakpoint in every symbol. I'll then read the commands file, run the target and manually take note of the function name and source code filename (because there are symbol name collisions) everytime a breakpoint occurs. Problems with this approach: (1) unable to tell when a function returns, so it's impossible to tell what is the level at which functions are being called. This is especially true in assembly files (i.e., was it a JMP or was it a RET?) (2) unable to track macros and inline code :( (3) can GBD handle thousands of breakpoints? (4) it's a slow manual process because when a breakpoint fires I'll have to take note of the symbol:filename and issue a continue Is this the only way? Can anyone give me any suggestions or hints? OFFTOPIC: how can I define string variables for GDB command files? I tried "set" but it doesn't accept strings. What I would like to do is this: export SOURCE_ROOT=/path/to/source/code/with/lots/of/dirs/ dir $SOURCE_ROOT dir $SOURCE_ROOT/core dir $SOURCE_ROOT/util dir $SOURCE_ROOT/drivers dir $SOURCE_ROOT/drivers/ethernet Thanks in advance!