This is the mail archive of the gdb-prs@sources.redhat.com 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]

breakpoints/1712: 32 bit GDB fails to stop at break point, when breakpoint is set on a thread function


>Number:         1712
>Category:       breakpoints
>Synopsis:       32 bit GDB fails to stop at break point, when breakpoint is set on a thread function
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 16 15:38:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Manoj Iyer
>Release:        Mainline CVS tree
>Organization:
>Environment:
PowerPC 64 machine, running SLES.
>Description:
32 bit GDB is unable to stop at a breakpoint that is set at a thread function in a multi-threaded program. This happens in the mainline version of the GDB code on a Powerpc64 arch machine running SLES. I have attached a testcase that can be used to re-create this problem.

Here is the output.
-------------------
madcow:/home/public/test-tools/gdb # gdb tbug 
GNU gdb 6.1 
Copyright 2004 Free Software Foundation, Inc. 
GDB is free software, covered by the GNU General Public License, and you are 
welcome to change it and/or distribute copies of it under certain conditions. 
Type "show copying" to see the conditions. 
There is absolutely no warranty for GDB.  Type "show warranty" for details. 
This GDB was configured as "ppc-suse-linux"...Using host libthread_db library 
"/lib/tls/libthread_db.so.1". 
 
(gdb) break main 
Breakpoint 1 at 0x10000630: file tbug.c, line 31. 
(gdb) run 
Starting program: /home/public/test-tools/gdb/tbug 
[Thread debugging using libthread_db enabled] 
[New Thread 1074020384 (LWP 26705)] 
[Switching to Thread 1074020384 (LWP 26705)] 
 
Breakpoint 1, main (argc=1, argv=0xffffe464) at tbug.c:31 
31        for (n = 0; n < N; ++n) 
(gdb) cont 
Continuing. 
[New Thread 1078217504 (LWP 26708)] 
tf(0): begin 
[New Thread 1082411808 (LWP 26709)] 
after create 
tf(1): begin 
tf(0): end 
[Thread 1078217504 (LWP 26708) exited] 
tf(1): end 
[Thread 1082411808 (LWP 26709) exited] 
after join 
 
Program exited normally. 
(gdb) clear main 
Deleted breakpoint 1 
(gdb) break tf 
Breakpoint 2 at 0x10000594: file tbug.c, line 15. 
(gdb) run 
Starting program: /home/public/test-tools/gdb/tbug 
[Thread debugging using libthread_db enabled] 
[New Thread 1074020384 (LWP 26710)] 
reading register pc (#64): No such process. 
(gdb) cont 
Continuing. 
reading register pc (#64): No such process. 
(gdb) quit 
The program is running.  Exit anyway? (y or n) y 
---------------------------------------------------

64bit GDB works fine!

The error message that we are seeing comes from 
ppc-linux-nat.c file here is the piece of code...

----------- code --------------

      *(PTRACE_XFER_TYPE *) & buf[bytes_transferred]
        = ptrace (PT_READ_U, tid, (PTRACE_ARG3_TYPE) regaddr, 0);
      regaddr += sizeof (PTRACE_XFER_TYPE);
      if (errno != 0)
        {
          char message[128];
          sprintf (message, "reading register %s (#%d)",
                   REGISTER_NAME (regno), regno);
          perror_with_name (message);
        }
    }
--------------------------------------------------------------
>How-To-Repeat:
1. get latest mainline CVS version of GDB
2. build gdb as a 32bit executable
3. compile the testcase as a 32bit app. cc -o tbug32 -g dwarf-2 tbug.c -lpthread
4. src/gdb/gdb ./tbug32 and execute  thseGDB commands.
5.  br main
6.  br tf
7.  run
8.  c
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-csrc; name="tbug.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="tbug.c"

I2luY2x1ZGUgPHN0cmluZy5oPgojaW5jbHVkZSA8dW5pc3RkLmg+CiNpbmNsdWRlIDxwdGhyZWFk
Lmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxlcnJu
by5oPgoKI2RlZmluZSBOICAgICAgIDIKCnN0YXRpYyB2b2lkICoKdGYgKHZvaWQgKmFyZykKewog
IGludCBuID0gKGludCkgKGxvbmcgaW50KSBhcmc7CiAgY2hhciBudW1iZXJbMTYwXTsKICBzcHJp
bnRmKG51bWJlciwgInRmKCVsZCk6IGJlZ2luIiwgKGxvbmcpYXJnKTsKICBwdXRzIChudW1iZXIp
OwoKIHNsZWVwICgxMCk7CiAgc3ByaW50ZihudW1iZXIsICJ0ZiglbGQpOiBlbmQiLCAobG9uZylh
cmcpOwogIHB1dHMgKG51bWJlcik7CiAgcmV0dXJuIE5VTEw7Cn0KCmludCBtYWluIChpbnQgYXJn
YywgY2hhciAqYXJndltdKQp7CiAgaW50IG47CiAgcHRocmVhZF90IHRoW05dOwoKICBmb3IgKG4g
PSAwOyBuIDwgTjsgKytuKQogICAgaWYgKHB0aHJlYWRfY3JlYXRlICgmdGhbbl0sIE5VTEwsIHRm
LCAodm9pZCAqKSAobG9uZyBpbnQpIG4pICE9IDApCiAgICAgIHsKICAgICAgICBzbGVlcCgyKTsK
ICAgICAgICBwdXRzICgiY3JlYXRlIGZhaWxlZCIpOwogICAgICAgIGV4aXQgKDEpOwogICAgICB9
CgogIHB1dHMoImFmdGVyIGNyZWF0ZSIpOwoKICBmb3IgKG4gPSAwOyBuIDwgTjsgKytuKQogICAg
aWYgKHB0aHJlYWRfam9pbiAodGhbbl0sIE5VTEwpICE9IDApCiAgICAgIHsKICAgICAgICBwdXRz
ICgiam9pbiBmYWlsZWQiKTsKICAgICAgICBleGl0ICgxKTsKICAgICAgfQoKCiAgcHV0cygiYWZ0
ZXIgam9pbiIpOwogIHJldHVybiAwOwp9Cg==


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