[uClibc] Problems with pthreads / MIPS

Erik Andersen andersen at codepoet.org
Thu Jul 10 20:44:35 UTC 2003


On Thu Jul 10, 2003 at 02:06:11PM +0100, Stuart Hughes wrote:
> Hi Thomas,
> 
> I've see similar problems.  I've been testing a c++ application with a
> large number of pthreads, this hangs during initialisation.  I've not be
> able to debug it as I've not be able to build a gdb (host or target)
> that works correctly with pthreads.

See uClibc/ldso/ldso/ldso.c around line 440, where it says: 

    #warning "Debugging threads on mips won't work till someone fixes this..."

At one point sjhill mentioned he would look into this, but until
someone addresses that, debugging pthreads on mips won't work.

I suspect that on mips, the step of scanning the PT_DYNAMIC
dynamic linking information and assigning a struct r_debug when a
DT_DEBUG dynamic entry is found, probably needs to occur right
before we transfer control to the application.  It doesn't work
in the current location since, for mips, one needs to do all
sorts of relocation processing first.

As a quick try, you could try adding something like this right
before we transfer control to the application.  Does that help?

#if defined(__mips__) 
    {
        elf_phdr *ppnt;
        int i;

        ppnt = (elf_phdr *) auxvt[AT_PHDR].a_un.a_ptr;
        for (i = 0; i < auxvt[AT_PHNUM].a_un.a_val; i++, ppnt++)
            if (ppnt->p_type == PT_DYNAMIC) {
                dpnt = (Elf32_Dyn *) ppnt->p_vaddr;
                while (dpnt->d_tag) {
                    if (dpnt->d_tag == DT_DEBUG) {
                        dpnt->d_un.d_val = (unsigned long) debug_addr;
                    }
                    dpnt++;
                }
            }
    }
#endif

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the uClibc mailing list