This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fwd: [RFC] rbreak's regex saving feature


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]