From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10728 invoked by alias); 24 Apr 2010 21:21:27 -0000 Received: (qmail 10709 invoked by uid 22791); 24 Apr 2010 21:21:25 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 24 Apr 2010 21:21:21 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 9E08B2BAB7D; Sat, 24 Apr 2010 17:21:19 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id rPg8qBoH84R9; Sat, 24 Apr 2010 17:21:19 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 2C9862BAB65; Sat, 24 Apr 2010 17:21:19 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 4FCB9F5895; Sat, 24 Apr 2010 14:21:18 -0700 (PDT) Date: Sat, 24 Apr 2010 21:21:00 -0000 From: Joel Brobecker To: Eli Zaretskii Cc: gdb@sourceware.org Subject: Re: "set foo" Message-ID: <20100424212118.GW13204@adacore.com> References: <8339yk1skw.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8339yk1skw.fsf@gnu.org> User-Agent: Mutt/1.5.20 (2009-06-14) 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-04/txt/msg00126.txt.bz2 > set main > > A comment there says that this is so some variables from the binary > are available when .gdbinit is processed. I understand that this > command somehow manages to force GDB to read the relevant portions of > the symbol tables, but what I don't understand is what is the > semantics of saying "set foo" in GDB where foo is some function. What > does this command do, exactly? I think that "main" is treated as an expression, and this expression simply returns the address of function main. For instance, try the following: (gdb) print main Since it's a "set" command, we then discard the result of the evaluation. Variable assignments look like they are performed by the "set", but in reality, it is performed by the language expression evaluator. You can obtain just the same effect using a "print" command: (top-gdb) print args.argc = 1 $1 = 1 The latter causes GDB to print the value returned, but that should be the only difference. -- Joel