Skip to contentSkip to conversation

cannot debug multi-threaded programs with gdb/gdbserver

DISCUSSION Stuart Hughes 4 participants 8 messages Sep 17, 2002 – Sep 18, 2002 MIPS

lore
Share & tools
lore
#0 lore raw

Hi,

I managed to get gdb to do multi-threaded debug using a gdb on the target, after Daniel J helped with a patch to sys/procfs.h

I am now trying to do host target with gdb/gdbserver. The program on the target uses pthreads.

I can connect, but as soon as you try to continue (to a breakpoint) I get:

Program received signal SIG32, Real-time event 32.
warning: Warning: GDB can't find the start of the function at 0x2abee684.
....

I know that SIG32 is used for the thread control on the target, but I'm not sure if the host gdb is supposed to receive this. I tried "set handle SIG32 pass noprint nostop"
and variations, but this didn't help.

Does anyone know whether there is some special setup needed on gdb/gdbserver to use the multi-threaded gdbserver ??

My environment is as follows:

CPU: NEC VR5432
kernel: linux-2.4.18 + patches
glibc: 2.2.3 + patches
gdb: 5.2/3 from CVS
gcc: 3.1
binutils: Version 2.11.90.0.25

cross-gdb configured using:

configure --prefix=/usr --target=mipsel-linux --disable-sim --disable-tcl --enable-threads --enable-shared

gdbserver configured using:

configure --prefix=/usr --host=mipsel-linux --target=mipsel-linux --enable-threads --enable-shared

Regards, Stuart

#1 lore raw
Quoted 4 lines · Stuart Hughes

Does anyone know whether there is some special setup needed on gdb/gdbserver to use the multi-threaded gdbserver ??

Wow, there are so many things to tell you...where to start...

Quoted 7 lines

My environment is as follows:

CPU: NEC VR5432
kernel: linux-2.4.18 + patches
glibc: 2.2.3 + patches
gdb: 5.2/3 from CVS

Has to be the gdb-5.3 branch...go look at http://sources.redhat.com/gdb

Quoted 3 lines

gcc: 3.1
binutils: Version 2.11.90.0.25

Don't use H.J. Lu's binutils, use the released one. Use gcc-3.2 and binutils-2.13 as they have fixes for the MIPS debugging symbols with regards to DWARF.

Quoted 5 lines

cross-gdb configured using:

configure --prefix=/usr --target=mipsel-linux --disable-sim --disable-tcl --enable-threads --enable-shared

Use '--target=mips-linux' and you'll be better off. Don't worry, it will support both endians.

Quoted 5 lines

gdbserver configured using:

configure --prefix=/usr --host=mipsel-linux --target=mipsel-linux --enable-threads --enable-shared

I would also try 'CC=mipsel-linux-gcc configure <...>'.

-Steve

#2 lore raw
Quoted 6 lines · Steven J. Hill
Quoted 4 lines · Stuart Hughes

Does anyone know whether there is some special setup needed on gdb/gdbserver to use the multi-threaded gdbserver ??

Wow, there are so many things to tell you...where to start...

Steve, have you started memorizing my responses again? :)

Quoted 16 lines
Quoted 7 lines

My environment is as follows:

CPU: NEC VR5432
kernel: linux-2.4.18 + patches
glibc: 2.2.3 + patches
gdb: 5.2/3 from CVS

Has to be the gdb-5.3 branch...go look at http://sources.redhat.com/gdb

Quoted 3 lines

gcc: 3.1
binutils: Version 2.11.90.0.25

Don't use H.J. Lu's binutils, use the released one. Use gcc-3.2 and binutils-2.13 as they have fixes for the MIPS debugging symbols with regards to DWARF.

Quoted 7 lines
Quoted 5 lines

cross-gdb configured using:

configure --prefix=/usr --target=mipsel-linux --disable-sim --disable-tcl --enable-threads --enable-shared

Use '--target=mips-linux' and you'll be better off. Don't worry, it will support both endians.

Except for this one - where'd that come from? It should make no functional difference either way, at least assuming you always give GDB a binary.

Quoted 6 lines
Quoted 5 lines

gdbserver configured using:

configure --prefix=/usr --host=mipsel-linux --target=mipsel-linux --enable-threads --enable-shared

I would also try 'CC=mipsel-linux-gcc configure <...>'.

Definitely.

Signature · 2 lines
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer
#3 lore raw
Quoted 4 lines · Daniel Jacobowitz

On Tue, Sep 17, 2002 at 12:24:14PM -0500, Steven J. Hill wrote:

Steve, have you started memorizing my responses again? :)

*gurgle* Yeah, I have. I apologize if it seemed I was taking credit for anything.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

cross-gdb configured using:

configure --prefix=/usr --target=mipsel-linux --disable-sim --disable-tcl --enable-threads --enable-shared

Quoted 8 lines
Quoted 2 lines

Use '--target=mips-linux' and you'll be better off. Don't worry, it will support both endians.

Except for this one - where'd that come from? It should make no functional difference either way, at least assuming you always give GDB a binary.

