This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/11750] "define" does not properly recognize a nested define
- From: "steffen dot dettmer at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 24 Jun 2010 10:30:07 -0000
- Subject: [Bug gdb/11750] "define" does not properly recognize a nested define
- References: <20100624102541.11750.steffen.dettmer@gmail.com>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- Additional Comments From steffen dot dettmer at gmail dot com 2010-06-24 10:30 -------
The context where I would like to use a nested defininition was
to modify a hook to avoid hooks to be executed when no remote
debug connection exists (for example, a hook-stop will fail when
it needs to examine data after the remote device crashed).
I would like to have an automation showing the contents of a
debug buffer (debug log) in a remote debug session.
* Steffen Dettmer wrote on Wed, Jun 23, 2010 at 20:21 +0200:
> * On Tue, Jun 22, 2010 at 6:09 PM, Tom Tromey <tromey@redhat.com> wrote:
> > Steffen> define defaction
> > Steffen> ? .... other default actions ...
> > Steffen> ? define hook-stop
> > Steffen> ? ? ?show_log
> > Steffen> ? 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. ?I don't have a tree before 7.0 handy, so if you're
> > using something older, maybe upgrading would help this. ?Or 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=======
> 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=i686-pc-linux-gnu --target=arm-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.
> =======8<-------------------------------------------------------------------
>
> This shows the error without any tracepoint.
>
>
> Similar attempt, but this blocks / hangs.
>
> First what works:
>
> ------------------------------------------------------------------->8=======
> 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
> =======8<-------------------------------------------------------------------
>
>
> So this works, but when adding "define hook-stop\n end" to get rid
> of the hook, it hangs:
>
> ------------------------------------------------------------------->8=======
> 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.
> =======8<-------------------------------------------------------------------
>
> 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=======
> define show_log
> if clogStaticLogBuffer[0] != 0
> printf "%s", clogStaticLogBuffer
> end
> set clogStaticLogBuffer[0] = 0
> end
> =======8<-------------------------------------------------------------------
>
--
http://sourceware.org/bugzilla/show_bug.cgi?id=11750
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.