From: Stan Shebs <stanshebs@earthlink.net>
To: gdb-patches@sourceware.org
Subject: [PATCH 0/2] Global breakpoints, introduction
Date: Mon, 13 Jun 2011 15:58:00 -0000 [thread overview]
Message-ID: <4DF6337F.1040203@earthlink.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 2351 bytes --]
This pair of patches plus Linux kernel module adds global breakpoints to
GDB. Global breakpoints are installed in multiple processes of a
target, *including* processes not under GDB control, and processes not
yet created. Conceptually, it's similar to breakpoints in some RTOSes
where tasks share all or part of an address space, and so a breakpoint
in the shared space will hit in whatever task reaches it first.
In Linux, this is a little more complicated. We don't want to force
every process to run under the debugger all the time, and we need to
catch new processes somehow. The implementation here uses a kernel
module that communicates with debuggers via a device /dev/breakpoint.
In the absence of appropriate internal support in Linux, the module uses
kprobes to hook into several key spots, and then installs and manages
breakpoint traps on behalf of the debugger. When one of these traps is
hit, the device removes the trap and notifies GDB, which then attaches
to the process and installs its own breakpoint trap in the usual way.
The user interface adds a "process" keyword to breakpoints, along the
lines of "thread", so for instance "break mysubr process *" installs a
breakpoint in all processes using the file in which mysubr is defined
(which could be either the exec file or a shared library). "break
mysubr process future" installs only in processes created after the
breakpoint is defined. In addition, combinations and process user/owner
qualifications are possible, so you can do instant system catatonia with
something ill-advised like "break malloc process all/root". :-)
The patch here includes both native Linux and remote protocol for Linux
gdbserver, and I've attached a tgz of the (small) kernel module sources
to this message. (The module has only been tested much on the 2.6.35
kernel.)
This is kind of a freaky addition - it's very cool to see in action, as
you can catch the first process to call some library function, and it
will be even more interesting for multicore situations where lots of
copies of a exec may be running. At the same time, it pushes the
envelope on hooking into the system, and in the absence of full
multi-process infrastructure, the user interface is a little hacky. So
I'm open to ideas on how to do all this better.
Stan
stan@codesourcery.com
[-- Attachment #2: bpmodule.tgz --]
[-- Type: application/x-gzip, Size: 11114 bytes --]
next reply other threads:[~2011-06-13 15:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-13 15:58 Stan Shebs [this message]
2011-06-13 16:39 ` Frank Ch. Eigler
2011-06-13 17:03 ` Stan Shebs
2011-06-14 9:39 ` Kevin Pouget
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=4DF6337F.1040203@earthlink.net \
--to=stanshebs@earthlink.net \
--cc=gdb-patches@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