public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* Patch for linuxthreads_db/td_thr_getgregs.c
@ 2000-01-11 11:28 Andreas Jaeger
  2000-01-11 12:07 ` Andreas Jaeger
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Jaeger @ 2000-01-11 11:28 UTC (permalink / raw)
  To: GNU libc hacker

I received the following error message while compiling glibc 2.2 for
Linux/MIPS:

td_thr_getgregs.c: In function `td_thr_getgregs':
td_thr_getgregs.c:38: incompatible types in initialization
td_thr_getgregs.c:38: incompatible type for argument 1 of `memset'

The function declaration is wrong.  A patch is appended.  The patch is
against glibc 2.2 but also needed for glibc 2.1.3.

Andreas

2000-01-11  Andreas Jaeger  <aj@suse.de>

	* thread_db.h: Fix second argument of td_thr_getgregs.
	* td_thr_getgregs.c (td_thr_getgregs): Likewise.


============================================================
Index: linuxthreads_db/td_thr_getgregs.c
--- linuxthreads_db/td_thr_getgregs.c	1999/11/02 23:40:25	1.2
+++ linuxthreads_db/td_thr_getgregs.c	2000/01/11 19:17:31
@@ -1,5 +1,5 @@
 /* Get a thread's general register set.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
@@ -22,7 +22,7 @@
 
 
 td_err_e
-td_thr_getgregs (const td_thrhandle_t *th, prgregset_t gregs)
+td_thr_getgregs (const td_thrhandle_t *th, prgregset_t *gregs)
 {
   struct _pthread_descr_struct pds;
 
============================================================
Index: linuxthreads_db/thread_db.h
--- linuxthreads_db/thread_db.h	1999/11/03 05:33:23	1.6
+++ linuxthreads_db/thread_db.h	2000/01/11 19:17:32
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -372,7 +372,7 @@
 
 /* Retrieve general register contents of process running thread TH.  */
 extern td_err_e td_thr_getgregs (const td_thrhandle_t *__th,
-				 prgregset_t __gregs);
+				 prgregset_t *__gregs);
 
 /* Retrieve extended register contents of process running thread TH.  */
 extern td_err_e td_thr_getxregs (const td_thrhandle_t *__th, void *__xregs);

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Patch for linuxthreads_db/td_thr_getgregs.c
  2000-01-11 11:28 Patch for linuxthreads_db/td_thr_getgregs.c Andreas Jaeger
@ 2000-01-11 12:07 ` Andreas Jaeger
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Jaeger @ 2000-01-11 12:07 UTC (permalink / raw)
  To: GNU libc hacker

The patch wasn't complete - here's a complete one which also work ;-).

Uli, if those function declarations are indeed correct (which I
doubt), you need to change td_thr_getgregs.c accordingly (memset
(&greg,...)).

Andreas

2000-01-11  Andreas Jaeger  <aj@suse.de>

	* proc_service.h: Correct last arguments of ps_lsetregs and
	ps_lgetregs.

	* thread_db.h: Fix second argument of td_thr_getgregs and
	td_thrsetregs.
	* td_thr_getgregs.c (td_thr_getgregs): Likewise.
	* td_thr_setgregs.c (td_thr_getgregs): Likewise.


============================================================
Index: linuxthreads_db/td_thr_getgregs.c
--- linuxthreads_db/td_thr_getgregs.c	1999/11/02 23:40:25	1.2
+++ linuxthreads_db/td_thr_getgregs.c	2000/01/11 20:03:05
@@ -1,5 +1,5 @@
 /* Get a thread's general register set.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
@@ -22,7 +22,7 @@
 
 
 td_err_e
-td_thr_getgregs (const td_thrhandle_t *th, prgregset_t gregs)
+td_thr_getgregs (const td_thrhandle_t *th, prgregset_t *gregs)
 {
   struct _pthread_descr_struct pds;
 
============================================================
Index: linuxthreads_db/thread_db.h
--- linuxthreads_db/thread_db.h	1999/11/03 05:33:23	1.6
+++ linuxthreads_db/thread_db.h	2000/01/11 20:03:06
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -372,7 +372,7 @@
 
 /* Retrieve general register contents of process running thread TH.  */
 extern td_err_e td_thr_getgregs (const td_thrhandle_t *__th,
-				 prgregset_t __gregs);
+				 prgregset_t *__gregs);
 
 /* Retrieve extended register contents of process running thread TH.  */
 extern td_err_e td_thr_getxregs (const td_thrhandle_t *__th, void *__xregs);
