All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][MIPS] fix kgdb build error
@ 2008-10-24 15:17 Yoichi Yuasa
  2008-10-24 16:31 ` David Daney
  2008-10-24 16:42 ` Ralf Baechle
  0 siblings, 2 replies; 7+ messages in thread
From: Yoichi Yuasa @ 2008-10-24 15:17 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: yoichi_yuasa, linux-mips

ptrace.h needs #include <linux/types.h>

In file included from include/linux/ptrace.h:49,
                 from arch/mips/kernel/kgdb.c:25:
/home/yuasa/src/linux/test/generic/linux/arch/mips/include/asm/ptrace.h:83: error: expected specifier-qualifier-list before 'uint32_t'
/home/yuasa/src/linux/test/generic/linux/arch/mips/include/asm/ptrace.h:98: error: expected specifier-qualifier-list before 'uint64_t'
In file included from include/linux/ptrace.h:49,
                 from arch/mips/kernel/kgdb.c:25:
/home/yuasa/src/linux/test/generic/linux/arch/mips/include/asm/ptrace.h:123: error: expected declaration specifiers or '...' before '__s64'
/home/yuasa/src/linux/test/generic/linux/arch/mips/include/asm/ptrace.h:124: error: expected declaration specifiers or '...' before '__s64'
/home/yuasa/src/linux/test/generic/linux/arch/mips/include/asm/ptrace.h:126: error: expected declaration specifiers or '...' before '__u32'
/home/yuasa/src/linux/test/generic/linux/arch/mips/include/asm/ptrace.h:127: error: expected declaration specifiers or '...' before '__u32'
make[1]: *** [arch/mips/kernel/kgdb.o] Error 1

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>

diff -pruN -X /home/yuasa/Memo/dontdiff linux-orig/arch/mips/include/asm/ptrace.h linux/arch/mips/include/asm/ptrace.h
--- linux-orig/arch/mips/include/asm/ptrace.h	2008-10-22 09:41:24.013961262 +0900
+++ linux/arch/mips/include/asm/ptrace.h	2008-10-22 09:40:29.774870351 +0900
@@ -9,6 +9,8 @@
 #ifndef _ASM_PTRACE_H
 #define _ASM_PTRACE_H
 
+#include <linux/types.h>
+
 #ifdef CONFIG_64BIT
 #define __ARCH_WANT_COMPAT_SYS_PTRACE
 #endif

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

* Re: [PATCH][MIPS] fix kgdb build error
  2008-10-24 15:17 [PATCH][MIPS] fix kgdb build error Yoichi Yuasa
@ 2008-10-24 16:31 ` David Daney
  2008-10-24 17:09   ` Ralf Baechle
  2008-10-24 16:42 ` Ralf Baechle
  1 sibling, 1 reply; 7+ messages in thread
From: David Daney @ 2008-10-24 16:31 UTC (permalink / raw)
  To: Yoichi Yuasa, linux-mips; +Cc: Ralf Baechle

Yoichi Yuasa wrote:
> ptrace.h needs #include <linux/types.h>
> 
[...]

Can you try this completely untested patch instead?

If it works, I will give it a more thorough test over the next few
weeks.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 arch/mips/include/asm/ptrace.h |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h
index 3356873..2426bb7 100644
--- a/arch/mips/include/asm/ptrace.h
+++ b/arch/mips/include/asm/ptrace.h
@@ -84,25 +84,25 @@ enum pt_watch_style {
 	pt_watch_style_mips64
 };
 struct mips32_watch_regs {
-	uint32_t watchlo[8];
+	unsigned int watchlo[8];
 	/* Lower 16 bits of watchhi. */
-	uint16_t watchhi[8];
+	unsigned short watchhi[8];
 	/* Valid mask and I R W bits.
 	 * bit 0 -- 1 if W bit is usable.
 	 * bit 1 -- 1 if R bit is usable.
 	 * bit 2 -- 1 if I bit is usable.
 	 * bits 3 - 11 -- Valid watchhi mask bits.
 	 */
-	uint16_t watch_masks[8];
+	unsigned short watch_masks[8];
 	/* The number of valid watch register pairs.  */
-	uint32_t num_valid;
+	unsigned int num_valid;
 } __attribute__((aligned(8)));
 
 struct mips64_watch_regs {
-	uint64_t watchlo[8];
-	uint16_t watchhi[8];
-	uint16_t watch_masks[8];
-	uint32_t num_valid;
+	unsigned long long watchlo[8];
+	unsigned short watchhi[8];
+	unsigned short watch_masks[8];
+	unsigned int num_valid;
 } __attribute__((aligned(8)));
 
 struct pt_watch_regs {

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

* Re: [PATCH][MIPS] fix kgdb build error
  2008-10-24 15:17 [PATCH][MIPS] fix kgdb build error Yoichi Yuasa
  2008-10-24 16:31 ` David Daney
@ 2008-10-24 16:42 ` Ralf Baechle
  2008-10-25  8:30   ` Yoichi Yuasa
  1 sibling, 1 reply; 7+ messages in thread
From: Ralf Baechle @ 2008-10-24 16:42 UTC (permalink / raw)
  To: Yoichi Yuasa; +Cc: linux-mips, David Daney

On Sat, Oct 25, 2008 at 12:17:25AM +0900, Yoichi Yuasa wrote:

> ptrace.h needs #include <linux/types.h>
> 
> In file included from include/linux/ptrace.h:49,
>                  from arch/mips/kernel/kgdb.c:25:
> /home/yuasa/src/linux/test/generic/linux/arch/mips/include/asm/ptrace.h:83: error: expected specifier-qualifier-list before 'uint32_t'
> /home/yuasa/src/linux/test/generic/linux/arch/mips/include/asm/ptrace.h:98: error: expected specifier-qualifier-list before 'uint64_t'
> In file included from include/linux/ptrace.h:49,
>                  from arch/mips/kernel/kgdb.c:25:
> /home/yuasa/src/linux/test/generic/linux/arch/mips/include/asm/ptrace.h:123: error: expected declaration specifiers or '...' before '__s64'
> /home/yuasa/src/linux/test/generic/linux/arch/mips/include/asm/ptrace.h:124: error: expected declaration specifiers or '...' before '__s64'
> /home/yuasa/src/linux/test/generic/linux/arch/mips/include/asm/ptrace.h:126: error: expected declaration specifiers or '...' before '__u32'
> /home/yuasa/src/linux/test/generic/linux/arch/mips/include/asm/ptrace.h:127: error: expected declaration specifiers or '...' before '__u32'
> make[1]: *** [arch/mips/kernel/kgdb.o] Error 1
> 
> Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>

<asm/ptrace.h> is exported to userland so we can't include these types.
Basically <linux/types.h> or <stdint.h> are polluting the namespace.  So
either we use some __* type and include only those or we get entirely
rid of typedef'ed types - as in the patch that you've posted while I was
writing this.

  Ralf

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

* Re: [PATCH][MIPS] fix kgdb build error
  2008-10-24 16:31 ` David Daney
@ 2008-10-24 17:09   ` Ralf Baechle
  2008-10-24 17:18     ` David Daney
  0 siblings, 1 reply; 7+ messages in thread
From: Ralf Baechle @ 2008-10-24 17:09 UTC (permalink / raw)
  To: David Daney; +Cc: Yoichi Yuasa, linux-mips

On Fri, Oct 24, 2008 at 09:31:13AM -0700, David Daney wrote:

> Yoichi Yuasa wrote:
>> ptrace.h needs #include <linux/types.h>
>>
> [...]
>
> Can you try this completely untested patch instead?
>
> If it works, I will give it a more thorough test over the next few
> weeks.

This looks correct, I think.

Though I was wondering about two special cases:

  o 32-bit debugger debugging a 64-bit process
  o 64-bit debugger debugging a 32-bit process

The unions make we wonder if that case was considered ...

Anyway, your patch certainly solves Yoichi's original bug so I'll apply it.

  Ralf

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

* Re: [PATCH][MIPS] fix kgdb build error
  2008-10-24 17:09   ` Ralf Baechle
@ 2008-10-24 17:18     ` David Daney
  0 siblings, 0 replies; 7+ messages in thread
From: David Daney @ 2008-10-24 17:18 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Yoichi Yuasa, linux-mips

Ralf Baechle wrote:
> On Fri, Oct 24, 2008 at 09:31:13AM -0700, David Daney wrote:
> 
>> Yoichi Yuasa wrote:
>>> ptrace.h needs #include <linux/types.h>
>>>
>> [...]
>>
>> Can you try this completely untested patch instead?
>>
>> If it works, I will give it a more thorough test over the next few
>> weeks.
> 
> This looks correct, I think.
> 
> Though I was wondering about two special cases:
> 
>   o 32-bit debugger debugging a 64-bit process
>   o 64-bit debugger debugging a 32-bit process
> 
> The unions make we wonder if that case was considered ...
> 

The ptrace interface only gives access to the raw watch registers, their 
width and thus the union element used is determined by how the kernel 
was built (32 or 64 bit).

It is up to the user space debugger to handle address space size issues. 
  The current gdb patch has only been tested on 32 bit systems.

David Daney

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

* [PATCH][MIPS] fix kgdb build error
  2008-10-24 16:42 ` Ralf Baechle
@ 2008-10-25  8:30   ` Yoichi Yuasa
  2008-10-25 18:20     ` Ralf Baechle
  0 siblings, 1 reply; 7+ messages in thread
From: Yoichi Yuasa @ 2008-10-25  8:30 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: yoichi_yuasa, linux-mips, David Daney

On Fri, 24 Oct 2008 17:42:41 +0100
Ralf Baechle <ralf@linux-mips.org> wrote:

> 
> <asm/ptrace.h> is exported to userland so we can't include these types.
> Basically <linux/types.h> or <stdint.h> are polluting the namespace.  So
> either we use some __* type and include only those or we get entirely
> rid of typedef'ed types - as in the patch that you've posted while I was
> writing this.

Thank you for your comment.
KGDB still has a problem. This is kernel part in ptrace.h.

---

Fix KGDB build error

In file included from include/linux/ptrace.h:49,
                 from arch/mips/kernel/kgdb.c:25:
/home/yuasa/src/linux/test/mips/linux/arch/mips/include/asm/ptrace.h:123: error: expected declaration specifiers or '...' before '__s64'
/home/yuasa/src/linux/test/mips/linux/arch/mips/include/asm/ptrace.h:124: error: expected declaration specifiers or '...' before '__s64'
/home/yuasa/src/linux/test/mips/linux/arch/mips/include/asm/ptrace.h:126: error: expected declaration specifiers or '...' before '__u32'
/home/yuasa/src/linux/test/mips/linux/arch/mips/include/asm/ptrace.h:127: error: expected declaration specifiers or '...' before '__u32'
make[1]: *** [arch/mips/kernel/kgdb.o] Error 1

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>

diff -pruN -X /home/yuasa/Memo/dontdiff linux-orig/arch/mips/include/asm/ptrace.h linux/arch/mips/include/asm/ptrace.h
--- linux-orig/arch/mips/include/asm/ptrace.h	2008-10-25 14:12:22.034139781 +0900
+++ linux/arch/mips/include/asm/ptrace.h	2008-10-25 16:39:36.031229216 +0900
@@ -116,6 +116,7 @@ struct pt_watch_regs {
 
 #include <linux/compiler.h>
 #include <linux/linkage.h>
+#include <linux/types.h>
 #include <asm/isadep.h>
 
 struct task_struct;

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

* Re: [PATCH][MIPS] fix kgdb build error
  2008-10-25  8:30   ` Yoichi Yuasa
@ 2008-10-25 18:20     ` Ralf Baechle
  0 siblings, 0 replies; 7+ messages in thread
From: Ralf Baechle @ 2008-10-25 18:20 UTC (permalink / raw)
  To: Yoichi Yuasa; +Cc: linux-mips, David Daney

On Sat, Oct 25, 2008 at 05:30:35PM +0900, Yoichi Yuasa wrote:

> > <asm/ptrace.h> is exported to userland so we can't include these types.
> > Basically <linux/types.h> or <stdint.h> are polluting the namespace.  So
> > either we use some __* type and include only those or we get entirely
> > rid of typedef'ed types - as in the patch that you've posted while I was
> > writing this.
> 
> Thank you for your comment.
> KGDB still has a problem. This is kernel part in ptrace.h.
> 
> ---

Note that git will drop ALL comments below the "---" line which is not
what you want here ...

> Fix KGDB build error
> 
> In file included from include/linux/ptrace.h:49,
>                  from arch/mips/kernel/kgdb.c:25:
> /home/yuasa/src/linux/test/mips/linux/arch/mips/include/asm/ptrace.h:123: error: expected declaration specifiers or '...' before '__s64'
> /home/yuasa/src/linux/test/mips/linux/arch/mips/include/asm/ptrace.h:124: error: expected declaration specifiers or '...' before '__s64'
> /home/yuasa/src/linux/test/mips/linux/arch/mips/include/asm/ptrace.h:126: error: expected declaration specifiers or '...' before '__u32'
> /home/yuasa/src/linux/test/mips/linux/arch/mips/include/asm/ptrace.h:127: error: expected declaration specifiers or '...' before '__u32'
> make[1]: *** [arch/mips/kernel/kgdb.o] Error 1
> 
> Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>

Applied.  Thanks!

  Ralf

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

end of thread, other threads:[~2008-10-25 18:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-24 15:17 [PATCH][MIPS] fix kgdb build error Yoichi Yuasa
2008-10-24 16:31 ` David Daney
2008-10-24 17:09   ` Ralf Baechle
2008-10-24 17:18     ` David Daney
2008-10-24 16:42 ` Ralf Baechle
2008-10-25  8:30   ` Yoichi Yuasa
2008-10-25 18:20     ` Ralf Baechle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.