* Re: [RFA] testsuite/gdb.arch/i386-prologue.c: Fix compiling on Cygwin
@ 2004-06-28 17:57 Michael Elizabeth Chastain
2004-06-29 8:13 ` Corinna Vinschen
0 siblings, 1 reply; 11+ messages in thread
From: Michael Elizabeth Chastain @ 2004-06-28 17:57 UTC (permalink / raw)
To: gdb-patches
Same response as i386-prologue.c. I would like to see:
" call " SP_PREFIX "trap\n"
" .globl " SP_PREFIX "main\n"
Or a similar design with
" call " SYMBOL(trap) "\n"
" .globl " SYMBOL(main) "\n"
Michael C
===
* gdb.arch/i386-unwind.c: Conditionalize label names to build
on Cygwin.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFA] testsuite/gdb.arch/i386-prologue.c: Fix compiling on Cygwin
2004-06-28 17:57 [RFA] testsuite/gdb.arch/i386-prologue.c: Fix compiling on Cygwin Michael Elizabeth Chastain
@ 2004-06-29 8:13 ` Corinna Vinschen
0 siblings, 0 replies; 11+ messages in thread
From: Corinna Vinschen @ 2004-06-29 8:13 UTC (permalink / raw)
To: gdb-patches
On Jun 28 13:57, Michael Elizabeth Chastain wrote:
> Same response as i386-prologue.c. I would like to see:
>
> " call " SP_PREFIX "trap\n"
> " .globl " SP_PREFIX "main\n"
>
> Or a similar design with
>
> " call " SYMBOL(trap) "\n"
> " .globl " SYMBOL(main) "\n"
Same here as for i386-prologue.*.
Corinna
* gdb.arch/i386-unwind.c: Use preprocessor directives to
conditionalize symbol prefixing.
* gdb.arch/i386-unwind.exp: Allow symbol prefixing by adding
additional_flags handling. Add underscore prefix for Cygwin.
Index: gdb.arch/i386-unwind.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/i386-unwind.c,v
retrieving revision 1.1
diff -u -p -r1.1 i386-unwind.c
--- gdb.arch/i386-unwind.c 19 Nov 2003 17:42:43 -0000 1.1
+++ gdb.arch/i386-unwind.c 29 Jun 2004 08:04:48 -0000
@@ -19,6 +19,12 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#ifdef SYMBOL_PREFIX
+#define SYMBOL(str) SYMBOL_PREFIX #str
+#else
+#define SYMBOL(str) #str
+#endif
+
void
trap (void)
{
@@ -34,9 +40,9 @@ asm(".text\n"
"gdb1435:\n"
" pushl %ebp\n"
" mov %esp, %ebp\n"
- " call trap\n"
- " .globl main\n"
- "main:\n"
+ " call " SYMBOL (trap) "\n"
+ " .globl " SYMBOL (main) "\n"
+ SYMBOL (main) ":\n"
" pushl %ebp\n"
" mov %esp, %ebp\n"
" call gdb1435\n");
Index: gdb.arch/i386-unwind.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/i386-unwind.exp,v
retrieving revision 1.3
diff -u -p -r1.3 i386-unwind.exp
--- gdb.arch/i386-unwind.exp 23 Nov 2003 21:14:45 -0000 1.3
+++ gdb.arch/i386-unwind.exp 29 Jun 2004 08:04:48 -0000
@@ -36,7 +36,15 @@ if ![istarget "i?86-*-*"] then {
set testfile "i386-unwind"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+
+# some targets have leading underscores on assembly symbols.
+# TODO: detect this automatically
+set additional_flags ""
+if [istarget "i?86-*-cygwin*"] then {
+ set additional_flags "additional_flags=-DSYMBOL_PREFIX=\"_\""
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
--
Corinna Vinschen
Cygwin Co-Project Leader
Red Hat, Inc.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFA] testsuite/gdb.arch/i386-prologue.c: Fix compiling on Cygwin
@ 2004-06-29 18:16 Michael Elizabeth Chastain
0 siblings, 0 replies; 11+ messages in thread
From: Michael Elizabeth Chastain @ 2004-06-29 18:16 UTC (permalink / raw)
To: gdb-patches
Beautiful! Thanks Corinna.
> i386-prologue.c had no copyright header at all. I added one.
Oops, I forgot to notice that. :-(
Your patch is all good. :)
Michael C
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFA] testsuite/gdb.arch/i386-prologue.c: Fix compiling on Cygwin
@ 2004-06-29 17:27 Michael Elizabeth Chastain
2004-06-29 17:53 ` Corinna Vinschen
0 siblings, 1 reply; 11+ messages in thread
From: Michael Elizabeth Chastain @ 2004-06-29 17:27 UTC (permalink / raw)
To: gdb-patches
Add copyright date 2004 to each file, and say what platform(s)
you tested on. With those two things, approved.
Michael C
===
* gdb.arch/i386-unwind.c: Use preprocessor directives to
conditionalize symbol prefixing.
* gdb.arch/i386-unwind.exp: Allow symbol prefixing by adding
additional_flags handling. Add underscore prefix for Cygwin.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFA] testsuite/gdb.arch/i386-prologue.c: Fix compiling on Cygwin
2004-06-29 17:27 Michael Elizabeth Chastain
@ 2004-06-29 17:53 ` Corinna Vinschen
0 siblings, 0 replies; 11+ messages in thread
From: Corinna Vinschen @ 2004-06-29 17:53 UTC (permalink / raw)
To: gdb-patches
On Jun 29 13:27, Michael Elizabeth Chastain wrote:
> Add copyright date 2004 to each file, and say what platform(s)
> you tested on. With those two things, approved.
I've tested on Cygwin.
i386-prologue.c had no copyright header at all. I added one.
Applied i386-prologue.* and i386-unwind.* patches.
Thanks,
Corinna
> Michael C
>
> ===
>
> * gdb.arch/i386-unwind.c: Use preprocessor directives to
> conditionalize symbol prefixing.
> * gdb.arch/i386-unwind.exp: Allow symbol prefixing by adding
> additional_flags handling. Add underscore prefix for Cygwin.
--
Corinna Vinschen
Cygwin Co-Project Leader
Red Hat, Inc.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFA] testsuite/gdb.arch/i386-prologue.c: Fix compiling on Cygwin
@ 2004-06-29 17:25 Michael Elizabeth Chastain
0 siblings, 0 replies; 11+ messages in thread
From: Michael Elizabeth Chastain @ 2004-06-29 17:25 UTC (permalink / raw)
To: gdb-patches
cv> I've created a simpler patch using the SYMBOL(sym) suggestion you
cv> mentioned in your other response. Is the below patch ok?
Yeah, this is good. This is approved, if you've tested it and you
say what platform you tested it on (presumably Cygwin).
Michael C
* gdb.arch/i386-prologue.c: Use preprocessor directives to
conditionalize symbol prefixing.
* gdb.arch/i386-prologue.exp: Allow symbol prefixing by adding
additional_flags handling. Add underscore prefix for Cygwin.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFA] testsuite/gdb.arch/i386-prologue.c: Fix compiling on Cygwin
@ 2004-06-28 17:54 Michael Elizabeth Chastain
2004-06-29 8:12 ` Corinna Vinschen
0 siblings, 1 reply; 11+ messages in thread
From: Michael Elizabeth Chastain @ 2004-06-28 17:54 UTC (permalink / raw)
To: gdb-patches; +Cc: vinschen
> the gdb.arch/i386-prologue.c testcase doesn't compile on Cygwin since
> on Cygwin the assenmbler labels need leading underscores to match the
> same names in C. The below patch fixes that.
I acknowledge the problem, but I don't like to see #ifdef __CYGWIN__
in the middle of i386-prologue.c. So I am declining this patch.
Can you add a layer to this? Use a new symbol such as SYMBOL_PREFIX so
that i386-prologue.exp can tell i386-prologue.c whether to add a leading
underscore or not.
In i386-prologue.exp, something like this:
# some targets have leading underscores on assembly symbols.
# TODO: detect this automatically
set additional_flags ""
if { [istarget "i?86-*-cygwin*"] {
set additional_flags "additional_flags=-DSYMBOL_PREFIX=_"
}
...
gdb_compile ... executable {debug $additional_flags} ...
It would be better to auto-detect the need for a leading underscore,
perhaps by compiling a test program. But you don't need to do that
for this patch.
i386-prologue.exp would look like this. First there is some
preprocessor gunk to add "..." around the value of SYMBOL_PREFIX:
#define xstringify(arg) stringify(arg)
#define stringify(arg) #arg
/* add "..." around SYMBOL_PREFIX to make SP_STRING */
#ifdef SYMBOL_PREFIX
#define SP_STRING xstringify(SYMBOL_PREFIX)
#else
#define SP_STRING ""
#endif
...
Then in the places where you want optional leading underscores, just add
SP_STRING to the big asm string. The big asm string already depends on
string concatenation so this ought to work fine:
" .align 8\n"
SP_STRING "gdb1253:\n"
" pushl %ebp\n"
I'm open to ideas if you have improvements or a different idea. My goal
here is that i386-prologue.c does not have any target-specific tests in
it.
Michael C
===
* gdb.arch/i386-prologue.c: Conditionalize label names to build
on Cygwin.
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [RFA] testsuite/gdb.arch/i386-prologue.c: Fix compiling on Cygwin
2004-06-28 17:54 Michael Elizabeth Chastain
@ 2004-06-29 8:12 ` Corinna Vinschen
0 siblings, 0 replies; 11+ messages in thread
From: Corinna Vinschen @ 2004-06-29 8:12 UTC (permalink / raw)
To: gdb-patches
On Jun 28 13:55, Michael Elizabeth Chastain wrote:
> > the gdb.arch/i386-prologue.c testcase doesn't compile on Cygwin since
> > on Cygwin the assenmbler labels need leading underscores to match the
> > same names in C. The below patch fixes that.
>
> I acknowledge the problem, but I don't like to see #ifdef __CYGWIN__
> in the middle of i386-prologue.c. So I am declining this patch.
>
> Can you add a layer to this? Use a new symbol such as SYMBOL_PREFIX so
> that i386-prologue.exp can tell i386-prologue.c whether to add a leading
> underscore or not.
I've created a simpler patch using the SYMBOL(sym) suggestion you
mentioned in your other response. Is the below patch ok?
* gdb.arch/i386-prologue.c: Use preprocessor directives to
conditionalize symbol prefixing.
* gdb.arch/i386-prologue.exp: Allow symbol prefixing by adding
additional_flags handling. Add underscore prefix for Cygwin.
Corinna
Index: gdb.arch/i386-prologue.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/i386-prologue.c,v
retrieving revision 1.3
diff -u -p -r1.3 i386-prologue.c
--- gdb.arch/i386-prologue.c 29 Apr 2004 18:05:31 -0000 1.3
+++ gdb.arch/i386-prologue.c 29 Jun 2004 08:04:34 -0000
@@ -1,3 +1,9 @@
+#ifdef SYMBOL_PREFIX
+#define SYMBOL(str) SYMBOL_PREFIX #str
+#else
+#define SYMBOL(str) #str
+#endif
+
void gdb1253 (void);
void gdb1338 (void);
void jump_at_beginning (void);
@@ -15,7 +21,7 @@ main (void)
asm(".text\n"
" .align 8\n"
- "gdb1253:\n"
+ SYMBOL (gdb1253) ":\n"
" pushl %ebp\n"
" xorl %ecx, %ecx\n"
" movl %esp, %ebp\n"
@@ -28,7 +34,7 @@ asm(".text\n"
asm(".text\n"
" .align 8\n"
- "gdb1338:\n"
+ SYMBOL (gdb1338) ":\n"
" pushl %edi\n"
" pushl %esi\n"
" pushl %ebx\n"
@@ -44,7 +50,7 @@ asm(".text\n"
asm(".text\n"
" .align 8\n"
- "jump_at_beginning:\n"
+ SYMBOL (jump_at_beginning) ":\n"
" pushl %ebp\n"
" movl %esp,%ebp\n"
" jmp .gdbjump\n"
Index: gdb.arch/i386-prologue.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/i386-prologue.exp,v
retrieving revision 1.4
diff -u -p -r1.4 i386-prologue.exp
--- gdb.arch/i386-prologue.exp 29 Apr 2004 18:05:31 -0000 1.4
+++ gdb.arch/i386-prologue.exp 29 Jun 2004 08:04:34 -0000
@@ -36,7 +36,15 @@ if ![istarget "i?86-*-*"] then {
set testfile "i386-prologue"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+
+# some targets have leading underscores on assembly symbols.
+# TODO: detect this automatically
+set additional_flags ""
+if [istarget "i?86-*-cygwin*"] then {
+ set additional_flags "additional_flags=-DSYMBOL_PREFIX=\"_\""
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
--
Corinna Vinschen
Cygwin Co-Project Leader
Red Hat, Inc.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [RFA] testsuite/gdb.arch/i386-prologue.c: Fix compiling on Cygwin
@ 2004-06-28 11:41 Corinna Vinschen
0 siblings, 0 replies; 11+ messages in thread
From: Corinna Vinschen @ 2004-06-28 11:41 UTC (permalink / raw)
To: gdb-patches
Hi,
the gdb.arch/i386-unwind.c testcase doesn't compile on Cygwin due to
the missing underscores, the same as with i386-prologue.c.
Corinna
* gdb.arch/i386-unwind.c: Conditionalize label names to build
on Cygwin.
Index: gdb.arch/i386-unwind.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/i386-unwind.c,v
retrieving revision 1.1
diff -u -p -r1.1 i386-unwind.c
--- gdb.arch/i386-unwind.c 19 Nov 2003 17:42:43 -0000 1.1
+++ gdb.arch/i386-unwind.c 28 Jun 2004 11:38:42 -0000
@@ -34,9 +34,15 @@ asm(".text\n"
"gdb1435:\n"
" pushl %ebp\n"
" mov %esp, %ebp\n"
+#ifdef __CYGWIN__
+ " call _trap\n"
+ " .globl _main\n"
+ "_main:\n"
+#else
" call trap\n"
" .globl main\n"
"main:\n"
+#endif
" pushl %ebp\n"
" mov %esp, %ebp\n"
" call gdb1435\n");
--
Corinna Vinschen
Cygwin Co-Project Leader
Red Hat, Inc.
^ permalink raw reply [flat|nested] 11+ messages in thread* [RFA] testsuite/gdb.arch/i386-prologue.c: Fix compiling on Cygwin
@ 2004-06-28 11:35 Corinna Vinschen
2004-06-29 14:39 ` [RFA] testsuite/gdb.arch/i386-prologue.c: Fix compiling on cygwin Christopher Faylor
0 siblings, 1 reply; 11+ messages in thread
From: Corinna Vinschen @ 2004-06-28 11:35 UTC (permalink / raw)
To: gdb-patches
Hi,
the gdb.arch/i386-prologue.c testcase doesn't compile on Cygwin since
on Cygwin the assenmbler labels need leading underscores to match the
same names in C. The below patch fixes that.
Corinna
* gdb.arch/i386-prologue.c: Conditionalize label names to build
on Cygwin.
Index: gdb.arch/i386-prologue.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/i386-prologue.c,v
retrieving revision 1.3
diff -u -p -r1.3 i386-prologue.c
--- gdb.arch/i386-prologue.c 29 Apr 2004 18:05:31 -0000 1.3
+++ gdb.arch/i386-prologue.c 28 Jun 2004 11:32:02 -0000
@@ -15,7 +15,11 @@ main (void)
asm(".text\n"
" .align 8\n"
+#ifdef __CYGWIN__
+ "_gdb1253:\n"
+#else
"gdb1253:\n"
+#endif
" pushl %ebp\n"
" xorl %ecx, %ecx\n"
" movl %esp, %ebp\n"
@@ -28,7 +32,11 @@ asm(".text\n"
asm(".text\n"
" .align 8\n"
+#ifdef __CYGWIN__
+ "_gdb1338:\n"
+#else
"gdb1338:\n"
+#endif
" pushl %edi\n"
" pushl %esi\n"
" pushl %ebx\n"
@@ -44,7 +52,11 @@ asm(".text\n"
asm(".text\n"
" .align 8\n"
+#ifdef __CYGWIN__
+ "_jump_at_beginning:\n"
+#else
"jump_at_beginning:\n"
+#endif
" pushl %ebp\n"
" movl %esp,%ebp\n"
" jmp .gdbjump\n"
--
Corinna Vinschen
Cygwin Co-Project Leader
Red Hat, Inc.
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [RFA] testsuite/gdb.arch/i386-prologue.c: Fix compiling on cygwin
2004-06-28 11:35 Corinna Vinschen
@ 2004-06-29 14:39 ` Christopher Faylor
0 siblings, 0 replies; 11+ messages in thread
From: Christopher Faylor @ 2004-06-29 14:39 UTC (permalink / raw)
To: gdb-patches
On Mon, Jun 28, 2004 at 01:35:16PM +0200, Corinna Vinschen wrote:
>Hi,
>
>the gdb.arch/i386-prologue.c testcase doesn't compile on Cygwin since
>on Cygwin the assenmbler labels need leading underscores to match the
>same names in C. The below patch fixes that.
>
>Corinna
>
> * gdb.arch/i386-prologue.c: Conditionalize label names to build
> on Cygwin.
SHouldn't there be a better conditional for this than "__CYGWIN__" like
"NAMES_HAVE_UNDERSCORE" or something?
cgf
>Index: gdb.arch/i386-prologue.c
>===================================================================
>RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/i386-prologue.c,v
>retrieving revision 1.3
>diff -u -p -r1.3 i386-prologue.c
>--- gdb.arch/i386-prologue.c 29 Apr 2004 18:05:31 -0000 1.3
>+++ gdb.arch/i386-prologue.c 28 Jun 2004 11:32:02 -0000
>@@ -15,7 +15,11 @@ main (void)
>
> asm(".text\n"
> " .align 8\n"
>+#ifdef __CYGWIN__
>+ "_gdb1253:\n"
>+#else
> "gdb1253:\n"
>+#endif
> " pushl %ebp\n"
> " xorl %ecx, %ecx\n"
> " movl %esp, %ebp\n"
>@@ -28,7 +32,11 @@ asm(".text\n"
>
> asm(".text\n"
> " .align 8\n"
>+#ifdef __CYGWIN__
>+ "_gdb1338:\n"
>+#else
> "gdb1338:\n"
>+#endif
> " pushl %edi\n"
> " pushl %esi\n"
> " pushl %ebx\n"
>@@ -44,7 +52,11 @@ asm(".text\n"
>
> asm(".text\n"
> " .align 8\n"
>+#ifdef __CYGWIN__
>+ "_jump_at_beginning:\n"
>+#else
> "jump_at_beginning:\n"
>+#endif
> " pushl %ebp\n"
> " movl %esp,%ebp\n"
> " jmp .gdbjump\n"
>
>--
>Corinna Vinschen
>Cygwin Co-Project Leader
>Red Hat, Inc.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2004-06-29 18:16 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-28 17:57 [RFA] testsuite/gdb.arch/i386-prologue.c: Fix compiling on Cygwin Michael Elizabeth Chastain
2004-06-29 8:13 ` Corinna Vinschen
-- strict thread matches above, loose matches on Subject: below --
2004-06-29 18:16 Michael Elizabeth Chastain
2004-06-29 17:27 Michael Elizabeth Chastain
2004-06-29 17:53 ` Corinna Vinschen
2004-06-29 17:25 Michael Elizabeth Chastain
2004-06-28 17:54 Michael Elizabeth Chastain
2004-06-29 8:12 ` Corinna Vinschen
2004-06-28 11:41 Corinna Vinschen
2004-06-28 11:35 Corinna Vinschen
2004-06-29 14:39 ` [RFA] testsuite/gdb.arch/i386-prologue.c: Fix compiling on cygwin Christopher Faylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox