From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21747 invoked by alias); 21 Oct 2011 08:15:27 -0000 Received: (qmail 21719 invoked by uid 22791); 21 Oct 2011 08:15:16 -0000 X-SWARE-Spam-Status: No, hits=-2.2 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-vw0-f41.google.com (HELO mail-vw0-f41.google.com) (209.85.212.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 Oct 2011 08:15:02 +0000 Received: by vws16 with SMTP id 16so3345795vws.0 for ; Fri, 21 Oct 2011 01:15:02 -0700 (PDT) Received: by 10.52.34.83 with SMTP id x19mr13562608vdi.102.1319184902072; Fri, 21 Oct 2011 01:15:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.180.75 with HTTP; Fri, 21 Oct 2011 01:14:42 -0700 (PDT) In-Reply-To: References: From: Kevin Pouget Date: Fri, 21 Oct 2011 08:33:00 -0000 Message-ID: Subject: Re: Dejagnu testing issue To: Tom Tromey , Jan Kratochvil Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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-10/txt/msg00587.txt.bz2 On Thu, Oct 20, 2011 at 5:02 PM, Tom Tromey wrote: >>>>>> "Kevin" =3D=3D Kevin Pouget writes: > > Kevin> how can I read a value from what GDB writes, and use it later to > Kevin> validate some tests. > > Kevin> For instance, the pid: > > Kevin> I know it's it "info inferiors" --> ".*process HERE .*", I would l= ike > Kevin> to save it, and then do something like "detach", "attach $PID" > > Kevin> (don't get me wrong, I know there are some alternatives to get the > Kevin> PID, but I really want to read it from a GDB command) > > You can do it, with some difficulty, using gdb_test_multiple and > examining expect_out in your match. =A0This is done in some places in the > code. Thanks for your reponses (and sorry for posted on the wrong mailing-list, it was supposed to go to gdb@sourceware.org) for the record, here is the way to get the pid based on "expect_out": gdb_test_multiple "info inferior" "list inferiors" { -re ".* \* 1.*process (\[0-9\]*).*$gdb_prompt $" { set pid $expect_out(1,string) pass "list inferiors" } } > Kevin> By the way, is it a normal that I can't set a thread breakpoint th= is way: > >>> break thread $_thread >>> Junk after thread keyword. > > Kevin> (that would have bypassed the problem described above !) > > Yes, the 'thread' modifier just takes an integer. > You can use eval though: > > =A0 =A0eval "break ... thread %d", $_thread from a user point of view, it's not obvious why $_thread is not an integer / what it actually is, but I guess there are some background reasons. Anyway, output parsing and `eval' did the trick, thanks Kevin Kevin