Sync proc_service.h ps_get_thread_area definition with GDB

Message ID 1471463656-16530-1-git-send-email-adhemerval.zanella@linaro.org
State Dropped
Headers

Commit Message

Adhemerval Zanella Aug. 17, 2016, 7:54 p.m. UTC
  Commit "Update and install proc_service.h [BZ #20311]" (b381a388) removed
some extraneous 'const' from ps_{s,l}{stop,continue}, however it wrongly
removed 'const' from ps_get_thread_area.  With current definition GDB
fails to build against glibc master with a conflicting type.

This patch sync with GDB definition on 'gdb/gdb_proc_service.h'.

	* nptl_db/proc_service.h (ps_get_thread_area): Add const on struct
	ps_prochandle argument.
---
 ChangeLog              | 5 +++++
 nptl_db/proc_service.h | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
  

Comments

Tom Tromey Aug. 17, 2016, 8:04 p.m. UTC | #1
>>>>> "Adhemerval" == Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:

Adhemerval> Commit "Update and install proc_service.h [BZ #20311]" (b381a388) removed
Adhemerval> some extraneous 'const' from ps_{s,l}{stop,continue}, however it wrongly
Adhemerval> removed 'const' from ps_get_thread_area.  With current definition GDB
Adhemerval> fails to build against glibc master with a conflicting type.

This was intentional, see comment #15.

The idea is that it doesn't make sense for libthread_db to decide that
the argument must be const -- the implementer might want to modify the
object for some reason.

I think it would be more correct to change gdb.

Tom
  
Adhemerval Zanella Aug. 17, 2016, 8:10 p.m. UTC | #2
On 17/08/2016 17:04, Tom Tromey wrote:
>>>>>> "Adhemerval" == Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> 
> Adhemerval> Commit "Update and install proc_service.h [BZ #20311]" (b381a388) removed
> Adhemerval> some extraneous 'const' from ps_{s,l}{stop,continue}, however it wrongly
> Adhemerval> removed 'const' from ps_get_thread_area.  With current definition GDB
> Adhemerval> fails to build against glibc master with a conflicting type.
> 
> This was intentional, see comment #15.
> 
> The idea is that it doesn't make sense for libthread_db to decide that
> the argument must be const -- the implementer might want to modify the
> object for some reason.
> 
> I think it would be more correct to change gdb.
> 
> Tom
> 

I do not have a strong preference here and it seems it would be
feasible to remove constness from GDB.  I check on GDB side then.
  

Patch

diff --git a/nptl_db/proc_service.h b/nptl_db/proc_service.h
index 109962d..6b2e7ff 100644
--- a/nptl_db/proc_service.h
+++ b/nptl_db/proc_service.h
@@ -69,7 +69,7 @@  extern pid_t ps_getpid (struct ps_prochandle *);
 /* Fetch the special per-thread address associated with the given LWP.
    This call is only used on a few platforms (most use a normal register).
    The meaning of the `int' parameter is machine-dependent.  */
-extern ps_err_e ps_get_thread_area (struct ps_prochandle *,
+extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
 				    lwpid_t, int, psaddr_t *);