Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

gdb 6.0 with nptl glibc

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
15 posts • Page 1 of 1
Author
Message
mulicheng
n00b
n00b
Posts: 11
Joined: Tue Jun 03, 2003 12:34 pm

gdb 6.0 with nptl glibc

  • Quote

Post by mulicheng » Wed Mar 10, 2004 3:31 am

In the info page for gdb under threads, I read the following:

_Warning:_ These facilities are not yet available on every GDB
configuration where the operating system supports threads. If
your GDB does not support threads, these commands have no effect.
For example, a system without thread support shows no output from
`info threads', and always rejects the `thread' command, like this:

(gdb) info threads
(gdb) thread 1
Thread ID 1 not known. Use the "info threads" command to
see the IDs of currently known threads.


My system is 2.6.x kernel with glibc 2.3.2-r9+nptl and gdb 6.0.

I was under the impression that gdb 6.0 should have no problem with nptl. Unfortunately, I get the output as described above. Furthermore, If I set a breakpoint someplace where a different thread will find it, gdb terminates the program. Is there anything special you have to do?

Anyone have this type of system working properly and are able to debug a program with multiple threads?
My favorite object oriented high level programming language is assembly.
Top
()
l33t
l33t
Posts: 610
Joined: Mon Nov 25, 2002 4:10 pm

  • Quote

Post by () » Wed Mar 10, 2004 10:41 am

I do some multi threaded programming, but normally I don't set breakpoints within the other thread, since its meant to operate in realtime (audio). But now that you mention it, GDB does exit when the breakpoint is hit within the thread procedure ('Program terminated with signal SIGTRAP, Trace/breakpoint trap'). Maybe a bug within NPTL? GDB doesn't normally inform of started threads either, as it used to do with LinuxThreads.

Its funny you should ask about this now, since I was stepping through NPTL code yesterday in order to track down a possible bug, NPTL ignores scheduling attributes, it turns out these attributes (set with pthread_attr_setsched*) are blatantly overlooked. Its such an obvious error, and I think it was already reported on the fedora-devel list in february, so maybe theyre aware of it by now? Where should I eventually file this bug you think, Fedora (are there any fora dedicated to NTPL development)?

Edit: Seems Mr. Drepper has addressed the attribute bug at least in NPTL CVS.
Top
mulicheng
n00b
n00b
Posts: 11
Joined: Tue Jun 03, 2003 12:34 pm

  • Quote

Post by mulicheng » Wed Mar 10, 2004 3:30 pm

() wrote:I do some multi threaded programming, but normally I don't set breakpoints within the other thread, since its meant to operate in realtime (audio). But now that you mention it, GDB does exit when the breakpoint is hit within the thread procedure ('Program terminated with signal SIGTRAP, Trace/breakpoint trap'). Maybe a bug within NPTL? GDB doesn't normally inform of started threads either, as it used to do with LinuxThreads.
That's exactly what I get. It all works fine for me w/ out NPTL, with however, no thread creation is noticed by gdb.
() wrote:Its funny you should ask about this now, since I was stepping through NPTL code yesterday in order to track down a possible bug, NPTL ignores scheduling attributes, it turns out these attributes (set with pthread_attr_setsched*) are blatantly overlooked. Its such an obvious error, and I think it was already reported on the fedora-devel list in february, so maybe theyre aware of it by now? Where should I eventually file this bug you think, Fedora (are there any fora dedicated to NTPL development)?
I haven't noticed any bugs about this in the bug tracker. I wonder if it would be possible to recompile glibc with a later version of NPTL and if that would fix the issue. Unfortunately, I really need to debug my program quickly instead of debug gdb w/ threads. Maybe someone has already tackled this issue and can post a solution.
My favorite object oriented high level programming language is assembly.
Top
()
l33t
l33t
Posts: 610
Joined: Mon Nov 25, 2002 4:10 pm

  • Quote

Post by () » Wed Mar 10, 2004 3:43 pm

I am recompiling a patched (diffed from latest NPTL CVS) glibc right now, I doubt it will help with debugging though ... Btw, I think GDB would report thread creation when I had compiled glibc with debug information, in fact it reported a new LWP (the main thread?) once I started the program (before I got to pthread_create).
Top
mulicheng
n00b
n00b
Posts: 11
Joined: Tue Jun 03, 2003 12:34 pm

gdb thread debugging with NPTL fixed

  • Quote

Post by mulicheng » Wed Mar 10, 2004 7:01 pm

I recompiled glibc like this:

FEATURES="nostrip" USE="debug" emerge glibc

That fixed my problem.
My favorite object oriented high level programming language is assembly.
Top
()
l33t
l33t
Posts: 610
Joined: Mon Nov 25, 2002 4:10 pm

  • Quote

Post by () » Wed Mar 10, 2004 8:14 pm

Ok, so debugging information did the trick. Good to know.
Top
tyreth
Apprentice
Apprentice
Posts: 238
Joined: Mon May 27, 2002 6:35 am
Location: Melbourne, Australia
Contact:
Contact tyreth
Website

Re: gdb thread debugging with NPTL fixed

  • Quote

Post by tyreth » Fri Mar 12, 2004 1:19 am

mulicheng wrote:I recompiled glibc like this:

FEATURES="nostrip" USE="debug" emerge glibc

That fixed my problem.
Completely curiosity, but how did you work out to do this to solve the problem?
Top
mulicheng
n00b
n00b
Posts: 11
Joined: Tue Jun 03, 2003 12:34 pm

