From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22727 invoked by alias); 4 Oct 2017 21:19: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 22682 invoked by uid 89); 4 Oct 2017 21:19:28 -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_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy= X-HELO: gproxy8-pub.mail.unifiedlayer.com Received: from gproxy8-pub.mail.unifiedlayer.com (HELO gproxy8-pub.mail.unifiedlayer.com) (67.222.33.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 04 Oct 2017 21:19:27 +0000 Received: from cmgw3 (unknown [10.0.90.84]) by gproxy8.mail.unifiedlayer.com (Postfix) with ESMTP id 5FE9E1AB135 for ; Wed, 4 Oct 2017 15:19:25 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw3 with id HZKN1w00W2f2jeq01ZKR2E; Wed, 04 Oct 2017 15:19:25 -0600 X-Authority-Analysis: v=2.2 cv=K/VSJ2eI c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=02M-m0pO-4AA:10 a=8dLZ3cr5y3xMZ30GT5QA:9 Received: from 75-166-0-208.hlrn.qwest.net ([75.166.0.208]:54188 helo=pokyo) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1dzr4c-001vCE-20; Wed, 04 Oct 2017 15:19:22 -0600 From: Tom Tromey To: Yifei Zheng Cc: gdb@sourceware.org Subject: Re: How to implement a new Python command that takes values from tty? References: <42da207c-05cf-9648-bba7-650611a7bff4@purdue.edu> Date: Wed, 04 Oct 2017 21:19:00 -0000 In-Reply-To: <42da207c-05cf-9648-bba7-650611a7bff4@purdue.edu> (Yifei Zheng's message of "Tue, 3 Oct 2017 18:41:56 -0400") Message-ID: <87lgkqlig7.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-BWhitelist: no X-Exim-ID: 1dzr4c-001vCE-20 X-Source-Sender: 75-166-0-208.hlrn.qwest.net (pokyo) [75.166.0.208]:54188 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes X-SW-Source: 2017-10/txt/msg00010.txt.bz2 >>>>> "Yifei" == Yifei Zheng writes: Yifei> I have written a few gdb pretty-printers using Python but this time Yifei> I'm trying to write a new command in Python. I want it to take Yifei> arguments from gdb and somewhat works like gdb's print. (It's a Yifei> special printer for some kind of std::vector). I'm curious why not write a pretty-printer for this case as well? Yifei> How can I let gdb evaluates the expression for me so that I don't have Yifei> to parse it, and then give me the value instead of the name? You want gdb.parse_and_eval. Tom