[patch] gdbarch.sh, only print macro when defined

Andrew Cagney ac131313@cygnus.com
Thu May 11 04:51:00 GMT 2000


FYI,

I've committed the attached.  It, firstly prints the value of
GDB_MULTI_ARCH (more useful than you may expect) and secondly makes all
the macro's printed in gdbarch_dump conditional on their definition.

	Andrew
Thu May 11 21:33:59 2000  Andrew Cagney  <cagney@b1.cygnus.com>

	* gdbarch.sh (gdbarch_dump): Print the value of GDB_MULTI_ARCH.
  	Always check that a macro is defined before printing it.
	* gdbarch.c: Re-generate.

Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.20
diff -p -r1.20 gdbarch.sh
*** gdbarch.sh	2000/05/10 17:38:16	1.20
--- gdbarch.sh	2000/05/11 11:47:17
*************** do
*** 196,202 ****
  	# An optional indicator for any predicte to wrap around the
  	# print member code.
  
- 	#   # -> Wrap print up in ``#ifdef MACRO''
  	#   exp -> Wrap print up in ``if (${print_p}) ...
  	#   ``'' -> No predicate
  
--- 196,201 ----
*************** v:1:CALL_DUMMY_STACK_ADJUST_P:int:call_d
*** 269,276 ****
  v:2:CALL_DUMMY_STACK_ADJUST:int:call_dummy_stack_adjust::::0::gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0:0x%08lx::CALL_DUMMY_STACK_ADJUST_P
  f:2:FIX_CALL_DUMMY:void:fix_call_dummy:char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p:dummy, pc, fun, nargs, args, type, gcc_p::0:0
  #
! v:2:BELIEVE_PCC_PROMOTION:int:believe_pcc_promotion::::0:::::#
! v:2:BELIEVE_PCC_PROMOTION_TYPE:int:believe_pcc_promotion_type::::0:::::#
  f:2:COERCE_FLOAT_TO_DOUBLE:int:coerce_float_to_double:struct type *formal, struct type *actual:formal, actual:::default_coerce_float_to_double:0
  f:1:GET_SAVED_REGISTER:void:get_saved_register:char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval:raw_buffer, optimized, addrp, frame, regnum, lval::generic_get_saved_register:0
  #
--- 268,275 ----
  v:2:CALL_DUMMY_STACK_ADJUST:int:call_dummy_stack_adjust::::0::gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0:0x%08lx::CALL_DUMMY_STACK_ADJUST_P
  f:2:FIX_CALL_DUMMY:void:fix_call_dummy:char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p:dummy, pc, fun, nargs, args, type, gcc_p::0:0
  #
! v:2:BELIEVE_PCC_PROMOTION:int:believe_pcc_promotion::::0:::::
! v:2:BELIEVE_PCC_PROMOTION_TYPE:int:believe_pcc_promotion_type::::0:::::
  f:2:COERCE_FLOAT_TO_DOUBLE:int:coerce_float_to_double:struct type *formal, struct type *actual:formal, actual:::default_coerce_float_to_double:0
  f:1:GET_SAVED_REGISTER:void:get_saved_register:char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval:raw_buffer, optimized, addrp, frame, regnum, lval::generic_get_saved_register:0
  #
*************** gdbarch_dump (void)
*** 1126,1131 ****
--- 1125,1131 ----
  EOF
  function_list | while do_read # eval read $read
  do
+     echo "#ifdef ${macro}"
      if class_is_function_p
      then
  	echo "  fprintf_unfiltered (gdb_stdlog,"
*************** do
*** 1133,1147 ****
  	echo "                      (long) current_gdbarch->${function}"
  	echo "                      /*${macro} ()*/);"
      else
! 	if [ "${print_p}" = "#" ]
  	then
- 	  echo "#ifdef ${macro}"
- 	  echo "  fprintf_unfiltered (gdb_stdlog,"
- 	  echo "                      \"gdbarch_update: ${macro} = ${fmt}\\n\","
- 	  echo "                      ${print});"
- 	  echo "#endif"
- 	elif [ "${print_p}" ]
- 	then
  	  echo "  if (${print_p})"
  	  echo "    fprintf_unfiltered (gdb_stdlog,"
  	  echo "                        \"gdbarch_update: ${macro} = ${fmt}\\n\","
--- 1133,1140 ----
  	echo "                      (long) current_gdbarch->${function}"
  	echo "                      /*${macro} ()*/);"
      else
! 	if [ "${print_p}" ]
  	then
  	  echo "  if (${print_p})"
  	  echo "    fprintf_unfiltered (gdb_stdlog,"
  	  echo "                        \"gdbarch_update: ${macro} = ${fmt}\\n\","
*************** do
*** 1152,1159 ****
  	  echo "                      ${print});"
  	fi
      fi
  done
! echo "}"
  
  
  # GET/SET
--- 1145,1158 ----
  	  echo "                      ${print});"
  	fi
      fi
+     echo "#endif"
  done
! cat <<EOF
!   fprintf_unfiltered (gdb_stdlog,
!                       "gdbarch_update: GDB_MULTI_ARCH = %d\\n",
!                       GDB_MULTI_ARCH);
! }
! EOF
  
  
  # GET/SET


More information about the Gdb-patches mailing list