From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31564 invoked by alias); 12 Sep 2011 14:15:16 -0000 Received: (qmail 31548 invoked by uid 22791); 12 Sep 2011 14:15:14 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-ww0-f43.google.com (HELO mail-ww0-f43.google.com) (74.125.82.43) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 12 Sep 2011 14:14:54 +0000 Received: by wwf27 with SMTP id 27so1202574wwf.12 for ; Mon, 12 Sep 2011 07:14:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.169.74 with SMTP id m52mr2469867wel.33.1315836892731; Mon, 12 Sep 2011 07:14:52 -0700 (PDT) Received: by 10.216.159.205 with HTTP; Mon, 12 Sep 2011 07:14:52 -0700 (PDT) In-Reply-To: <201109121442.17296.pedro@codesourcery.com> References: <201109121442.17296.pedro@codesourcery.com> Date: Mon, 12 Sep 2011 14:36:00 -0000 Message-ID: Subject: Re: Provision for array as debugger variable From: Abhijit Halder To: Pedro Alves Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-09/txt/msg00189.txt.bz2 On Mon, Sep 12, 2011 at 7:12 PM, Pedro Alves wrote: > On Monday 12 September 2011 13:44:15, Abhijit Halder wrote: > >> in GDB we can do this to define a debugger variable: >> (gdb) set $var >> >> The $var is a scalar variable. Can we define similarly an array? > > (gdb) set $var1 = {0, 1} > (gdb) ptype $var1 > type = int [2] > (gdb) p $var1 > $1 = {0, 1} > > (gdb) set $var2 = (char[2]) {0, 1} > (gdb) ptype $var2 > type = char [2] > (gdb) p $var2 > $2 = "\000\001" > > -- > Pedro Alves > Okay I got it. I'm just curious about whether we can have similarly dynamic array and associative array along with it, and at the same time some functionality on top of this, like push etc. function as in perl. This will be an approach towards making gdb in itself as a mature scripting language. Just a thought!