From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89855 invoked by alias); 28 Jul 2015 10:09:41 -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 89846 invoked by uid 89); 28 Jul 2015 10:09:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ig0-f179.google.com Received: from mail-ig0-f179.google.com (HELO mail-ig0-f179.google.com) (209.85.213.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 28 Jul 2015 10:09:40 +0000 Received: by igbpg9 with SMTP id pg9so114494907igb.0 for ; Tue, 28 Jul 2015 03:09:38 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.107.46.162 with SMTP id u34mr53318259iou.124.1438078178136; Tue, 28 Jul 2015 03:09:38 -0700 (PDT) Received: by 10.107.9.219 with HTTP; Tue, 28 Jul 2015 03:09:38 -0700 (PDT) In-Reply-To: <10FC35DB-816C-4A6C-A342-ED8E5DAC3E7D@duaneellis.com> References: <10FC35DB-816C-4A6C-A342-ED8E5DAC3E7D@duaneellis.com> Date: Tue, 28 Jul 2015 10:09:00 -0000 Message-ID: Subject: Re: GDB Python - gdb.execute() - with a timeout? From: Ofir Cohen To: Duane Ellis Cc: "gdb@sourceware.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-07/txt/msg00063.txt.bz2 Hi, This is achievable via pexpect wrapper. You can take a look at this example: http://opensource.apple.com/source/lldb/lldb-76/utils/test/disasm.py The pexpect.spawn receives timeout as a parameter, so you could adapt it to your needs. I don't think this is achievable directly in gdb, i.e. w/o wrappers. Most of the gdb code _once executed_ is synchronous and doesn't allow timeo= uts or that sort of thing. Correct me if I'm wrong. - Ofir On 27 July 2015 at 15:23, Duane Ellis wrote: > Hi, am trying to script some times using GDB/Python specifically some tes= t cases > > The general format of my GDB_PY scripts are: > > import gdb > gdb.execute(=E2=80=9Cload foobar=E2=80=9D) > > gdb.execute(=E2=80=9Cbreak test_breakpoint=E2=80=9D) > > gdb.execute(=E2=80=9Crun=E2=80=9D) > gdb.execute(=E2=80=9Cset test_flag=3D0x1234=E2=80=9D) > > gdb.execute(=E2=80=9Ccont=E2=80=9D) <=E2=80=94 HERE Is where= I want a timeout > > # At this point, we should eventually hit the =E2=80=9Ctest_break= point=E2=80=9D > # However in some cases we do not. > > the timeout needs to be =E2=80=98reasonably programable=E2=80=99 - i.e.: = 1 second, 10 seconds, an hour would in some use cases be reasonable. > > In other words, if my test case is running properly - I should hit the b= reakpoint. > > I need a means to detect when things go wrong. > > This problem is *NOT* limited to the TEST case > > Is there some way to do this? > > Thanks. >