Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* 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-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: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
* [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

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