[Bug nptl/20311] please install proc_service.h

palves at redhat dot com sourceware-bugzilla@sourceware.org
Fri Jul 22 19:03:00 GMT 2016


https://sourceware.org/bugzilla/show_bug.cgi?id=20311

--- Comment #15 from Pedro Alves <palves at redhat dot com> ---
I assume he meant:

 https://sourceware.org/ml/gdb/2016-07/msg00006.html

> The API definitions seem to have drifted a bit, e.g.:
> 
> --- glibc/git/nptl_db/proc_service.h
> +++ binutils-gdb/gdb/gdb_proc_service.h
>> -extern ps_err_e ps_pstop (const struct ps_prochandle *);
> -extern ps_err_e ps_pcontinue (const struct ps_prochandle *);
> +extern ps_err_e ps_pstop (struct ps_prochandle *);
> +extern ps_err_e ps_pcontinue (struct ps_prochandle *);

ps_get_thread_area has const too:

 $ grep "const struct" src/nptl_db/proc_service.h
 extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
 extern ps_err_e ps_pstop (const struct ps_prochandle *);
 extern ps_err_e ps_pcontinue (const struct ps_prochandle *);
 extern ps_err_e ps_lstop (const struct ps_prochandle *, lwpid_t);
 extern ps_err_e ps_lcontinue (const struct ps_prochandle *, lwpid_t);

There are a bunch of other methods that have a struct ps_prochandle
pointer parameter that is not const.  Why are these different?  I have no idea.

Note that the original solaris version did not have the consts:

 https://docs.oracle.com/cd/E36784_01/html/E36878/ps-pstop-3proc.html

https://docs.oracle.com/cd/E36784_01/html/E36878/proc-service-3proc.html#REFMAN3Hproc-service-3proc

which makes sense to me.  ps_prochandle is the "callback" data passed around
owned by the libthread_db client, so why shouldn't the client be able to modify
the object?

I think that in GDB's git commit a298c5e8129b ("Import fallback definitions
from glibc."), the fallback definitions for ps_pstop/ps_pcontinue were added
without the const, because the _implementations_ in gdb/proc-service.c did not
have the const, so the compiler would complain about the mismatch otherwise.

ps_pstop and ps_pcontinue have since been removed from gdb/proc-service.c (a
GNU/Linux specific file) though, as they are actually not used by glibc's
libthread_db.so.  So for recent GDB's, it's fine to remove those declarations
instead.  Older gdb's rebuilt on a system with such an installed header would
probably warn about the mismatc, but gdb releases are built without -Werror, so
should be fine.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list