public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Aurelio Remonda <aurelio.remonda@tallertechnologies.com>
To: gdb-patches@sourceware.org
Subject: Fwd: [RFC] rbreak's regex saving feature
Date: Wed, 04 May 2016 21:36:00 -0000	[thread overview]
Message-ID: <CANLsssvxS-Y=42o1F22=eP3v8yT=Ln61P0LWgk6uKbw4Oxyz_Q@mail.gmail.com> (raw)
In-Reply-To: <CANLsssvD38TK8cnOxnQvv_BBxFqXktv9pGeZZzsEdMptzVeXjw@mail.gmail.com>

Hi there!
We are thinking about adding a new feature to gdb that allows to save
an rbreak's
regex after having searched for matches in a program, so they can be used again
later when loading a new symbol file (e.g. when execv'ing another program, or
loading a shared library).

Suppose we have two programs: prog and prog2, they both have a function called
foo, and prog execv's prog2.
When adding a breakpoint that matches a function on an object file, say foo
function on prog, if this program execv's prog2 with a function named foo too
gdb will break on both foo functions.

Reading symbols from ./prog...done.
(gdb) set follow-fork-mode child
(gdb) br foo
Breakpoint 1 at 0x4005eb: file prog.c, line 19.
(gdb) r
Starting program: /home/aurelio-remonda/gdb/some_programs/prog

Breakpoint 1, foo () at prog.c:19
19        printf("Hello world, at prog\n");
(gdb) c
Continuing.
Hello world, at prog
[New process 2484]
process 2484 is executing new program:
/home/aurelio-remonda/gdb/some_programs/prog2
[Switching to process 2484]

Thread 2.1 "prog2" hit Breakpoint 1, foo () at prog2.c:16
16        printf("Hello world, at prog2\n");
(gdb) c
Continuing.
Hello world, at prog2
goodbye
[Inferior 2 (process 2484) exited normally]

Now, when adding an rbr "foo" on this same scenario, gdb will break on prog but
not on prog2:

Reading symbols from ./prog...done.
(gdb) set follow-fork-mode child
(gdb) rbr foo
Breakpoint 1 at 0x4005eb: file prog.c, line 19.
void foo(void);
(gdb) r
Starting program: /home/aurelio-remonda/gdb/some_programs/prog

Breakpoint 1, foo () at prog.c:19
19        printf("Hello world, at prog\n");
(gdb) c
Continuing.
Hello world, at prog
[New process 2475]
process 2475 is executing new program:
/home/aurelio-remonda/gdb/some_programs/prog2
Error in re-setting breakpoint 1: No source file named
/home/aurelio-remonda/gdb/some_programs/prog.c.
Hello world, at prog2
goodbye
[Inferior 2 (process 2475) exited normally]
(gdb)

And of course will continue without breaking.

This feature is intended to make this two behaviours to be the same, besides
expanding the rbreakpoints functionality when loading shared libraries.
So what do you think about this whole idea? Any suggestion would be appreciated.
Thank you.

-- 

Aurelio Remonda

Taller Technologies Argentina

Software Engineer

San Lorenzo 47, 3rd Floor, Office 5
Córdoba, Argentina
Phone: +54-351-4217888 / 4218211

           reply	other threads:[~2016-05-04 21:36 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <CANLsssvD38TK8cnOxnQvv_BBxFqXktv9pGeZZzsEdMptzVeXjw@mail.gmail.com>]

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='CANLsssvxS-Y=42o1F22=eP3v8yT=Ln61P0LWgk6uKbw4Oxyz_Q@mail.gmail.com' \
    --to=aurelio.remonda@tallertechnologies.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).