From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 85995 invoked by alias); 23 Jun 2015 15:14:33 -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 85984 invoked by uid 89); 23 Jun 2015 15:14:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f177.google.com Received: from mail-ob0-f177.google.com (HELO mail-ob0-f177.google.com) (209.85.214.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 23 Jun 2015 15:14:29 +0000 Received: by obpn3 with SMTP id n3so8264261obp.0 for ; Tue, 23 Jun 2015 08:14:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=lNVj8tuhOLHKD1WnnFnzzFjw/dY89JTtonxhrIrKYRk=; b=JRpjfY4GAZqm/yQuTCuop7RuAWnQssIWXzsJXq/FMa0eXgfZtekdDshFrGB2a7d/9l 3z7MLqIz25nlZaqWStHbTDQeycV8QP+bErVCvaBjsFS9PIgEQ31m34N+dn6sPsXkPqW7 fQhX8gyiajilz2hH5pJg8ly82o3aKN+wjN3znQxASqktzp4kwHr+ff5STzSTz4Ja30HL 8A/xh+44fq7F9xhcsB1RDl2eiY/Q2FLCr4D15ydijlrWrrHR2WRYBNFh3jMiJZNlSfCD t/EBSZnvUWsi4EqRwwcyu3hECSNoO0KciQCPfQtRkOQgS2dygWXnICj/ytxlwUD10BSG iqsg== X-Gm-Message-State: ALoCoQnolY3vFFT2cemaAgWkawvLOVAqqcBT9eq6JuEfvC/DwateCEpK+xAoah9fcHbxAKDIAEJ0 MIME-Version: 1.0 X-Received: by 10.182.71.72 with SMTP id s8mr14865189obu.80.1435072467768; Tue, 23 Jun 2015 08:14:27 -0700 (PDT) Received: by 10.182.89.99 with HTTP; Tue, 23 Jun 2015 08:14:27 -0700 (PDT) In-Reply-To: References: Date: Tue, 23 Jun 2015 15:14:00 -0000 Message-ID: Subject: Re: Print addresses of all local variables From: Doug Evans To: Suryansh Kumar Cc: gdb , Vini Kanvar Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-06/txt/msg00069.txt.bz2 On Wed, Jun 17, 2015 at 3:55 AM, Suryansh Kumar wrote: > Print addresses > ---------------- > I want to print the addresses of all the local and global variables > which are being used in the current frame and store them in a file. > "info local" prints the values of all local variables. I need something > to print the addresses in a similar way. Is there any built in > command for it? No, but one might be able to do something in python. https://sourceware.org/gdb/current/onlinedocs/gdb/Python-API.html > GDB macro coding language tutorial > ----------------------------------- > I tried writing a gdb script for the same using the gdb macro coding > language, but I am not able to find sufficient material for it. Any > handbook or tutorial on the gdb scripting language which covers its > usage and syntax in detail is urgently needed. I need to know if we can > declare arrays and strings, and perform comparisons on them. gdb's own scripting language is really limited. Use Python. There's also Guile support, but the Python support is more complete. https://sourceware.org/gdb/current/onlinedocs/gdb/Guile.html > "step" into non-library functions > ---------------------------------- > I need to store the data at the end of every function when it is > executed using a gdb script. I am not able to use the 'step' command > in the script as it also steps into the library functions, which I > don't need. Need a way to run step conditionally on user functions > only. There's no real way to distinguish user from non-user functions. There are ways to achieve what you want though. 1) The "skip" set of commands. https://sourceware.org/gdb/current/onlinedocs/gdb/Skipping-Over-Functions-and-Files.html 2) gdb won't step into functions that are missing debug info. You *could*, though I'm not recommending this as a great approach, remove the debug info for functions you don't want gdb to step into. E.g., if you have debug info installed for glibc, temporarily remove it.