@@ -386,7 +386,7 @@
 
 /* Set general register contents of process running thread TH.  */
 extern td_err_e td_thr_setgregs (const td_thrhandle_t *__th,
-				 prgregset_t __gregs);
+				 const prgregset_t *__gregs);
 
 /* Set extended register contents of process running thread TH.  */
 extern td_err_e td_thr_setxregs (const td_thrhandle_t *__th,
============================================================
Index: linuxthreads_db/proc_service.h
--- linuxthreads_db/proc_service.h	1999/12/02 08:07:10	1.6
+++ linuxthreads_db/proc_service.h	2000/01/11 20:03:06
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -52,9 +52,9 @@
 
 
 extern ps_err_e ps_lgetregs(struct ps_prochandle *,
-                        lwpid_t, prgregset_t);
+                        lwpid_t, prgregset_t *);
 extern ps_err_e ps_lsetregs(struct ps_prochandle *,
-                        lwpid_t, const prgregset_t);
+                        lwpid_t, const prgregset_t *);
 extern ps_err_e ps_lgetfpregs(struct ps_prochandle *,
                         lwpid_t, prfpregset_t *);
 extern ps_err_e ps_lsetfpregs(struct ps_prochandle *,
============================================================
Index: linuxthreads_db/td_thr_setgregs.c
--- linuxthreads_db/td_thr_setgregs.c	1999/11/02 23:40:25	1.2
+++ linuxthreads_db/td_thr_setgregs.c	2000/01/11 20:03:06
@@ -1,5 +1,5 @@
 /* Set a thread's general register set.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
@@ -22,7 +22,7 @@
 
 
 td_err_e
-td_thr_setgregs (const td_thrhandle_t *th, prgregset_t gregs)
+td_thr_setgregs (const td_thrhandle_t *th, const prgregset_t *gregs)
 {
   struct _pthread_descr_struct pds;
 
 

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Patch for linuxthreads_db/td_thr_getgregs.c
  2000-01-12  4:40 ` Andreas Schwab
  2000-01-12 23:50   ` Andreas Jaeger
       [not found]   ` <m3g0w2n3pw.fsf@localhost.localnet>
@ 2000-01-25 14:28   ` Ralf Baechle
  2 siblings, 0 replies; 7+ messages in thread
From: Ralf Baechle @ 2000-01-25 14:28 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Ulrich Drepper, libc-hacker

On Wed, Jan 12, 2000 at 01:40:38PM +0100, Andreas Schwab wrote:

> |> > Uli, if those function declarations are indeed correct (which I
> |> > doubt), you need to change td_thr_getgregs.c accordingly (memset
> |> > (&greg,...)).
> |> 
> |> Well, the form I have in the moment is acutally what Solaris has.  It
> |> was strange when I saw it but I haven't really spend time looking at
> |> it.  But you are right, it cannot be correct.
> 
> The problem is that gregset_t is sometimes an array (i386), sometimes a
> struct (mips).  The array decays to a pointer, so you won't see the
> different types, but the sizeof in td_thr_getregs will return the wrong
> value (size of a pointer instead of the whole array).

I've taken care that on gpregset_t can also be accessed using one of the
indices defined in <asm/reg.h>.  So if it makes things easier it's ok
to define a userland gpregset_t that is an array.

  Ralf

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Patch for linuxthreads_db/td_thr_getgregs.c
       [not found]   ` <m3g0w2n3pw.fsf@localhost.localnet>
@ 2000-01-13  4:28     ` Andreas Schwab
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Schwab @ 2000-01-13  4:28 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: libc-hacker

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 760 bytes --]

Ulrich Drepper <drepper@cygnus.com> writes:

|> Andreas Schwab <schwab@suse.de> writes:
|> 
|> > The problem is that gregset_t is sometimes an array (i386), sometimes a
|> > struct (mips).  The array decays to a pointer, so you won't see the
|> > different types, but the sizeof in td_thr_getregs will return the wrong
|> > value (size of a pointer instead of the whole array).
|> 
|> Then declare it as an array on MIPS as well.

No!  The interface must change, otherwise the memset will be wrong (and
there is no way to fix that).

Andreas.

-- 
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Patch for linuxthreads_db/td_thr_getgregs.c
  2000-01-12  4:40 ` Andreas Schwab
@ 2000-01-12 23:50   ` Andreas Jaeger
       [not found]   ` <m3g0w2n3pw.fsf@localhost.localnet>
  2000-01-25 14:28   ` Ralf Baechle
  2 siblings, 0 replies; 7+ messages in thread
From: Andreas Jaeger @ 2000-01-12 23:50 UTC (permalink / raw)
  To: libc-hacker

>>>>> Andreas Schwab writes:

 > Ulrich Drepper <drepper@cygnus.com> writes:
 > |> Andreas Jaeger <aj@suse.de> writes:
 > |> 
 > |> > Uli, if those function declarations are indeed correct (which I
 > |> > doubt), you need to change td_thr_getgregs.c accordingly (memset
 > |> > (&greg,...)).
 > |> 
 > |> Well, the form I have in the moment is acutally what Solaris has.  It
 > |> was strange when I saw it but I haven't really spend time looking at
 > |> it.  But you are right, it cannot be correct.

 > The problem is that gregset_t is sometimes an array (i386), sometimes a
 > struct (mips).  The array decays to a pointer, so you won't see the
 > different types, but the sizeof in td_thr_getregs will return the wrong
 > value (size of a pointer instead of the whole array).


Uli, you reverted my patch - without fixing the problem. Why? Could
you tell me how to fix the problem?  The interface itself seems to be
broken - at least if gregset_t is a struct!

Here's the compiler error again I get on MIPS:
td_thr_getgregs.c: In function `td_thr_getgregs':
td_thr_getgregs.c:38: incompatible types in initialization
td_thr_getgregs.c:38: incompatible type for argument 1 of `memset'

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Patch for linuxthreads_db/td_thr_getgregs.c
  2000-01-11 19:42 Ulrich Drepper
@ 2000-01-12  4:40 ` Andreas Schwab
  2000-01-12 23:50   ` Andreas Jaeger
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Andreas Schwab @ 2000-01-12  4:40 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: libc-hacker

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 938 bytes --]

Ulrich Drepper <drepper@cygnus.com> writes:

|> Andreas Jaeger <aj@suse.de> writes:
|> 
|> > Uli, if those function declarations are indeed correct (which I
|> > doubt), you need to change td_thr_getgregs.c accordingly (memset
|> > (&greg,...)).
|> 
|> Well, the form I have in the moment is acutally what Solaris has.  It
|> was strange when I saw it but I haven't really spend time looking at
|> it.  But you are right, it cannot be correct.

The problem is that gregset_t is sometimes an array (i386), sometimes a
struct (mips).  The array decays to a pointer, so you won't see the
different types, but the sizeof in td_thr_getregs will return the wrong
value (size of a pointer instead of the whole array).

Andreas.

-- 
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Patch for linuxthreads_db/td_thr_getgregs.c
@ 2000-01-11 19:42 Ulrich Drepper
  2000-01-12  4:40 ` Andreas Schwab
  0 siblings, 1 reply; 7+ messages in thread
From: Ulrich Drepper @ 2000-01-11 19:42 UTC (permalink / raw)
  To: libc-hacker

Andreas Jaeger <aj@suse.de> writes:

> Uli, if those function declarations are indeed correct (which I
> doubt), you need to change td_thr_getgregs.c accordingly (memset
> (&greg,...)).

Well, the form I have in the moment is acutally what Solaris has.  It
was strange when I saw it but I haven't really spend time looking at
it.  But you are right, it cannot be correct.

-- 
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com   `------------------------

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2000-01-25 14:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-11 11:28 Patch for linuxthreads_db/td_thr_getgregs.c Andreas Jaeger
2000-01-11 12:07 ` Andreas Jaeger
2000-01-11 19:42 Ulrich Drepper
2000-01-12  4:40 ` Andreas Schwab
2000-01-12 23:50   ` Andreas Jaeger
     [not found]   ` <m3g0w2n3pw.fsf@localhost.localnet>
2000-01-13  4:28     ` Andreas Schwab
2000-01-25 14:28   ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).