[PATCH] Export stack_used as __stack_used

Pedro Alves palves@redhat.com
Fri Jun 17 22:15:00 GMT 2016


On 06/17/2016 09:17 PM, Florian Weimer wrote:
> 
>>> If the variable remains nptl-internal, I expect that you could turn
>>> it into a hidden symbol, and keep its current name.
>>
>> I may be wrong but I think its the rename that fixes the GDB bug.
> 
> Only if GDB explicitly searches for __stack_used (and that with the help
> of debugging information because it's not exported).

Note that it's not GDB that _wants_ to search for the symbol, it's
libthread_db.so itself.  GDB just serves libthread_db.so's request,
through the proc_service [1] interface (nptl_db/proc_service.h).  That is,
through callbacks that serve as interface between libthread_db and
the debugger that loads it.

[1] based on Solaris's interface of the same name:
 http://docs.oracle.com/cd/E26505_01/html/816-5171/proc-service-3proc.html

> 
> There isn't even a reference from libthread_db.

AFAICS, the look ups in question are here:

 nptl_db/td_thr_validate.c:73:      err = DB_GET_SYMBOL (list, th->th_ta_p, stack_used);
 nptl_db/td_ta_thr_iter.c:164:    err = DB_GET_SYMBOL (list, ta, stack_used);

I think that nptl_version is another symbol that can potentially
cause the same problem:

 nptl_db/structs.def:51:DB_SYMBOL (stack_used)
 nptl_db/structs.def:52:DB_SYMBOL (__stack_user)
 nptl_db/structs.def:53:DB_SYMBOL (nptl_version)
 nptl_db/structs.def:56:DB_SYMBOL (__nptl_threads_events)

(Obviously it's less likely, given the "nptl" prefix, but still...)

Thanks,
Pedro Alves



More information about the Libc-alpha mailing list