Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: David Taylor <dtaylor@usendtaylorx2l.lss.emc.com>
To: Daniel Gutson <daniel.gutson@tallertechnologies.com>
Cc: gdb <gdb@sourceware.org>
Subject: Re: Breakpoint commands compiler
Date: Thu, 23 Oct 2014 15:35:00 -0000	[thread overview]
Message-ID: <29700.1414078484@usendtaylorx2l> (raw)
In-Reply-To: <CAF5HaEVWapj-ZVTshW7aGdjFhmMohZqw9dCezwTrxH__FSEkLg@mail.gmail.com>

 1961+-07/28 To:"gdb@sourcewar  possible gdb agent expression extension<<We're 
 1962  07/28 To:"gdb@sourcewar  possible 'info macro' extension<<To expand a ma

Daniel Gutson <daniel.gutson@tallertechnologies.com> wrote:

> Hi,
> 
>     gdb is sometimes used for changing the runtime behavior of a program.
> That is, suppose there is a program that has a bug,
> it is spotted with gdb, then I create a set of non-stopping breakpoints that
> "fix" the runtime behavior by altering memory and registers.
> It does work, but it's slow.

Agreed.  Additionally speeding up the debug -- edit -- build -- download
& boot cycle is a concern of ours.

For us, while it only takes about 5 minutes to do a full build from
scratch, the build -- download & boot part takes about 30 minutes.  Some
threads have timing constraints -- if the thread is left stopped waiting
on the user to continue it, it will bring down the system.  Other
threads can wait an hour or more and it's no big deal.

Depending on the problem being debugged, you might need additional time
to get the system into the 'failing' state.  So, the ability to 'patch'
via debugger commands was desirable.

Also, for unit testing it is nice to be able to artificially alter
variables.

> I was thinking to start a project to add a "breakpoint commands compiler"
> to gdb, which basically generates C code from the breakpoint commands
> (one function per breakpoint),
> which in turns calls a C API (similar to the python api), invokes the compiler
> (user-specified), loads it as a shared object, and finally replaces the commands
> of the breakpoints by calls to the compiled breakpoint-functions.
> 
> Any comment/suggestion? Would this be accepted within gdb?

Another option would be, if the target supports it, to download the
breakpoint commands to the target and have the target execute them.

In the remote protocol the Z0 command takes an optional cond_list and an
optional cmd_list.

Back on July 28th I posted a message, subject 'possible gdb agent
expression extension' that partially addresses this.  Judging from the
response, or should I say lack of response, no one seemed to care.

The proposal addresses the setting variables part of the problem.  We
went ahead with it and it is about half done.  The pieces remaining are
primarily the gdbserver and testsuite changes.  I keep getting pulled
onto other tasks, but I'm *hoping* to finish it before the end of the
year.

It's only useful if you have a remote target and the target supports
agent bytecode expressions.

There are many things missing from agent bytecode expressions to make
them as useful as I'd like.  But, it's a start.  The biggest missing one
is the lack of 'continue'.  But, for 'continue', there is a workaround
-- put the expressions into the condition and use the comma operator:

    real-condition && ((variable1 = value1), (variable2 = value2), 0)

[My other proposal on that same day -- possible 'info macro' extension
-- elicited no responses.]


      parent reply	other threads:[~2014-10-23 15:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-17 15:42 Daniel Gutson
2014-10-17 16:12 ` Daniel Gutson
2014-10-17 16:57 ` Doug Evans
2014-10-17 17:38   ` Phil Muldoon
2014-10-17 17:39   ` Jan Kratochvil
2014-10-23 15:35 ` David Taylor [this message]

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=29700.1414078484@usendtaylorx2l \
    --to=dtaylor@usendtaylorx2l.lss.emc.com \
    --cc=daniel.gutson@tallertechnologies.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