public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* Fwd: [RFC] rbreak's regex saving feature
       [not found] <CANLsssvD38TK8cnOxnQvv_BBxFqXktv9pGeZZzsEdMptzVeXjw@mail.gmail.com>
@ 2016-05-04 21:36 ` Aurelio Remonda
  0 siblings, 0 replies; only message in thread
From: Aurelio Remonda @ 2016-05-04 21:36 UTC (permalink / raw)
  To: gdb-patches

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-04 21:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CANLsssvD38TK8cnOxnQvv_BBxFqXktv9pGeZZzsEdMptzVeXjw@mail.gmail.com>
2016-05-04 21:36 ` Fwd: [RFC] rbreak's regex saving feature Aurelio Remonda

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).