From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28480 invoked by alias); 23 Jun 2010 18:21:56 -0000 Received: (qmail 28470 invoked by uid 22791); 23 Jun 2010 18:21:55 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-ew0-f41.google.com (HELO mail-ew0-f41.google.com) (209.85.215.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 23 Jun 2010 18:21:49 +0000 Received: by ewy21 with SMTP id 21so356854ewy.0 for ; Wed, 23 Jun 2010 11:21:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.213.20.10 with SMTP id d10mr2273530ebb.38.1277317306981; Wed, 23 Jun 2010 11:21:46 -0700 (PDT) Received: by 10.213.35.145 with HTTP; Wed, 23 Jun 2010 11:21:46 -0700 (PDT) In-Reply-To: References: Date: Wed, 23 Jun 2010 18:21:00 -0000 Message-ID: Subject: Re: gdb "automation" question From: Steffen Dettmer To: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 2010-06/txt/msg00113.txt.bz2 * On Tue, Jun 22, 2010 at 6:09 PM, Tom Tromey wrote: > Steffen> define defaction > Steffen> =A0 .... other default actions ... > Steffen> =A0 define hook-stop > Steffen> =A0 =A0 =A0show_log > Steffen> =A0 end > Steffen> end > Steffen> but I get an error ("This command cannot be used at top level"). > > At least in the current sources this error only comes from the > tracepoint code. =A0I don't have a tree before 7.0 handy, so if you're > using something older, maybe upgrading would help this. =A0Or maybe the > "..." includes tracepoint commands? No, I did not use tracepoints (not supported on platform). I re-tested with version 7.1, which was the most recent I could find on http://ftp.gnu.org/gnu/gdb/. I observed the same issue. Here a minimal "This command cannot be used at the top level" example: ------------------------------------------------------------------->8=3D=3D= =3D=3D=3D=3D=3D steffen@host:dir/arm-elf $ cat gdb-commands.txt # Do not edit, automatically generated by make define defactions define hook-stop show_log end end document defactions Default actions end steffen@host:dir/arm-elf $ /usr/local/build/gdb-7.1/build/gdb/gdb GNU gdb (GDB) 7.1 [...] This GDB was configured as "--host=3Di686-pc-linux-gnu --target=3Darm-elf". [...] (gdb) so gdb-commands.txt /path/dir/arm-elf/gdb-commands.txt:6: Error in sourced command file: This command cannot be used at the top level. =3D=3D=3D=3D=3D=3D=3D8<----------------------------------------------------= --------------- This shows the error without any tracepoint. Similar attempt, but this blocks / hangs. First what works: ------------------------------------------------------------------->8=3D=3D= =3D=3D=3D=3D=3D steffen@host:dir/arm-elf $ cat gdb-commands.txt # Do not edit, automatically generated by make define tr disable target remote 1.2.3.4:4000 monitor set appName 829901 symbol-file 8299011999.elf end steffen@host:dir/arm-elf $ /usr/local/build/gdb-7.1/build/gdb/gdb [...] (gdb) so gdb-commands.txt (gdb) q =3D=3D=3D=3D=3D=3D=3D8<----------------------------------------------------= --------------- So this works, but when adding "define hook-stop\n end" to get rid of the hook, it hangs: ------------------------------------------------------------------->8=3D=3D= =3D=3D=3D=3D=3D steffen@host:dir/arm-elf $ cat gdb-commands.txt # Do not edit, automatically generated by make define tr disable define hook-stop end target remote 1.2.3.4:4000 monitor set appName 829901 symbol-file 8299011999.elf end steffen@host:dir/arm-elf $ /usr/local/build/gdb-7.1/build/gdb/gdb [...] (gdb) so gdb-commands.txt <<<<<<<<<<<<<<<<<< PRESSED CTRL-C >>>>>>>>>>>>>>>>>> /path/dir/arm-elf/gdb-commands.txt:6: Error in sourced command file: 1.2.3.4:4000: Interrupted system call. =3D=3D=3D=3D=3D=3D=3D8<----------------------------------------------------= --------------- Why does it attempt to do anything remotely when adding a "define"? Shouldn't this just define a new command? BTW, I cleant my ~/.gdbinit for the test: ------------------------------------------------------------------->8=3D=3D= =3D=3D=3D=3D=3D define show_log if clogStaticLogBuffer[0] !=3D 0 printf "%s", clogStaticLogBuffer end set clogStaticLogBuffer[0] =3D 0 end =3D=3D=3D=3D=3D=3D=3D8<----------------------------------------------------= ---------------