This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] testsuite/gdb.arch/i386-prologue.c: Fix compiling on Cygwin
- From: Corinna Vinschen <vinschen at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 29 Jun 2004 10:11:56 +0200
- Subject: Re: [RFA] testsuite/gdb.arch/i386-prologue.c: Fix compiling on Cygwin
- References: <20040628175505.1C1504B104@berman.michael-chastain.com>
- Reply-to: gdb-patches at sources dot redhat dot com
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.