This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA/RFC] Multi-arch CPLUS_MARKER


On Mon, Apr 22, 2002 at 02:19:40AM -0700, David S. Miller wrote:
> 
> The only tricky bit here was keeping libiberty's demangler uptodate
> when the target architecture changes.  Initially I thought I could use
> the gdb event mechanism to take care of this, but currently that is
> unary and really appears to be a hack for the user interfaces of GDB
> to make use of.
> 
> So as a result I added the call after architecture_changed_event.
> 
> The rest was just a matter of getting CPLUS_MARKER evaluated at
> runtime.
> 
> Ok to install?

Can't approve the gdbarch bits, but I have some comments on the C++
side.

> 2002-04-22  David S. Miller  <davem@redhat.com>
> 
> 	* cp-valprint.c (vtbl_ptr_name_old): Remove CPLUS_MARKER from
> 	here...
> 	(cp_is_vtbl_ptr_type): ... to here so we can compute it at
> 	runtime.
> 	* demangle.c (cplus_markers): Remove CPLUS_MARKER from here...
> 	(is_cplus_marker): ... to here so we can compute it at runtime.
> 	* stabsread.c (vptr_name, vb_name): Move...
> 	(read_cpp_abbrev, read_tilde_fields): ...to here so that
> 	CPLUS_MARKER can be computed at runtime.
> 	(read_member_functions): Drop static from 'opname' declaration
> 	so CPLUS_MARKER can be compted at runtime.
> 	* gdbarch.sh: Add CPLUS_MARKER.  Include demangle.h.  Right
> 	after architecture_changed_event is invoked, call
> 	set_cplus_marker_for_demangling with the updated CPLUS_MARKER.
> 	* gdbarch.c, gdbarch.h: Regenerate.
> 	
> --- ./cp-valprint.c.~1~	Sat Mar 16 12:53:14 2002
> +++ ./cp-valprint.c	Mon Apr 22 01:51:21 2002
> @@ -167,10 +167,11 @@ cp_print_class_method (char *valaddr,
>      }
>  }
>  
> -/* This was what it was for gcc 2.4.5 and earlier.  */
> +/* This was what it was for gcc 2.4.5 and earlier, prepended with
> +   the character CPLUS_MARKER.  */
>  static const char vtbl_ptr_name_old[] =
>  {
> -  CPLUS_MARKER, 'v', 't', 'b', 'l', '_', 'p', 't', 'r', '_', 
> +  'v', 't', 'b', 'l', '_', 'p', 't', 'r', '_', 
>    't', 'y', 'p', 'e', 0
>  };
>  

One of the other uses you cleaned up (cplus_markers) had a legitimate
reason to be an array instead of a string.  This one doesn't now that
it doesn't include CPLUS_MARKER.  Please clean that up - and I'd prefer
a comment like:
/* This (prepended with the character CPLUS_MARKER) is what it was for
   gcc 2.4.5 and earlier.  */


("This was what it was" is disturbingly bad grammar...)

> @@ -192,7 +193,8 @@ cp_is_vtbl_ptr_type (struct type *type)
>  
>    return (typename != NULL
>  	  && (STREQ (typename, vtbl_ptr_name)
> -	      || STREQ (typename, vtbl_ptr_name_old)));
> +	      || (typename[0] == CPLUS_MARKER
> +		  && STREQ (typename + 1, vtbl_ptr_name_old))));
>  }
>  
>  /* Return truth value for the assertion that TYPE is of the type

You don't need to, but feel free to kill STREQ every time you run
across it.

> --- ./gdbarch.sh.~1~	Sat Apr 20 10:41:18 2002
> +++ ./gdbarch.sh	Mon Apr 22 02:11:27 2002
> @@ -505,6 +505,10 @@ f:2:INIT_FRAME_PC:void:init_frame_pc:int
>  v:2:BELIEVE_PCC_PROMOTION:int:believe_pcc_promotion:::::::
>  v:2:BELIEVE_PCC_PROMOTION_TYPE:int:believe_pcc_promotion_type:::::::
>  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
> +# The character that G++ uses to distinguish compiler-generated identifiers
> +# from programmer-specified identifiers.  By default, this expands into
> +# '$'.  Most System V target should define this to '.'.
> +v:2:CPLUS_MARKER:int:cplus_marker::::'.':::
>  # GET_SAVED_REGISTER is like DUMMY_FRAMES.  It is at level one as the
>  # old code has strange #ifdef interaction.  So far no one has found
>  # that default_get_saved_register() is the default they are after.

Comment lies.  You changed the default to a '.' there, which is almost
certainly wrong.  Did you mean '$'?

All the rest of it is either out of my scope or fine by me.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]