This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: gdb.c++ failures
>>>>> "Daniel" == Daniel Jacobowitz <drow@mvista.com> writes:
> On Thu, Jan 10, 2002 at 07:21:18PM +0000, Jason Merrill wrote:
>> The stabs output from gcc ignores const and volatile. There is even a
>> comment saying that "stabs does not distinguish const and volatile".
>> The method qualifiers are described, and gdb could do the work to apply
>> them to the type of 'this', but it's probably fine just to leave it as it
>> is.
> There are documented extensions to STABS to express both const and
> volatile. GDB supports them, and documents them - see info stabs.
> They're originally Sun extensions.
> Could I persuade you to add them to GCC? It would take you less time
> than I.
Give this a whirl. The output looks right to me, but gdb doesn't seem to
like it much.
2002-01-10 Jason Merrill <jason@redhat.com>
* dbxout.c (dbxout_type): Support const and volatile.
*** dbxout.c.~1~ Thu Jan 10 15:48:14 2002
--- dbxout.c Thu Jan 10 21:22:53 2002
*************** dbxout_type (type, full)
*** 1050,1067 ****
type = integer_type_node;
else
{
- /* Try to find the "main variant" with the same name but not const
- or volatile. (Since stabs does not distinguish const and volatile,
- there is no need to make them separate types. But types with
- different names are usefully distinguished.) */
-
- for (tem = TYPE_MAIN_VARIANT (type); tem; tem = TYPE_NEXT_VARIANT (tem))
- if (!TYPE_READONLY (tem) && !TYPE_VOLATILE (tem)
- && TYPE_NAME (tem) == TYPE_NAME (type))
- {
- type = tem;
- break;
- }
if (TYPE_NAME (type)
&& TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
&& TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (type)))
--- 1050,1055 ----
*************** dbxout_type (type, full)
*** 1157,1168 ****
typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_DEFINED;
! if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
! && DECL_ORIGINAL_TYPE (TYPE_NAME (type)))
! {
! dbxout_type (DECL_ORIGINAL_TYPE (TYPE_NAME (type)), 0);
! return;
! }
switch (TREE_CODE (type))
{
--- 1145,1182 ----
typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_DEFINED;
! /* If this type is a variant of some other, hand off. Types with
! different names are usefully distinguished. */
! {
! tree main_variant;
!
! if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
! && DECL_ORIGINAL_TYPE (TYPE_NAME (type)))
! main_variant = TREE_TYPE (TYPE_NAME (type));
! else
! main_variant = TYPE_MAIN_VARIANT (type);
!
! if (TYPE_READONLY (type) > TYPE_READONLY (main_variant))
! {
! putc ('k', asmfile);
! CHARS (1);
! dbxout_type (build_type_variant (type, 0, TYPE_VOLATILE (type)), 0);
! return;
! }
! else if (TYPE_VOLATILE (type) > TYPE_VOLATILE (main_variant))
! {
! putc ('B', asmfile);
! CHARS (1);
! dbxout_type (build_type_variant (type, TYPE_READONLY (type), 0), 0);
! return;
! }
! else if (main_variant != TYPE_MAIN_VARIANT (type))
! {
! dbxout_type (DECL_ORIGINAL_TYPE (TYPE_NAME (type)), 0);
! return;
! }
! /* else this isn't a cv-variant, so keep going. */
! }
switch (TREE_CODE (type))
{