public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/14844] New: Tracepoints are not reinserted in reloaded libraries.
@ 2012-11-15 13:21 m.lesniewski at samsung dot com
  2012-11-15 14:05 ` [Bug breakpoints/14844] " m.lesniewski at samsung dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: m.lesniewski at samsung dot com @ 2012-11-15 13:21 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14844

             Bug #: 14844
           Summary: Tracepoints are not reinserted in reloaded libraries.
           Product: gdb
           Version: 7.5
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
        AssignedTo: unassigned@sourceware.org
        ReportedBy: m.lesniewski@samsung.com
    Classification: Unclassified


Created attachment 6738
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6738
Example program, library and test script

Tracepoints in shared libraries are not reinserted if the library is unloaded
and loaded back again.

Here's the scenario that illustrates this in detail:
1. A process loads a shared library explicitly using dlload
2. GDB Server attaches to the process
3. The user starts GDB; attaches to the remote target; defines a tracepoint in
the loaded library; starts the trace experiment (using tstart) and lets the
program continue;
4. The process unloads the library using dlclose;
5. The process loads the library again using dlload;

After this, the tracepoint is not inserted. No traceframes are created when
execution reaches the tracepoint location. 

I attached a simple example, which allows to reproduce the error. In the
archive there are two source files -- one for the program and one for the
library. 

The program loads the library, calls a function named "foo" from the library
ten times and unloads the library. This is repeated 10 times, so "foo" is
called 100 times in total. 

In the archive there is also a script run-test.sh, which builds the binaries,
starts gdbserver and gdb. GDB executes another script, which sets a tracepoint
in the library, launches the trace experiment and displays the number of
tracepoint hits just before the process exits.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug breakpoints/14844] Tracepoints are not reinserted in reloaded libraries.
  2012-11-15 13:21 [Bug breakpoints/14844] New: Tracepoints are not reinserted in reloaded libraries m.lesniewski at samsung dot com
  2012-11-15 14:05 ` [Bug breakpoints/14844] " m.lesniewski at samsung dot com
@ 2012-11-15 14:05 ` m.lesniewski at samsung dot com
  2012-11-15 14:21 ` qiyao at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: m.lesniewski at samsung dot com @ 2012-11-15 14:05 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14844

Michał Leśniewski <m.lesniewski at samsung dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |m.lesniewski at samsung dot
                   |                            |com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug breakpoints/14844] Tracepoints are not reinserted in reloaded libraries.
  2012-11-15 13:21 [Bug breakpoints/14844] New: Tracepoints are not reinserted in reloaded libraries m.lesniewski at samsung dot com
@ 2012-11-15 14:05 ` m.lesniewski at samsung dot com
  2012-11-15 14:05 ` m.lesniewski at samsung dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: m.lesniewski at samsung dot com @ 2012-11-15 14:05 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14844

Michał Leśniewski <m.lesniewski at samsung dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |http://sourceware.org/bugzi
                   |                            |lla/show_bug.cgi?id=14845

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug breakpoints/14844] Tracepoints are not reinserted in reloaded libraries.
  2012-11-15 13:21 [Bug breakpoints/14844] New: Tracepoints are not reinserted in reloaded libraries m.lesniewski at samsung dot com
  2012-11-15 14:05 ` [Bug breakpoints/14844] " m.lesniewski at samsung dot com
  2012-11-15 14:05 ` m.lesniewski at samsung dot com
@ 2012-11-15 14:21 ` qiyao at gcc dot gnu.org
  2012-11-15 14:47 ` palves at redhat dot com
  2012-11-15 14:55 ` palves at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: qiyao at gcc dot gnu.org @ 2012-11-15 14:21 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14844

Yao Qi <qiyao at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |qiyao at gcc dot gnu.org

--- Comment #1 from Yao Qi <qiyao at gcc dot gnu.org> 2012-11-15 14:21:03 UTC ---
First of all, the test case is great!  Thanks.

Running 'run-test.sh' can expose the problem on GDB trunk, but a little bit
differently,

---------------------------------------
$ ./run-test.sh 
make: Nothing to be done for `all'.
Process ./bar created; pid = 26114
Listening on port 7777
Python Exception <type 'exceptions.ImportError'> No module named gdb: 

warning: Could not load the Python gdb module from
`/usr/local/share/gdb/python'.

warning: Limited Python support is available from the _gdb module.
Remote debugging from host 127.0.0.1
0x4ce4c2b0 in _start () from /lib/ld-linux.so.2
Breakpoint 1 at 0x80485cc: file bar.c, line 15.

Breakpoint 1, load_lib () at bar.c:15
15          printf("Loading libfoo.so\n");
Loading libfoo.so
main () at bar.c:42
42              
Tracepoint 2 at 0xb7ffb416: file foo.c, line 5.
Breakpoint 3 at 0x80486ba: file bar.c, line 45.
        1
        2
Unloading libfoo.so
warning: Temporarily disabling breakpoints for unloaded shared library
"./libfoo.so"
Loading libfoo.so
Error in re-setting breakpoint 2: Target returns error code '01'.
Error in re-setting breakpoint 3: Target returns error code '01'.
gdb-script:9: Error in sourced command file:
Target returns error code '01'.
Killing all inferiors
----------------------------------------------------------

It is related to breakpoint re-setting, afaics.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug breakpoints/14844] Tracepoints are not reinserted in reloaded libraries.
  2012-11-15 13:21 [Bug breakpoints/14844] New: Tracepoints are not reinserted in reloaded libraries m.lesniewski at samsung dot com
                   ` (2 preceding siblings ...)
  2012-11-15 14:21 ` qiyao at gcc dot gnu.org
@ 2012-11-15 14:47 ` palves at redhat dot com
  2012-11-15 14:55 ` palves at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: palves at redhat dot com @ 2012-11-15 14:47 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14844

Pedro Alves <palves at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |palves at redhat dot com

--- Comment #2 from Pedro Alves <palves at redhat dot com> 2012-11-15 14:47:17 UTC ---
Tracepoints and dynamic loading/unloading of shared libraries just don't mix up
well today.  Consider e.g., your program dlopens a library, and you set a
tracepoint somewhere in the DSO.  Then you tstart, and let the program
continue.  The tracepoint it hit, and before you tstop, the program dlcloses
the library.  You now tstop, and tfind to inspect the tracepoint hit, but that
will be broken, because the library is no longer loaded.

Your example is just another instance of this issue.  There's no guarantee the
second time libfoo.so is loaded it is even loaded at the same address.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug breakpoints/14844] Tracepoints are not reinserted in reloaded libraries.
  2012-11-15 13:21 [Bug breakpoints/14844] New: Tracepoints are not reinserted in reloaded libraries m.lesniewski at samsung dot com
                   ` (3 preceding siblings ...)
  2012-11-15 14:47 ` palves at redhat dot com
@ 2012-11-15 14:55 ` palves at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: palves at redhat dot com @ 2012-11-15 14:55 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14844

Pedro Alves <palves at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |14847

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-11-15 14:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-15 13:21 [Bug breakpoints/14844] New: Tracepoints are not reinserted in reloaded libraries m.lesniewski at samsung dot com
2012-11-15 14:05 ` [Bug breakpoints/14844] " m.lesniewski at samsung dot com
2012-11-15 14:05 ` m.lesniewski at samsung dot com
2012-11-15 14:21 ` qiyao at gcc dot gnu.org
2012-11-15 14:47 ` palves at redhat dot com
2012-11-15 14:55 ` palves at redhat dot com

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