Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Moving to GDB_MULTI_ARCH_PARTIAL
@ 2002-02-06  9:21 Richard Earnshaw
  2002-02-07 19:45 ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Earnshaw @ 2002-02-06  9:21 UTC (permalink / raw)
  To: gdb; +Cc: Richard.Earnshaw

I'm trying to get the ARM target building now at multi-arch partial.  It 
seems that the auto-generated definitions at this level are to an extent 
inconsistent.

For example, gdbarch_validate() requires that PUSH_ARGUMENTS is fully 
implemented as a multi-arch call, but the code in gdbarch.h does not fault 
a partial definition of this.

That is, in gdbarch.h we have 

#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PUSH_ARGUMENTS)
#error "Non multi-arch definition of PUSH_ARGUMENTS"
#endif
#if GDB_MULTI_ARCH
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PUSH_ARGUMENTS)
#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) 
(gdbarch_pus
h_arguments (current_gdbarch, nargs, args, sp, struct_return, struct_addr))
#endif
#endif

but then in gdbarch_validate,

  if ((GDB_MULTI_ARCH >= 1)
      && (gdbarch->push_arguments == 0))
    fprintf_unfiltered (log, "\n\tpush_arguments");


Surely these two should be brought into line (one tests with ">" and the 
other with ">=").

R.


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

* Re: Moving to GDB_MULTI_ARCH_PARTIAL
  2002-02-06  9:21 Moving to GDB_MULTI_ARCH_PARTIAL Richard Earnshaw
@ 2002-02-07 19:45 ` Andrew Cagney
  2002-02-07 23:08   ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2002-02-07 19:45 UTC (permalink / raw)
  To: Richard.Earnshaw; +Cc: gdb

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

> I'm trying to get the ARM target building now at multi-arch partial.  It 
> seems that the auto-generated definitions at this level are to an extent 
> inconsistent.
> 
> For example, gdbarch_validate() requires that PUSH_ARGUMENTS is fully 
> implemented as a multi-arch call, but the code in gdbarch.h does not fault 
> a partial definition of this.
> 
> That is, in gdbarch.h we have 
> 
> #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PUSH_ARGUMENTS)
> #error "Non multi-arch definition of PUSH_ARGUMENTS"
> #endif
> #if GDB_MULTI_ARCH
> #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PUSH_ARGUMENTS)
> #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) 
> (gdbarch_pus
> h_arguments (current_gdbarch, nargs, args, sp, struct_return, struct_addr))
> #endif
> #endif
> 
> but then in gdbarch_validate,
> 
>   if ((GDB_MULTI_ARCH >= 1)
>       && (gdbarch->push_arguments == 0))
>     fprintf_unfiltered (log, "\n\tpush_arguments");
> 
> 
> Surely these two should be brought into line (one tests with ">" and the 
> other with ">=").


Er, yes.  Good point.  Try the attached.  If it works, I'll try to 
simplify the .c file as well

In the mean time I'll re-build everything :-/

Andrew



[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 4024 bytes --]

2002-02-07  Andrew Cagney  <ac131313@redhat.com>

	* gdbarch.sh: For for level one methods, disallow a definition
	when partially multi-arched.  Check for bad field.
	* gdbarch.h: Re-generate.

Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.108
diff -u -r1.108 gdbarch.sh
--- gdbarch.sh	2002/02/06 13:00:45	1.108
+++ gdbarch.sh	2002/02/08 03:42:28
@@ -25,7 +25,7 @@
     if test ! -r ${file}
     then
 	echo "${file} missing? cp new-${file} ${file}" 1>&2
-    elif diff -c ${file} new-${file}
+    elif diff ${file} new-${file}
     then
 	echo "${file} unchanged" 1>&2
     else
@@ -76,6 +76,13 @@
 		fi
 	    done
 
+	    case "${level}" in
+		1 ) gt_level=">= GDB_MULTI_ARCH_PARTIAL" ;;
+		2 ) gt_level="> GDB_MULTI_ARCH_PARTIAL" ;;
+		"" ) ;;
+		* ) error "Error: bad level for ${function}" 1>&2 ; kill $$ ; exit 1 ;;
+	    esac
+
 	    case "${class}" in
 		m ) staticdefault="${predefault}" ;;
 		M ) staticdefault="0" ;;
@@ -354,7 +361,9 @@
 
 	# Currently unused.
 
-    *) exit 1;;
+    *)
+	echo "Bad field ${field}"
+	exit 1;;
   esac
 done
 
@@ -736,11 +745,11 @@
 	printf "\n"
 	printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n"
 	printf "/* set_gdbarch_${function}() - not applicable - pre-initialized. */\n"
-	printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro})\n"
+	printf "#if (GDB_MULTI_ARCH ${gt_level}) && defined (${macro})\n"
 	printf "#error \"Non multi-arch definition of ${macro}\"\n"
 	printf "#endif\n"
 	printf "#if GDB_MULTI_ARCH\n"
-	printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro})\n"
+	printf "#if (GDB_MULTI_ARCH ${gt_level}) || !defined (${macro})\n"
 	printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n"
 	printf "#endif\n"
 	printf "#endif\n"
@@ -785,10 +794,10 @@
 	    printf "#endif\n"
 	    printf "\n"
 	    printf "extern int gdbarch_${function}_p (struct gdbarch *gdbarch);\n"
-	    printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro}_P)\n"
+	    printf "#if (GDB_MULTI_ARCH ${gt_level}) && defined (${macro}_P)\n"
 	    printf "#error \"Non multi-arch definition of ${macro}\"\n"
 	    printf "#endif\n"
-	    printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro}_P)\n"
+	    printf "#if (GDB_MULTI_ARCH ${gt_level}) || !defined (${macro}_P)\n"
 	    printf "#define ${macro}_P() (gdbarch_${function}_p (current_gdbarch))\n"
 	    printf "#endif\n"
 	fi
@@ -807,11 +816,11 @@
 	printf "\n"
 	printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n"
 	printf "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, ${returntype} ${function});\n"
-	printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro})\n"
+	printf "#if (GDB_MULTI_ARCH ${gt_level}) && defined (${macro})\n"
 	printf "#error \"Non multi-arch definition of ${macro}\"\n"
 	printf "#endif\n"
 	printf "#if GDB_MULTI_ARCH\n"
-	printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro})\n"
+	printf "#if (GDB_MULTI_ARCH ${gt_level}) || !defined (${macro})\n"
 	printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n"
 	printf "#endif\n"
 	printf "#endif\n"
@@ -853,11 +862,11 @@
 	printf "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, gdbarch_${function}_ftype *${function});\n"
 	if class_is_multiarch_p ; then :
 	else
-	    printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro})\n"
+	    printf "#if (GDB_MULTI_ARCH ${gt_level}) && defined (${macro})\n"
 	    printf "#error \"Non multi-arch definition of ${macro}\"\n"
 	    printf "#endif\n"
 	    printf "#if GDB_MULTI_ARCH\n"
-	    printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro})\n"
+	    printf "#if (GDB_MULTI_ARCH ${gt_level}) || !defined (${macro})\n"
 	    if [ "x${actual}" = "x" ]
 	    then
 		printf "#define ${macro}() (gdbarch_${function} (current_gdbarch))\n"

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

* Re: Moving to GDB_MULTI_ARCH_PARTIAL
  2002-02-07 19:45 ` Andrew Cagney
@ 2002-02-07 23:08   ` Andrew Cagney
  2002-02-08  1:38     ` Richard Earnshaw
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2002-02-07 23:08 UTC (permalink / raw)
  To: Richard.Earnshaw; +Cc: gdb

> In the mean time I'll re-build everything :-/


i386-aout:


gdbarch.h:1147: #error "Non multi-arch definition of REGISTER_CONVERTIBLE"
gdbarch.h:1151: warning: `REGISTER_CONVERTIBLE' redefined
tm.h:215: warning: this is the location of the previous definition
gdbarch.h:1375: #error "Non multi-arch definition of PUSH_ARGUMENTS"
gdbarch.h:1379: warning: `PUSH_ARGUMENTS' redefined
tm.h:242: warning: this is the location of the previous definition


looking around:

tm-i386.h:#define REGISTER_CONVERTIBLE(regnum) i386_register_convertible (regnum)
tm-ptx.h:#undef REGISTER_CONVERTIBLE
tm-ptx.h:#define REGISTER_CONVERTIBLE(N) \
tm-symmetry.h:#undef  REGISTER_CONVERTIBLE
tm-symmetry.h:#define REGISTER_CONVERTIBLE(N) \


this suggests REGISTER_CONVERTIBLE doesn't need to be immediatly converted.

However, it also explains why, at level one, it isn't strict about 
overriding macros.  Given a case like the i386, the base cpu may be 
multi-arched but the variants (tm-ptx.h and tm-symmetry.h) may not. 
This again lets them continue to build and work.

Andrew


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

* Re: Moving to GDB_MULTI_ARCH_PARTIAL
  2002-02-07 23:08   ` Andrew Cagney
@ 2002-02-08  1:38     ` Richard Earnshaw
  2002-02-08  7:19       ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Earnshaw @ 2002-02-08  1:38 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Richard.Earnshaw, gdb


ac131313@cygnus.com said:
> this suggests REGISTER_CONVERTIBLE doesn't need to be immediatly
> converted.

> However, it also explains why, at level one, it isn't strict about
> overriding macros.  Given a case like the i386, the base cpu may be
> multi-arched but the variants (tm-ptx.h and tm-symmetry.h) may not.
> This again lets them continue to build and work. 


So if they can continue to work with the existing definitions, why aren't 
REGISTER_CONVERTIBLE and PUSH_ARGUMENTS level 2?

R.


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

* Re: Moving to GDB_MULTI_ARCH_PARTIAL
  2002-02-08  1:38     ` Richard Earnshaw
@ 2002-02-08  7:19       ` Andrew Cagney
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2002-02-08  7:19 UTC (permalink / raw)
  To: Richard.Earnshaw; +Cc: gdb

> this suggests REGISTER_CONVERTIBLE doesn't need to be immediatly
>> converted.
> 
> 
>> However, it also explains why, at level one, it isn't strict about
>> overriding macros.  Given a case like the i386, the base cpu may be
>> multi-arched but the variants (tm-ptx.h and tm-symmetry.h) may not.
>> This again lets them continue to build and work. 
> 
> 
> 
> So if they can continue to work with the existing definitions, why aren't 
> REGISTER_CONVERTIBLE and PUSH_ARGUMENTS level 2?


(I'm currently going through and reviewing these - I've found two other 
candidates: PUSH_RETURN_ADDRESS (bug) and CALL_DUMMY_LOCATION (not a bug))

It is historic.  The very original gdbarch.sh was an all or nothing 
afair - the developer had to convert every single macro before they 
could turn on multi-arch.  Strangly (:-^) this got serious push back. 
The process was changed to be tolerant to partially multi-arch targets. 
  A few artifacts from the old way still linger.  When someone notices 
they get tweeked.

thanks for the pointers,
Andrew


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

end of thread, other threads:[~2002-02-08 15:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-06  9:21 Moving to GDB_MULTI_ARCH_PARTIAL Richard Earnshaw
2002-02-07 19:45 ` Andrew Cagney
2002-02-07 23:08   ` Andrew Cagney
2002-02-08  1:38     ` Richard Earnshaw
2002-02-08  7:19       ` Andrew Cagney

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