Re: gdb thread debugging with NPTL fixed

  • Quote

Post by mulicheng » Fri Mar 12, 2004 1:28 am

tyreth wrote:Completely curiosity, but how did you work out to do this to solve the problem?
Well, I thought it might be something to do with no debugging information in the nptl library. Got the following information from gentoolkit's euse utility:

Code: Select all

# euse -i debug
debug [-] [ ] [G] Tells configure and the makefiles to build for debugging.
                  Effects vary acrosss packages, but generally it will at
                  least add -g to CFLAGS. Remember to set FEATURES+=nostrip
                  too.

I tried it and it worked thankfully.
My favorite object oriented high level programming language is assembly.
Top
cjensen
n00b
n00b
Posts: 5
Joined: Sun Aug 17, 2003 3:56 pm

Re: gdb thread debugging with NPTL fixed

  • Quote

Post by cjensen » Mon Mar 15, 2004 7:43 pm

i'm really interested in the solution as well. if you don't mind i have a couple questions. i've browsed gdb's web page but didn't find anything that addressed these problems.

i don't understand why glibc needs to be compiled with debug info. why would that affect gdb's thread debugging capabilities? was this an issue with the older linuxthreads ? is there a plan to fix this in the near future? i dunno...i dont like the idea of running glibc in debug (wouldn't that potentially slow down the rest of the system)? would there be a way of having 2 versions of glibc and gcc and being able to switch easily between them?

while were at it (off topic), did anyone notice that gcc 3.3 produces huge objects when compiled with debug info? i refer to an earlier post i made:

http://forums.gentoo.org/viewtopic.php? ... ht=#563441

now that gcc 3.3 has been unmasked i'm getting the same problems as i did before. the library i'm developping quadrupled in size when compiled with debug....

in any case thanks for the fix.
Chris
mulicheng wrote:
tyreth wrote:Completely curiosity, but how did you work out to do this to solve the problem?
Well, I thought it might be something to do with no debugging information in the nptl library. Got the following information from gentoolkit's euse utility:

Code: Select all

# euse -i debug
debug [-] [ ] [G] Tells configure and the makefiles to build for debugging.
                  Effects vary acrosss packages, but generally it will at
                  least add -g to CFLAGS. Remember to set FEATURES+=nostrip
                  too.

I tried it and it worked thankfully.
Top
mulicheng
n00b
n00b
Posts: 11
Joined: Tue Jun 03, 2003 12:34 pm

Re: gdb thread debugging with NPTL fixed

  • Quote

Post by mulicheng » Mon Mar 15, 2004 8:05 pm

cjensen wrote:i don't understand why glibc needs to be compiled with debug info. why would that affect gdb's thread debugging capabilities? was this an issue with the older linuxthreads?
This was not an issue with the older linuxthreads. I was able to debug the same program on a different system without a debug build of glibc. I'm not sure why the debug build is now needed, but I, like you, would rather not have to build glibc with debug mode.
cjensen wrote:i dont like the idea of running glibc in debug (wouldn't that potentially slow down the rest of the system)?
I don't think that speed is affected, I'm not a very reliable authority on glibc or anything though. I think it just makes the executable/library sizes a lot bigger like you mentioned.
My favorite object oriented high level programming language is assembly.
Top
lplatypus
n00b
n00b
Posts: 16
Joined: Fri Mar 26, 2004 6:38 am

  • Quote

Post by lplatypus » Tue Mar 30, 2004 2:54 am

I encountered the same problem. I found that to fix it, I needed only to specify

Code: Select all

FEATURES="nostrip"
there was no need to specify

Code: Select all

USE="debug"
(This is using glibc-2.3.3_pre20040207.ebuild)
Top
mulicheng
n00b
n00b
Posts: 11
Joined: Tue Jun 03, 2003 12:34 pm

  • Quote

Post by mulicheng » Tue Mar 30, 2004 3:08 am

Yup, I've hence found that same thing, there is no need to compile in debug mode. It is the nostrip FEATURE that fixes this issue.
My favorite object oriented high level programming language is assembly.
Top
pelckyboy
n00b
n00b
Posts: 36
Joined: Sat May 10, 2003 7:53 pm

  • Quote

Post by pelckyboy » Sat Jul 10, 2004 10:52 am

Works like a charm !!! only the FEATURES="nostrip" is necessary. Thanks so much for the info !!! I'm looking for months now why my gdb was not working with threads... Shouldn't someone enter a bug in bugzilla so this issue is resolved ?
Top
luked
n00b
n00b
Posts: 19
Joined: Tue Sep 17, 2002 6:52 am

link to bugzilla bug

  • Quote

Post by luked » Sun Jul 11, 2004 10:38 pm

pelckyboy wrote:Shouldn't someone enter a bug in bugzilla so this issue is resolved ?
I already have: http://bugs.gentoo.org/show_bug.cgi?id=46186
Top
Cicero
Apprentice
Apprentice
Posts: 220
Joined: Mon Jul 21, 2003 3:52 pm

  • Quote

Post by Cicero » Mon Jul 12, 2004 4:40 am

The only file that shouldn't be stripped is libpthread. If you want a slim glibc, you can compile it unstripped, copy libpthread somewhere, rebuild glibc normally, and then copy libpthread back.
Top
Post Reply

15 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic