Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Steffen Dettmer <steffen.dettmer@googlemail.com>
To: gdb@sourceware.org
Subject: Re: gdb "automation" question
Date: Wed, 23 Jun 2010 18:21:00 -0000	[thread overview]
Message-ID: <AANLkTikFZ0xUQysXAafko74sdoavCXmYo6UH4LE4mjI0@mail.gmail.com> (raw)
In-Reply-To: <m3zkyndp7f.fsf@fleche.redhat.com>

* 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<-------------------------------------------------------------------


  parent reply	other threads:[~2010-06-23 18:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-22 14:51 Steffen Dettmer
2010-06-22 16:09 ` Tom Tromey
2010-06-23 17:12   ` Steffen Dettmer
2010-06-23 20:59     ` Tom Tromey
2010-06-23 18:21   ` Steffen Dettmer [this message]
2010-06-23 21:01     ` Tom Tromey
2010-06-24 10:33       ` Steffen Dettmer
2010-06-24 18:19         ` Tom Tromey
2010-06-28 15:11 ` Steffen Dettmer
2010-06-28 15:21   ` Pedro Alves
2010-06-28 20:25   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTikFZ0xUQysXAafko74sdoavCXmYo6UH4LE4mjI0@mail.gmail.com \
    --to=steffen.dettmer@googlemail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox