Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] testsuite gdb.base/jit-main.c
@ 2011-02-24 21:49 Andreas Tobler
  2011-02-24 23:01 ` Mark Kettenis
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Tobler @ 2011-02-24 21:49 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 291 bytes --]

Hi all,

on non Linux platforms (FreeBSD for example) this test case fails due to 
ElfW being not defined.

The below tries to achieve this shortcoming.

Tested on FreeBSD x86_64/amd64 (64-bit), FreeBSD powerpc (32-bit) and 
also on linux-ppc (32-bit).

What do you think?

Thanks,
Andreas


[-- Attachment #2: jit-main.diff --]
[-- Type: text/plain, Size: 793 bytes --]

Index: jit-main.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/jit-main.c,v
retrieving revision 1.1
diff -u -r1.1 jit-main.c
--- jit-main.c	31 Jan 2011 21:44:52 -0000	1.1
+++ jit-main.c	24 Feb 2011 20:45:39 -0000
@@ -29,6 +29,19 @@
 #include <sys/mman.h>
 #include <sys/stat.h>
 
+/* ElfW is coming from linux. On other platforms it does not exist.
+   Let us define it here. */
+#ifndef ElfW
+# if (defined  (_LP64) || defined (__LP64__)) 
+#   define WORDSIZE 64
+# else
+#   define WORDSIZE 32
+# endif /* _LP64 || __LP64__  */
+#define ElfW(type)      _ElfW (Elf, WORDSIZE, type)
+#define _ElfW(e,w,t)    _ElfW_1 (e, w, _##t)
+#define _ElfW_1(e,w,t)  e##w##t
+#endif /* !ElfW  */
+
 typedef enum
 {
   JIT_NOACTION = 0,

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

* Re: [patch] testsuite gdb.base/jit-main.c
  2011-02-24 21:49 [patch] testsuite gdb.base/jit-main.c Andreas Tobler
@ 2011-02-24 23:01 ` Mark Kettenis
  2011-02-24 23:51   ` Andreas Tobler
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Kettenis @ 2011-02-24 23:01 UTC (permalink / raw)
  To: andreast-list; +Cc: gdb-patches

> Date: Thu, 24 Feb 2011 22:27:35 +0100
> From: Andreas Tobler <andreast-list@fgznet.ch>
> 
> Hi all,
> 
> on non Linux platforms (FreeBSD for example) this test case fails due to 
> ElfW being not defined.
> 
> The below tries to achieve this shortcoming.
> 
> Tested on FreeBSD x86_64/amd64 (64-bit), FreeBSD powerpc (32-bit) and 
> also on linux-ppc (32-bit).
> 
> What do you think?

Looks reasonable.  This won't make the testcase work on OpenBSD (we
don't have <elf.h>), but it does bring things a step closer.  But this
will probably make Solaris happier as well.

> --------------040302050407010400080508
> Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
>  name="jit-main.diff"
> Content-Transfer-Encoding: 7bit
> Content-Disposition: attachment;
>  filename="jit-main.diff"
> 
> Index: jit-main.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.base/jit-main.c,v
> retrieving revision 1.1
> diff -u -r1.1 jit-main.c
> --- jit-main.c	31 Jan 2011 21:44:52 -0000	1.1
> +++ jit-main.c	24 Feb 2011 20:45:39 -0000
> @@ -29,6 +29,19 @@
>  #include <sys/mman.h>
>  #include <sys/stat.h>
>  
> +/* ElfW is coming from linux. On other platforms it does not exist.
> +   Let us define it here. */
> +#ifndef ElfW
> +# if (defined  (_LP64) || defined (__LP64__)) 
> +#   define WORDSIZE 64
> +# else
> +#   define WORDSIZE 32
> +# endif /* _LP64 || __LP64__  */
> +#define ElfW(type)      _ElfW (Elf, WORDSIZE, type)
> +#define _ElfW(e,w,t)    _ElfW_1 (e, w, _##t)
> +#define _ElfW_1(e,w,t)  e##w##t
> +#endif /* !ElfW  */
> +
>  typedef enum
>  {
>    JIT_NOACTION = 0,
> 
> --------------040302050407010400080508--
> 


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

* Re: [patch] testsuite gdb.base/jit-main.c
  2011-02-24 23:01 ` Mark Kettenis
@ 2011-02-24 23:51   ` Andreas Tobler
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Tobler @ 2011-02-24 23:51 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

Hi Mark,

On 24.02.11 22:48, Mark Kettenis wrote:
>> Date: Thu, 24 Feb 2011 22:27:35 +0100
>> From: Andreas Tobler<andreast-list@fgznet.ch>
>>
>> Hi all,
>>
>> on non Linux platforms (FreeBSD for example) this test case fails due to
>> ElfW being not defined.
>>
>> The below tries to achieve this shortcoming.
>>
>> Tested on FreeBSD x86_64/amd64 (64-bit), FreeBSD powerpc (32-bit) and
>> also on linux-ppc (32-bit).
>>
>> What do you think?
>
> Looks reasonable.  This won't make the testcase work on OpenBSD (we
> don't have<elf.h>), but it does bring things a step closer.  But this
> will probably make Solaris happier as well.

Thanks for the feedback.

Would it help to include exec_elf.h on obsd?

Andreas

>> --------------040302050407010400080508
>> Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
>>   name="jit-main.diff"
>> Content-Transfer-Encoding: 7bit
>> Content-Disposition: attachment;
>>   filename="jit-main.diff"
>>
>> Index: jit-main.c
>> ===================================================================
>> RCS file: /cvs/src/src/gdb/testsuite/gdb.base/jit-main.c,v
>> retrieving revision 1.1
>> diff -u -r1.1 jit-main.c
>> --- jit-main.c	31 Jan 2011 21:44:52 -0000	1.1
>> +++ jit-main.c	24 Feb 2011 20:45:39 -0000
>> @@ -29,6 +29,19 @@
>>   #include<sys/mman.h>
>>   #include<sys/stat.h>
>>
>> +/* ElfW is coming from linux. On other platforms it does not exist.
>> +   Let us define it here. */
>> +#ifndef ElfW
>> +# if (defined  (_LP64) || defined (__LP64__))
>> +#   define WORDSIZE 64
>> +# else
>> +#   define WORDSIZE 32
>> +# endif /* _LP64 || __LP64__  */
>> +#define ElfW(type)      _ElfW (Elf, WORDSIZE, type)
>> +#define _ElfW(e,w,t)    _ElfW_1 (e, w, _##t)
>> +#define _ElfW_1(e,w,t)  e##w##t
>> +#endif /* !ElfW  */
>> +
>>   typedef enum
>>   {
>>     JIT_NOACTION = 0,
>>
>> --------------040302050407010400080508--
>>
>
>


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

end of thread, other threads:[~2011-02-24 23:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-24 21:49 [patch] testsuite gdb.base/jit-main.c Andreas Tobler
2011-02-24 23:01 ` Mark Kettenis
2011-02-24 23:51   ` Andreas Tobler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox