From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7942 invoked by alias); 11 Jun 2012 19:36:48 -0000 Received: (qmail 7898 invoked by uid 22791); 11 Jun 2012 19:36:47 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-gg0-f169.google.com (HELO mail-gg0-f169.google.com) (209.85.161.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 Jun 2012 19:36:34 +0000 Received: by ggm4 with SMTP id 4so3395070ggm.0 for ; Mon, 11 Jun 2012 12:36:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.46.74 with SMTP id q50mr23198054yhb.30.1339443394037; Mon, 11 Jun 2012 12:36:34 -0700 (PDT) Received: by 10.236.138.132 with HTTP; Mon, 11 Jun 2012 12:36:34 -0700 (PDT) In-Reply-To: References: Date: Mon, 11 Jun 2012 19:36:00 -0000 Message-ID: Subject: Re: [Question] does GDB have a commands to get the end address of a function? From: Matt Rice To: Hui Zhu Cc: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes 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: 2012-06/txt/msg00051.txt.bz2 On Mon, Jun 11, 2012 at 2:36 AM, Hui Zhu wrote: > Now, I get the end address of a function with command "disassemble > function_name". > Does GDB have an command to output the end address of a function? i'm not aware of anything, there is the following which could be made into a user defined command or something. py gdb.execute("p/x %s" % gdb.block_for_pc(gdb.decode_line("*main")[1][0].pc).end) seems to differ slightly from 'disassemble' I suppose by the length of the last instruction