I got some weird errors (unfortunately I can't remember) if I tried using 'mipsel-linux' as the target. So you're saying that a gdb configured for 'mipsel-linux' or 'mips-linux' should work the same? Thanks Daniel.

-Steve

#4 lore raw
Quoted 18 lines · Steven J. Hill
Quoted 4 lines · Daniel Jacobowitz

On Tue, Sep 17, 2002 at 12:24:14PM -0500, Steven J. Hill wrote:

Steve, have you started memorizing my responses again? :)

*gurgle* Yeah, I have. I apologize if it seemed I was taking credit for anything.

Quoted 10 lines
Quoted 8 lines
Quoted 5 lines

cross-gdb configured using:

configure --prefix=/usr --target=mipsel-linux --disable-sim --disable-tcl --enable-threads --enable-shared

Use '--target=mips-linux' and you'll be better off. Don't worry, it will support both endians.

Quoted 8 lines
Quoted 4 lines

Except for this one - where'd that come from? It should make no functional difference either way, at least assuming you always give GDB a binary.

I got some weird errors (unfortunately I can't remember) if I tried using 'mipsel-linux' as the target. So you're saying that a gdb configured for 'mipsel-linux' or 'mips-linux' should work the same? Thanks Daniel.

Hmm, if you can reproduce these let me know what they are. I use a mipsel GDB regularly.

Signature · 2 lines
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer
#5 lore raw
In reply to Daniel Jacobowitz

Hi Steve/Daniel,

Thanks very much for your help ! I've now got a few days "homework" to try out :-)

Regards, Stuart

Quoted 51 lines · Daniel Jacobowitz
Quoted 6 lines · Steven J. Hill
Quoted 4 lines · Stuart Hughes

Does anyone know whether there is some special setup needed on gdb/gdbserver to use the multi-threaded gdbserver ??

Wow, there are so many things to tell you...where to start...

Steve, have you started memorizing my responses again? :)

Quoted 16 lines
Quoted 7 lines

My environment is as follows:

CPU:         NEC VR5432
kernel:      linux-2.4.18 + patches
glibc:               2.2.3 + patches
gdb:         5.2/3 from CVS

Has to be the gdb-5.3 branch...go look at http://sources.redhat.com/gdb

Quoted 3 lines
gcc:         3.1
binutils:    Version 2.11.90.0.25

Don't use H.J. Lu's binutils, use the released one. Use gcc-3.2 and binutils-2.13 as they have fixes for the MIPS debugging symbols with regards to DWARF.

Quoted 7 lines
Quoted 5 lines

cross-gdb configured using:

configure --prefix=/usr --target=mipsel-linux --disable-sim --disable-tcl --enable-threads --enable-shared

Use '--target=mips-linux' and you'll be better off. Don't worry, it will support both endians.

Except for this one - where'd that come from? It should make no functional difference either way, at least assuming you always give GDB a binary.

Quoted 6 lines
Quoted 5 lines

gdbserver configured using:

configure --prefix=/usr --host=mipsel-linux --target=mipsel-linux --enable-threads --enable-shared

I would also try 'CC=mipsel-linux-gcc configure <...>'.

Definitely.

--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer

#6 lore raw
In reply to Steven J. Hill
Quoted 4 lines · Steven J. Hill
Quoted 3 lines · Stuart Hughes

Does anyone know whether there is some special setup needed on gdb/gdbserver to use the multi-threaded gdbserver ??

...

Quoted 5 lines
Quoted 2 lines

binutils: Version 2.11.90.0.25

Don't use H.J. Lu's binutils, use the released one. Use gcc-3.2 and binutils-2.13 as they have fixes for the MIPS debugging symbols with regards to DWARF.

Is this a general recommendation to avoid H.J. Lu's binutils, or do you just favor the newer binutils version?
What about binutils 2.13.90.0.4?

I'm currently using gcc-2.95.4 with the Debian patches, and binutils binutils-2.12.90.0.14, which seem to work well. I planned to switch to gcc-3.2 but postponed it because I read about the DWARF debugging problems. Are they solved with gcc-3.2 / binutils-2.13 / gdb-5.3-CVS ?

Regards,
Johannes

#7 lore raw
Quoted 16 lines · Johannes Stezenbach
Quoted 4 lines · Steven J. Hill
Quoted 3 lines · Stuart Hughes

Does anyone know whether there is some special setup needed on gdb/gdbserver to use the multi-threaded gdbserver ??

...

Quoted 5 lines
Quoted 2 lines

binutils: Version 2.11.90.0.25

Don't use H.J. Lu's binutils, use the released one. Use gcc-3.2 and binutils-2.13 as they have fixes for the MIPS debugging symbols with regards to DWARF.

Is this a general recommendation to avoid H.J. Lu's binutils, or do you just favor the newer binutils version?
What about binutils 2.13.90.0.4?

Quoted 5 lines

I'm currently using gcc-2.95.4 with the Debian patches, and binutils binutils-2.12.90.0.14, which seem to work well. I planned to switch to gcc-3.2 but postponed it because I read about the DWARF debugging problems. Are they solved with gcc-3.2 / binutils-2.13 / gdb-5.3-CVS ?

Yes, they are fixed.

Signature · 2 lines
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer