Patchwork [4/5] Remove struct main_type.vptr_{fieldno,basetype}: TYPE_SPECIFIC_SELF_TYPE

login
register
mail settings
Submitter Doug Evans
Date Jan. 26, 2015, 12:06 a.m.
Message ID <m3twze8kxc.fsf@sspiff.org>
Download mbox | patch
Permalink /patch/4815/
State New
Headers show

Comments

Doug Evans - Jan. 26, 2015, 12:06 a.m.
Hi.

This patch moves TYPE_SELF_TYPE into new field type_specific.self_type
for MEMBERPTR,METHODPTR types, and into type_specific.func_stuff
for METHODs, and then updates everything to use that.
TYPE_CODE_METHOD could share some things with TYPE_CODE_FUNC
(e.g. TYPE_NO_RETURN) and it seemed simplest to keep them together.

Moving TYPE_SELF_TYPE into type_specific.func_stuff for TYPE_CODE_METHOD
is also nice because when we allocate space for function types we assume
they're TYPE_CODE_FUNCs. If TYPE_CODE_METHODs don't need or use that
space then that space would be wasted, and cleaning that up would involve
more invasive changes.

In order to catch errant uses I've added accessor functions
that do some checking.

One can no longer assign to TYPE_SELF_TYPE like this:

  TYPE_SELF_TYPE (foo) = bar;

One instead has to do:

  set_type_self_type (foo, bar);

But I've left reading of the type to the macro:

  bar = TYPE_SELF_TYPE (foo);

I could add SET_TYPE_SELF_TYPE as a wrapper on set_type_self_type
if you prefer that.

In order to discourage bypassing the TYPE_SELF_TYPE macro
I've named the underlying function that implements it
internal_type_self_type.  I can pick a different name,
but I do like having the contents in a function, instead
of putting it all in the macro.
I can also just remove the TYPE_SELF_TYPE macro and
have all callers call type_self_type instead.

While testing this I found the stabs reader leaving methods
as TYPE_CODE_FUNCs, hitting my newly added asserts.
Since the dwarf reader smashes functions to methods (via
smash_to_method) I've done a similar thing for stabs.

2015-01-24  Doug Evans  <xdje42@gmail.com>

	* cp-valprint.c (cp_find_class_member): Rename parameter domain_p
	to self_p.
	(cp_print_class_member): Rename local domain to self_type.
	* dwarf2read.c (quirk_gcc_member_function_pointer): Rename local
	domain_type to self_type.
	(set_die_type) <need_gnat_info>: Handle
	TYPE_CODE_METHODPTR, TYPE_CODE_MEMBERPTR, TYPE_CODE_METHOD.
	* gdb-gdb.py (StructMainTypePrettyPrinter): Handle
	TYPE_SPECIFIC_SELF_TYPE.
	* gdbtypes.c (internal_type_self_type): New function.
	(set_type_self_type): New function.
	(smash_to_memberptr_type): Rename parameter domain to self_type.
	Update setting of TYPE_SELF_TYPE.
	(smash_to_methodptr_type): Update setting of TYPE_SELF_TYPE.
	(smash_to_method_type): Rename parameter domain to self_type.
	Update setting of TYPE_SELF_TYPE.
	(check_stub_method): Call smash_to_method_type.
	(recursive_dump_type): Handle TYPE_SPECIFIC_SELF_TYPE.
	(copy_type_recursive): Ditto.
	* gdbtypes.h (enum type_specific_kind): New value
	TYPE_SPECIFIC_SELF_TYPE.
	(struct main_type) <type_specific>: New member self_type.
	(struct cplus_struct_type) <fn_field.type>: Update comment.
	(TYPE_SELF_TYPE): Rewrite.
	(internal_type_self_type, set_type_self_type): Declare.
	* gnu-v3-abi.c (gnuv3_print_method_ptr): Rename local domain to
	self_type.
	(gnuv3_method_ptr_to_value): Rename local domain_type to self_type.
	* m2-typeprint.c (m2_range): Replace TYPE_SELF_TYPE with
	TYPE_TARGET_TYPE.
	* stabsread.c (read_member_functions): Mark methods with
	TYPE_CODE_METHOD, not TYPE_CODE_FUNC.  Update setting of
	TYPE_SELF_TYPE.
Doug Evans - Feb. 6, 2015, 7:20 a.m.
"Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr> writes:
>   Hi all,
>
>
>> -----Message d'origine-----
>> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
>> owner@sourceware.org] De la part de Doug Evans
>> Envoyé : lundi 26 janvier 2015 01:07
>> À : gdb-patches@sourceware.org; gaius@glam.ac.uk
>> Objet : [PATCH 4/5] Remove struct main_type.vptr_{fieldno,basetype}:
>> TYPE_SPECIFIC_SELF_TYPE
>> 
>> Hi.
>> 
>> This patch moves TYPE_SELF_TYPE into new field type_specific.self_type
>> for MEMBERPTR,METHODPTR types, and into type_specific.func_stuff
>> for METHODs, and then updates everything to use that.
>> TYPE_CODE_METHOD could share some things with TYPE_CODE_FUNC
>> (e.g. TYPE_NO_RETURN) and it seemed simplest to keep them together.
>> 
>> Moving TYPE_SELF_TYPE into type_specific.func_stuff for
>> TYPE_CODE_METHOD
>> is also nice because when we allocate space for function types we
>> assume
>> they're TYPE_CODE_FUNCs. If TYPE_CODE_METHODs don't need or use that
>> space then that space would be wasted, and cleaning that up would
>> involve
>> more invasive changes.
>> 
>> In order to catch errant uses I've added accessor functions
>> that do some checking.
>> 
>> One can no longer assign to TYPE_SELF_TYPE like this:
>> 
>>   TYPE_SELF_TYPE (foo) = bar;
>> 
>> One instead has to do:
>> 
>>   set_type_self_type (foo, bar);
>> 
>> But I've left reading of the type to the macro:
>> 
>>   bar = TYPE_SELF_TYPE (foo);
>> 
>> I could add SET_TYPE_SELF_TYPE as a wrapper on set_type_self_type
>> if you prefer that.
>> 
>> In order to discourage bypassing the TYPE_SELF_TYPE macro
>> I've named the underlying function that implements it
> ....
>> 	* stabsread.c (read_member_functions): Mark methods with
>> 	TYPE_CODE_METHOD, not TYPE_CODE_FUNC.  Update setting of
>> 	TYPE_SELF_TYPE.
> .....
>> diff --git a/gdb/stabsread.c b/gdb/stabsread.c
>> index 1f46f75..423c442 100644
>> --- a/gdb/stabsread.c
>> +++ b/gdb/stabsread.c
>> @@ -2376,14 +2376,21 @@ read_member_functions (struct field_info *fip,
>> char **pp, struct type *type,
>>  	      p++;
>>  	    }
>> 
>> -	  /* If this is just a stub, then we don't have the real name
>> here.  */
>> +	  /* These are methods, not functions.  */
>> +	  if (TYPE_CODE (new_sublist->fn_field.type) == TYPE_CODE_FUNC)
>> +	    TYPE_CODE (new_sublist->fn_field.type) = TYPE_CODE_METHOD;
>> +	  else
>> +	    gdb_assert (TYPE_CODE (new_sublist->fn_field.type)
>> +			== TYPE_CODE_METHOD);
>> 
>> +	  /* If this is just a stub, then we don't have the real name
>> here.  */
>>  	  if (TYPE_STUB (new_sublist->fn_field.type))
>>  	    {
>>  	      if (!TYPE_SELF_TYPE (new_sublist->fn_field.type))
>   I suspect this is the part that generates the failure 
> I saw when trying to test my pascal patch that used stabs debugging
> information.
>    
>      internal_type_self_type  generates an internal error   
> it does not simply return NULL...

Hi.
Is it easy/possible to send me a repro?
Even just the binary that triggers the problem would help.
It would be good to verify what's going on here.
If internal_type_self_type got an internal error it must be this one:

      gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_FUNC);

But it's hard to see how that would fail given the earlier check
for TYPE_CODE_FUNC:

	  if (TYPE_CODE (new_sublist->fn_field.type) == TYPE_CODE_FUNC)
	    TYPE_CODE (new_sublist->fn_field.type) = TYPE_CODE_METHOD;
	  else
	    gdb_assert (TYPE_CODE (new_sublist->fn_field.type)
			== TYPE_CODE_METHOD);

I'm not sure how we'd get here with anything other than TYPE_CODE_FUNC
but for robustness I added the assert for TYPE_CODE_METHOD.
And if we've got a TYPE_CODE_FUNC then AFAICT that means we've called
make_function_type which sets TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FUNC.
Ergo IWBN to reproduce this and see the details.

I'm not saying there isn't a problem of course,
just that I may need some help understanding it.

Also, why couldn't internal_type_self_type return NULL?

>> -		TYPE_SELF_TYPE (new_sublist->fn_field.type) = type;
>> +		set_type_self_type (new_sublist->fn_field.type, type);
>>  	      new_sublist->fn_field.is_stub = 1;
>>  	    }
>> +
>>  	  new_sublist->fn_field.physname = savestring (*pp, p - *pp);
>>  	  *pp = p + 1;
>
>   The patch below removes the internal error,
> but I am not sure it is the correct fix...
> Maybe set_type_self_type should be called unconditionally.
>
>   Likewise, the line:
> valops.c:2547:    gdb_assert (TYPE_SELF_TYPE (fns_ptr[0].type) != NULL);
> is not compatible with your new internal_type_self_type as this
> new function never returns NULL....
>
>
> Pierre Muller
>
> $ git diff
> diff --git a/gdb/stabsread.c b/gdb/stabsread.c
> index 2a160c5..392fdb2 100644
> --- a/gdb/stabsread.c
> +++ b/gdb/stabsread.c
> @@ -2386,7 +2386,7 @@ read_member_functions (struct field_info *fip, char
> **pp, struct type *type,
>           /* If this is just a stub, then we don't have the real name here.
> */
>           if (TYPE_STUB (new_sublist->fn_field.type))
>             {
> -             if (!TYPE_SELF_TYPE (new_sublist->fn_field.type))
> +              if (TYPE_SPECIFIC_FIELD (new_sublist->fn_field.type) ==
> TYPE_SPECIFIC_NONE)
>                 set_type_self_type (new_sublist->fn_field.type, type);
>               new_sublist->fn_field.is_stub = 1;
>             }
Pierre Muller - Feb. 7, 2015, 5:46 p.m.
Hi all,

   I send to Doug in private an object file
together with the assembler file used to generate it for i386 mingw32 (PE object)
The source was compiled using Free Pascal compiler with -gs option
which generates stabs debugging information.
  ppc386 -gs -al -XX test.pas
(test.pas, test1.pas test2.pas and test2.inc are all source files).
  I don't know if sending binary object file to the mailing list is acceptable.


  Assembling test.s with a mingw32 target enabled assembler should work.
This is enough to trigger the internal error
using a Cygwin or mingw32 GDB (and should work on any platform if
compiled with --enable-targets=all.

  I checked with a i386-linux,
I get the same internal error (I just need to use 
set gnutarget pe-i386
before loading the file).

  I do not send the generated executable and the object is
less dangerous and already shows the problem for me,
and I hope also for you.

  Please find below a transcript of my test using this PE object:
I hope this will help you to understand more clearly what
I described in the previous email.

Pierre Muller

Pierre@E6510-Muller cygwin-32 ~/git/build/norm-cygwin32/gdb
$ ./gdb --args ./gdb ~/pas/trunk/fpcsrc/ide/test.o
GNU gdb (GDB) 7.9.50.20150205-cvs
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-cygwin".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./gdb...done.
Setting up the environment for debugging gdb.
Breakpoint 1 at 0x68c88c: file ../../../binutils-gdb/gdb/common/errors.c, line 54.
Breakpoint 2 at 0x4578d4: file ../../../binutils-gdb/gdb/cli/cli-cmds.c, line 217.
(top-gdb) r
Starting program: /home/Pierre/git/build/norm-cygwin32/gdb/gdb /home/Pierre/pas/trunk/fpcsrc/ide/test.o
[New Thread 2584.0xe1c]
[New Thread 2584.0x1478]
GNU gdb (GDB) 7.9.50.20150205-cvs
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-cygwin".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/Pierre/pas/trunk/fpcsrc/ide/test.o...done.
During symbol reading, incomplete CFI data; unspecified registers (e.g., eax) at 0x68c889.

Breakpoint 1, internal_error (file=0x7f4f8c <NS_INTEGER_POINTER_CONVERSION_BADNESS+204> "../../../binutils-gdb/gdb/gdbtypes.c", line=1204,
    fmt=0x7f4f5e <NS_INTEGER_POINTER_CONVERSION_BADNESS+158> "%s: Assertion `%s' failed.") at ../../../binutils-gdb/gdb/common/errors.c:54
54        va_start (ap, fmt);
(top-gdb) bt
#0  internal_error (file=0x7f4f8c <NS_INTEGER_POINTER_CONVERSION_BADNESS+204> "../../../binutils-gdb/gdb/gdbtypes.c", line=1204,
    fmt=0x7f4f5e <NS_INTEGER_POINTER_CONVERSION_BADNESS+158> "%s: Assertion `%s' failed.") at ../../../binutils-gdb/gdb/common/errors.c:54
#1  0x00570a5f in internal_type_self_type (type=0x801a8050) at ../../../binutils-gdb/gdb/gdbtypes.c:1204
#2  0x005e2d10 in read_member_functions (fip=0x2c2a354, pp=0x2c2a4c0, type=0x801a7f88, objfile=0x801568c8) at ../../../binutils-gdb/gdb/stabsread.c:2389
#3  0x005e578a in read_struct_type (pp=0x2c2a4c0, type=0x801a7f88, type_code=TYPE_CODE_STRUCT, objfile=0x801568c8) at ../../../binutils-gdb/gdb/stabsread.c:3555
#4  0x005e1f34 in read_type (pp=0x2c2a4c0, objfile=0x801568c8) at ../../../binutils-gdb/gdb/stabsread.c:2006
#5  0x005e0683 in define_symbol (valu=0,
    string=0x8018ec27 ":Tt2=s8Z:/038,0,32;$vf2:48,32;INIT::49=##40;:__ct__4TOBJ7POINTER;2A.;FUNC::50=##17;:4TOBJ;2A.;PROC::51=##39;:4TOBJ;2A*0;2;;DONE::52=##39;:__dt__4TOBJ7POINTER;2A*1;2;;;~%2;", desc=0, type=128, objfile=0x801568c8) at ../../../binutils-gdb/gdb/stabsread.c:1316
#6  0x005abfa6 in process_one_symbol (type=128, desc=0, valu=0,
    name=0x8018ec27 ":Tt2=s8Z:/038,0,32;$vf2:48,32;INIT::49=##40;:__ct__4TOBJ7POINTER;2A.;FUNC::50=##17;:4TOBJ;2A.;PROC::51=##39;:4TOBJ;2A*0;2;;DONE::52=##39;:__dt__4TOBJ7POINTER;2A*1;2;;;~%2;",
    section_offsets=0x80189828, objfile=0x801568c8) at ../../../binutils-gdb/gdb/dbxread.c:3203
#7  0x005aaee9 in read_ofile_symtab (objfile=0x801568c8, pst=0x80190148) at ../../../binutils-gdb/gdb/dbxread.c:2601
#8  0x005aa961 in dbx_psymtab_to_symtab_1 (objfile=0x801568c8, pst=0x80190148) at ../../../binutils-gdb/gdb/dbxread.c:2418
#9  0x005aaa98 in dbx_read_symtab (self=0x80190148, objfile=0x801568c8) at ../../../binutils-gdb/gdb/dbxread.c:2471
#10 0x0051fa46 in psymtab_to_symtab (objfile=0x801568c8, pst=0x80190148) at ../../../binutils-gdb/gdb/psymtab.c:788
#11 0x0051f2d3 in psym_lookup_symbol (objfile=0x801568c8, block_index=0, name=0x8014b4f8 "main", domain=VAR_DOMAIN) at ../../../binutils-gdb/gdb/psymtab.c:520
#12 0x00518140 in lookup_symbol_via_quick_fns (objfile=0x801568c8, block_index=0, name=0x8014b4f8 "main", domain=VAR_DOMAIN) at ../../../binutils-gdb/gdb/symtab.c:2436
#13 0x00518488 in lookup_symbol_in_objfile (objfile=0x801568c8, block_index=0, name=0x8014b4f8 "main", domain=VAR_DOMAIN) at ../../../binutils-gdb/gdb/symtab.c:2604
#14 0x0051865f in lookup_symbol_global_iterator_cb (objfile=0x801568c8, cb_data=0x2c2a878) at ../../../binutils-gdb/gdb/symtab.c:2685
#15 0x0041bda5 in windows_iterate_over_objfiles_in_search_order (gdbarch=0x80149d10, cb=0x5185ef <lookup_symbol_global_iterator_cb>, cb_data=0x2c2a878, current_objfile=0x0)
    at ../../../binutils-gdb/gdb/windows-tdep.c:452
#16 0x0056c548 in gdbarch_iterate_over_objfiles_in_search_order (gdbarch=0x80149d10, cb=0x5185ef <lookup_symbol_global_iterator_cb>, cb_data=0x2c2a878, current_objfile=0x0)
    at ../../../binutils-gdb/gdb/gdbarch.c:4412
#17 0x00518777 in lookup_global_symbol (name=0x8014b4f8 "main", block=0x0, domain=VAR_DOMAIN) at ../../../binutils-gdb/gdb/symtab.c:2730
#18 0x005182b6 in basic_lookup_symbol_nonlocal (langdef=0x81be80 <c_language_defn>, name=0x8014b4f8 "main", block=0x0, domain=VAR_DOMAIN) at ../../../binutils-gdb/gdb/symtab.c:2530
#19 0x00517a76 in lookup_symbol_aux (name=0x8014b4f8 "main", block=0x0, domain=VAR_DOMAIN, language=language_c, is_a_field_of_this=0x0) at ../../../binutils-gdb/gdb/symtab.c:2148
#20 0x00517431 in lookup_symbol_in_language (name=0x8014b4f8 "main", block=0x0, domain=VAR_DOMAIN, lang=language_c, is_a_field_of_this=0x0) at ../../../binutils-gdb/gdb/symtab.c:1944
#21 0x00517476 in lookup_symbol (name=0x8014b4f8 "main", block=0x0, domain=VAR_DOMAIN, is_a_field_of_this=0x0) at ../../../binutils-gdb/gdb/symtab.c:1958
#22 0x00524c1e in set_initial_language () at ../../../binutils-gdb/gdb/symfile.c:1698
#23 0x005242ef in symbol_file_add_main_1 (args=0x2c2ac39 "/home/Pierre/pas/trunk/fpcsrc/ide/test.o", from_tty=1, flags=0) at ../../../binutils-gdb/gdb/symfile.c:1327
#24 0x00524290 in symbol_file_add_main (args=0x2c2ac39 "/home/Pierre/pas/trunk/fpcsrc/ide/test.o", from_tty=1) at ../../../binutils-gdb/gdb/symfile.c:1311
#25 0x005569e5 in catch_command_errors_const (command=0x524270 <symbol_file_add_main>, arg=0x2c2ac39 "/home/Pierre/pas/trunk/fpcsrc/ide/test.o", from_tty=1, mask=RETURN_MASK_ALL)
    at ../../../binutils-gdb/gdb/main.c:396
#26 0x005578b6 in captured_main (data=0x2c2abb4) at ../../../binutils-gdb/gdb/main.c:1042
#27 0x00552b9d in catch_errors (func=0x556c36 <captured_main>, func_args=0x2c2abb4, errstring=0x7ea741 <__PRETTY_FUNCTION__.13998+168> "", mask=RETURN_MASK_ALL)
    at ../../../binutils-gdb/gdb/exceptions.c:237
#28 0x00557c4b in gdb_main (args=0x2c2abb4) at ../../../binutils-gdb/gdb/main.c:1157
#29 0x0040120c in main (
During symbol reading, incomplete CFI data; DW_CFA_restore unspecified
register ebx (#3) at 0x6100776e.
argc=2, argv=0x2c2abec) at ../../../binutils-gdb/gdb/gdb.c:32
(top-gdb) f 4
#4  0x005e1f34 in read_type (pp=0x2c2a4c0, objfile=0x801568c8) at ../../../binutils-gdb/gdb/stabsread.c:2006
2006            type = read_struct_type (pp, type, type_code, objfile);
(top-gdb) p pp
$1 = (char **) 0x2c2a4c0
(top-gdb) p *pp
$2 = 0x8018ec54 "__ct__4TOBJ7POINTER;2A.;FUNC::50=##17;:4TOBJ;2A.;PROC::51=##39;:4TOBJ;2A*0;2;;DONE::52=##39;:__dt__4TOBJ7POINTER;2A*1;2;;;~%2;"
(top-gdb) f 3
#3  0x005e578a in read_struct_type (pp=0x2c2a4c0, type=0x801a7f88, type_code=TYPE_CODE_STRUCT, objfile=0x801568c8) at ../../../binutils-gdb/gdb/stabsread.c:3555
3555          || !read_member_functions (&fi, pp, type, objfile)
(top-gdb) p *type
$3 = {pointer_type = 0x0, reference_type = 0x0, chain = 0x801a7f88, instance_flags = 0, length = 8, main_type = 0x801a7fa0}
(top-gdb) p *type.main_type
$4 = {code = TYPE_CODE_STRUCT, flag_unsigned = 0, flag_nosign = 0, flag_stub = 0, flag_target_stub = 0, flag_static = 0, flag_prototyped = 0, flag_incomplete = 0, flag_varargs = 0,
  flag_vector = 0, flag_stub_supported = 0, flag_gnu_ifunc = 0, flag_fixed_instance = 0, flag_objfile_owned = 1, flag_declared_class = 0, flag_flag_enum = 0,
  type_specific_field = TYPE_SPECIFIC_CPLUS_STUFF, nfields = 2, name = 0x0, tag_name = 0x0, owner = {objfile = 0x801568c8, gdbarch = 0x801568c8}, target_type = 0x0, flds_bnds = {
    fields = 0x801a7fd8, bounds = 0x801a7fd8}, type_specific = {cplus_stuff = 0x801a8008, gnat_stuff = 0x801a8008, floatformat = 0x801a8008, func_stuff = 0x801a8008, self_type = 0x801a8008},
  data_location = 0x0}
(top-gdb) f 2
#2  0x005e2d10 in read_member_functions (fip=0x2c2a354, pp=0x2c2a4c0, type=0x801a7f88, objfile=0x801568c8) at ../../../binutils-gdb/gdb/stabsread.c:2389
2389                  if (!TYPE_SELF_TYPE (new_sublist->fn_field.type))
(top-gdb) p new_sublist->fn_field.type
$5 = (struct type *) 0x801a8050
(top-gdb) p *new_sublist->fn_field.type
$6 = {pointer_type = 0x0, reference_type = 0x0, chain = 0x801a8050, instance_flags = 0, length = 1, main_type = 0x801a8068}
(top-gdb) p *new_sublist->fn_field.type.main_type
$7 = {code = TYPE_CODE_METHOD, flag_unsigned = 0, flag_nosign = 0, flag_stub = 1, flag_target_stub = 0, flag_static = 0, flag_prototyped = 0, flag_incomplete = 0, flag_varargs = 0,
  flag_vector = 0, flag_stub_supported = 0, flag_gnu_ifunc = 0, flag_fixed_instance = 0, flag_objfile_owned = 1, flag_declared_class = 0, flag_flag_enum = 0,
  type_specific_field = TYPE_SPECIFIC_NONE, nfields = 0, name = 0x0, tag_name = 0x0, owner = {objfile = 0x801568c8, gdbarch = 0x801568c8}, target_type = 0x80191708, flds_bnds = {fields = 0x0,
    bounds = 0x0}, type_specific = {cplus_stuff = 0x0, gnat_stuff = 0x0, floatformat = 0x0, func_stuff = 0x0, self_type = 0x0}, data_location = 0x0}
(top-gdb) f 1
#1  0x00570a5f in internal_type_self_type (type=0x801a8050) at ../../../binutils-gdb/gdb/gdbtypes.c:1204
1204          gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_FUNC);
(top-gdb) li internal_type_self_type
1191       TYPE must be one of TYPE_CODE_METHODPTR, TYPE_CODE_MEMBERPTR, or
1192       TYPE_CODE_METHOD.  */
1193
1194    struct type *
1195    internal_type_self_type (struct type *type)
1196    {
1197      switch (TYPE_CODE (type))
1198        {
1199        case TYPE_CODE_METHODPTR:
1200        case TYPE_CODE_MEMBERPTR:
(top-gdb)
1201          gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_SELF_TYPE);
1202          return TYPE_MAIN_TYPE (type)->type_specific.self_type;
1203        case TYPE_CODE_METHOD:
1204          gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_FUNC);
1205          return TYPE_MAIN_TYPE (type)->type_specific.func_stuff->self_type;
1206        default:
1207          gdb_assert_not_reached ("bad type");
1208        }
1209    }
1210
(top-gdb)


> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Doug Evans
> Envoyé : vendredi 6 février 2015 08:20
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [PATCH 4/5] Remove struct
> main_type.vptr_{fieldno,basetype}: TYPE_SPECIFIC_SELF_TYPE
> 
> "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr> writes:
> >   Hi all,
> >
> >
> >> -----Message d'origine-----
> >> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> >> owner@sourceware.org] De la part de Doug Evans
> >> Envoyé : lundi 26 janvier 2015 01:07
> >> À : gdb-patches@sourceware.org; gaius@glam.ac.uk
> >> Objet : [PATCH 4/5] Remove struct main_type.vptr_{fieldno,basetype}:
> >> TYPE_SPECIFIC_SELF_TYPE
> >>
> >> Hi.
> >>
> >> This patch moves TYPE_SELF_TYPE into new field
> type_specific.self_type
> >> for MEMBERPTR,METHODPTR types, and into type_specific.func_stuff
> >> for METHODs, and then updates everything to use that.
> >> TYPE_CODE_METHOD could share some things with TYPE_CODE_FUNC
> >> (e.g. TYPE_NO_RETURN) and it seemed simplest to keep them together.
> >>
> >> Moving TYPE_SELF_TYPE into type_specific.func_stuff for
> >> TYPE_CODE_METHOD
> >> is also nice because when we allocate space for function types we
> >> assume
> >> they're TYPE_CODE_FUNCs. If TYPE_CODE_METHODs don't need or use that
> >> space then that space would be wasted, and cleaning that up would
> >> involve
> >> more invasive changes.
> >>
> >> In order to catch errant uses I've added accessor functions
> >> that do some checking.
> >>
> >> One can no longer assign to TYPE_SELF_TYPE like this:
> >>
> >>   TYPE_SELF_TYPE (foo) = bar;
> >>
> >> One instead has to do:
> >>
> >>   set_type_self_type (foo, bar);
> >>
> >> But I've left reading of the type to the macro:
> >>
> >>   bar = TYPE_SELF_TYPE (foo);
> >>
> >> I could add SET_TYPE_SELF_TYPE as a wrapper on set_type_self_type
> >> if you prefer that.
> >>
> >> In order to discourage bypassing the TYPE_SELF_TYPE macro
> >> I've named the underlying function that implements it
> > ....
> >> 	* stabsread.c (read_member_functions): Mark methods with
> >> 	TYPE_CODE_METHOD, not TYPE_CODE_FUNC.  Update setting of
> >> 	TYPE_SELF_TYPE.
> > .....
> >> diff --git a/gdb/stabsread.c b/gdb/stabsread.c
> >> index 1f46f75..423c442 100644
> >> --- a/gdb/stabsread.c
> >> +++ b/gdb/stabsread.c
> >> @@ -2376,14 +2376,21 @@ read_member_functions (struct field_info
> *fip,
> >> char **pp, struct type *type,
> >>  	      p++;
> >>  	    }
> >>
> >> -	  /* If this is just a stub, then we don't have the real name
> >> here.  */
> >> +	  /* These are methods, not functions.  */
> >> +	  if (TYPE_CODE (new_sublist->fn_field.type) == TYPE_CODE_FUNC)
> >> +	    TYPE_CODE (new_sublist->fn_field.type) = TYPE_CODE_METHOD;
> >> +	  else
> >> +	    gdb_assert (TYPE_CODE (new_sublist->fn_field.type)
> >> +			== TYPE_CODE_METHOD);
> >>
> >> +	  /* If this is just a stub, then we don't have the real name
> >> here.  */
> >>  	  if (TYPE_STUB (new_sublist->fn_field.type))
> >>  	    {
> >>  	      if (!TYPE_SELF_TYPE (new_sublist->fn_field.type))
> >   I suspect this is the part that generates the failure
> > I saw when trying to test my pascal patch that used stabs debugging
> > information.
> >
> >      internal_type_self_type  generates an internal error
> > it does not simply return NULL...
> 
> Hi.
> Is it easy/possible to send me a repro?
> Even just the binary that triggers the problem would help.
> It would be good to verify what's going on here.
> If internal_type_self_type got an internal error it must be this one:
> 
>       gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_FUNC);
> 
> But it's hard to see how that would fail given the earlier check
> for TYPE_CODE_FUNC:
> 
> 	  if (TYPE_CODE (new_sublist->fn_field.type) == TYPE_CODE_FUNC)
> 	    TYPE_CODE (new_sublist->fn_field.type) = TYPE_CODE_METHOD;
> 	  else
> 	    gdb_assert (TYPE_CODE (new_sublist->fn_field.type)
> 			== TYPE_CODE_METHOD);
> 
> I'm not sure how we'd get here with anything other than TYPE_CODE_FUNC
> but for robustness I added the assert for TYPE_CODE_METHOD.
> And if we've got a TYPE_CODE_FUNC then AFAICT that means we've called
> make_function_type which sets TYPE_SPECIFIC_FIELD (type) =
> TYPE_SPECIFIC_FUNC.
> Ergo IWBN to reproduce this and see the details.
> 
> I'm not saying there isn't a problem of course,
> just that I may need some help understanding it.
> 
> Also, why couldn't internal_type_self_type return NULL?
> 
> >> -		TYPE_SELF_TYPE (new_sublist->fn_field.type) = type;
> >> +		set_type_self_type (new_sublist->fn_field.type, type);
> >>  	      new_sublist->fn_field.is_stub = 1;
> >>  	    }
> >> +
> >>  	  new_sublist->fn_field.physname = savestring (*pp, p - *pp);
> >>  	  *pp = p + 1;
> >
> >   The patch below removes the internal error,
> > but I am not sure it is the correct fix...
> > Maybe set_type_self_type should be called unconditionally.
> >
> >   Likewise, the line:
> > valops.c:2547:    gdb_assert (TYPE_SELF_TYPE (fns_ptr[0].type) !=
> NULL);
> > is not compatible with your new internal_type_self_type as this
> > new function never returns NULL....
> >
> >
> > Pierre Muller
> >
> > $ git diff
> > diff --git a/gdb/stabsread.c b/gdb/stabsread.c
> > index 2a160c5..392fdb2 100644
> > --- a/gdb/stabsread.c
> > +++ b/gdb/stabsread.c
> > @@ -2386,7 +2386,7 @@ read_member_functions (struct field_info *fip,
> char
> > **pp, struct type *type,
> >           /* If this is just a stub, then we don't have the real name
> here.
> > */
> >           if (TYPE_STUB (new_sublist->fn_field.type))
> >             {
> > -             if (!TYPE_SELF_TYPE (new_sublist->fn_field.type))
> > +              if (TYPE_SPECIFIC_FIELD (new_sublist->fn_field.type)
> ==
> > TYPE_SPECIFIC_NONE)
> >                 set_type_self_type (new_sublist->fn_field.type,
> type);
> >               new_sublist->fn_field.is_stub = 1;
> >             }
.file "test.pas"
# Begin asmlist al_begin

.section .text.b_DEBUGSTART_P$TESTPROGRAM,"x"
.globl	DEBUGSTART_P$TESTPROGRAM
DEBUGSTART_P$TESTPROGRAM:
	.stabs "E:/pas/trunk/fpcsrc/ide/",100,0,0,.Lf12
	.stabs "test.pas",100,0,0,.Lf12
.Lf12:
# End asmlist al_begin
# Begin asmlist al_stabs

.section .data.n_TESTPROGRAM,"d"
.globl	DEBUGINFO_P$TESTPROGRAM
DEBUGINFO_P$TESTPROGRAM:
# Defs - Begin unit SYSTEM has index 1
	.stabs "void:t39=39",128,0,0,0
	.stabs "SHORTINT:t41=r41;-128;127;",128,0,0,0
	.stabs "WORD:t15=r15;0;65535;",128,0,0,0
	.stabs "LONGINT:t38=r38;-2147483648;2147483647;",128,0,0,0
	.stabs "BOOLEAN:t17=-21;",128,0,0,0
	.stabs "LONGBOOL:t40=-23;",128,0,0,0
	.stabs "CHAR:t42=-20;",128,0,0,0
	.stabs "BYTE:t43=r43;0;255;",128,0,0,0
	.stabs "SHORTSTRING:Tt20=s256length:43,0,8;st:ar43;1;255;42,8,2040;;",128,0,0,0
	.stabs "DOUBLE:t30=r38;8;0;",128,0,0,0
	.stabs "EXTENDED:t32=r38;10;0;",128,0,0,0
	.stabs "POINTER:t33=*39",128,0,0,0
	.stabs "file:Tt23=s332HANDLE:38,0,32;MODE:38,32,32;RECSIZE:38,64,32;_PRIVATE:ar38;1;32;42,96,256;USERDATA:ar38;1;16;43,352,128;NAME:ar38;0;255;42,480,2048;;",128,0,0,0
	.stabs "COMP:t31=r38;-8;0;",128,0,0,0
	.stabs "REAL:t29=r38;8;0;",128,0,0,0
# Defs - End unit SYSTEM has index 1
# Defs - Begin unit FPINTRES has index 2
# Defs - End unit FPINTRES has index 2
# Defs - Begin unit OBJPAS has index 3
# Defs - End unit OBJPAS has index 3
# Defs - Begin unit TEST1 has index 4
# Defs - End unit TEST1 has index 4
# Defs - Begin unit TEST2 has index 5
	.stabs "TRECORD:Tt18=s8FIELD1:38,0,32;NEXT:16,32,32;",128,0,0,0
	.stabs "PRECORD:t16=*18",128,0,0,0
# Defs - End unit TEST2 has index 5
# Defs - Begin unit SYSINITPAS has index 6
# Defs - End unit SYSINITPAS has index 6
# Defs - Begin Staticsymtable
	.stabs ":t44=*20",128,0,0,0
	.stabs ":t45=ar38;0;0;33",128,0,0,0
	.stabs "__vtbl_ptr_type:Tt46=s2;",128,0,0,0
	.stabs "pvmt:t47=*46",128,0,0,0
	.stabs "vtblarray:t48=ar38;0;1;47",128,0,0,0
	.stabs ":Tt2=s8Z:/038,0,32;$vf2:48,32;INIT::49=##40;:__ct__4TOBJ7POINTER;2A.;FUNC::50=##17;:4TOBJ;2A.;PROC::51=##39;:4TOBJ;2A*0;2;;DONE::52=##39;:__dt__4TOBJ7POINTER;2A*1;2;;;~%2;",128,0,0,0
	.stabs "vmt_TESTPROGRAMTOBJ:S46",38,0,0,VMT_P$TESTPROGRAM_TOBJ
	.stabs ":t1=*2",128,0,0,0
	.stabs ":Tt3=s8!1,020,2;PROC::53=##39;:5TOBJ2;2A*0;3;;;~%2;",128,0,0,0
	.stabs "vmt_TESTPROGRAMTOBJ2:S46",38,0,0,VMT_P$TESTPROGRAM_TOBJ2
	.stabs ":Tt4=s8!1,020,2;;~%2;",128,0,0,0
	.stabs "vmt_TESTPROGRAMTOBJ3:S46",38,0,0,VMT_P$TESTPROGRAM_TOBJ3
	.stabs ":Tt5=s8!1,020,4;;~%2;",128,0,0,0
	.stabs "vmt_TESTPROGRAMTOBJ32:S46",38,0,0,VMT_P$TESTPROGRAM_TOBJ32
	.stabs ":Tt6=s8!1,020,2;;~%2;",128,0,0,0
	.stabs "vmt_TESTPROGRAMTOBJ4:S46",38,0,0,VMT_P$TESTPROGRAM_TOBJ4
	.stabs "TOBJECT:Tt54=s4$vf54:48,0;CREATE::56=##55;:__ct__7TOBJECT7POINTER;2A.;DESTROY::57=##39;:__dt__7TOBJECT7POINTER;2A*0;54;;NEWINSTANCE::58=##55;:11unnamedtype;2A*1;54;;FREEINSTANCE::59=##39;:7TOBJECT;2A*2;54;;SAFECALLEXCEPTION::60=##61;:7TOBJECT7TOBJECT7POINTER;2A*3;54;;DEFAULTHANDLER::62=##39;:7TOBJECT3var;2A*4;54;;FREE::63=##39;:7TOBJECT;2A.;INITINSTANCE::64=##55;:11unnamedtype7POINTER;2A.;CLEANUPINSTANCE::65=##39;:7TOBJECT;2A.;CLASSTYPE::66=##67;:11unnamedtype;2A.;CLASSINFO::68=##33;:11unnamedtype;2A.;CLASSNAME::69=##20;:11unnamedtype11SHORTSTRING;2A.;CLASSNAMEIS::70=##17;:11unnamedtype11SHORTSTRING;2A.;CLASSPARENT::71=##67;:11unnamedtype;2A.;INSTANCESIZE::72=##38;:11unnamedtype;2A.;INHERITSFROM::73=##17;:11unnamedtype6TCLASS;2A.;STRINGMESSAGETABLE::74=##75;:11unnamedtype;2A.;METHODADDRESS::76=##33;:11unnamedtype11SHORTSTRING;2A.;METHODNAME::77=##20;:11unnamedtype7POINTER11SHORTSTRING;2A.;FIELDADDRESS::78=##33;:7TOBJECT11SHORTSTRING;2A.;AFTERCONSTRUCTION::79=##39;:7TOBJECT;2A*5;54;;BEFOREDESTRUCTION::80=##39;:7TOBJECT;2A*6;54;;DEFAULTHANDLERSTR::81=##39;:7TOBJECT3var;2A*7;54;;DISPATCH::82=##39;:7TOBJECT3var;2A*8;54;;DISPATCHSTR::83=##39;:7TOBJECT3var;2A*9;54;;GETINTERFACE::84=##17;:7TOBJECT5TGUID3out;2A.;GETINTERFACEBYSTR::85=##17;:7TOBJECT11SHORTSTRING3out;2A.;GETINTERFACEWEAK::86=##17;:7TOBJECT5TGUID3out;2A.;GETINTERFACEENTRY::87=##88;:11unnamedtype5TGUID;2A.;GETINTERFACEENTRYBYSTR::89=##88;:11unnamedtype11SHORTSTRING;2A.;GETINTERFACETABLE::90=##91;:11unnamedtype;2A.;UNITNAME::92=##93;:11unnamedtype10ANSISTRING;2A.;EQUALS::94=##17;:7TOBJECT7TOBJECT;2A*10;54;;GETHASHCODE::95=##38;:7TOBJECT;2A*11;54;;TOSTRING::96=##93;:7TOBJECT10ANSISTRING;2A*12;54;;;~%54;",128,0,0,0
	.stabs ":Tt55=*54",128,0,0,0
	.stabs "vmt_SYSTEMTOBJECT:S46",38,0,0,VMT_SYSTEM_TOBJECT
	.stabs "TCLASS:Tt7=s260!1,020,54;NAME:20,32,2048;CREATE::97=##8;:__ct__6TCLASS7POINTER;2A.;;~%54;",128,0,0,0
	.stabs ":Tt8=*7",128,0,0,0
	.stabs "vmt_TESTPROGRAMTCLASS:S46",38,0,0,VMT_P$TESTPROGRAM_TCLASS
	.stabs "TCLASS2:Tt9=s264!1,020,7;X:38,2080,32;CREATE::98=##10;:__ct__7TCLASS27POINTER;2A.;;~%54;",128,0,0,0
	.stabs ":Tt10=*9",128,0,0,0
	.stabs "vmt_TESTPROGRAMTCLASS2:S46",38,0,0,VMT_P$TESTPROGRAM_TCLASS2
	.stabs ":Tt11=eENUM1:0,ENUM2:1,ENUM3:2,;",128,0,0,0
	.stabs ":t12=ar41;1;10;11",128,0,0,0
	.stabs ":t13=*f29",128,0,0,0
	.stabs ":t14=@s32;S11",128,0,0,0
	.stabs ":Tt19=s21length:43,0,8;st:ar43;1;20;42,8,160;;",128,0,0,0
	.stabs ":t21=ar41;2;45;15",128,0,0,0
	.stabs ":Tt22=eENUMELEM1:0,ENUMELEM2:1,ENUMELEM3:2,;",128,0,0,0
	.stabs ":Tt24=s332HANDLE:38,0,32;MODE:38,32,32;RECSIZE:38,64,32;_PRIVATE:ar38;1;32;42,96,256;USERDATA:ar38;1;16;43,352,128;NAME:ar38;0;255;42,480,2048;;",128,0,0,0
	.stabs ":Tt25=s332HANDLE:38,0,32;MODE:38,32,32;RECSIZE:38,64,32;_PRIVATE:ar38;1;32;42,96,256;USERDATA:ar38;1;16;43,352,128;NAME:ar38;0;255;42,480,2048;;",128,0,0,0
	.stabs ":t26=*f39",128,0,0,0
	.stabs ":t27=*f17",128,0,0,0
	.stabs ":t28=@s256;S42",128,0,0,0
	.stabs "SMALLINT:t99=r99;-32768;32767;",128,0,0,0
	.stabs ":t34=ar99;1;2000;42",128,0,0,0
	.stabs ":t35=ar99;1;2000;32",128,0,0,0
	.stabs ":t36=ar99;1;2000;32",128,0,0,0
	.stabs "SINGLE:t100=r38;4;0;",128,0,0,0
	.stabs ":t101=ar41;1;10;100",128,0,0,0
	.stabs ":t37=ar41;1;10;101",128,0,0,0
# Defs - End Staticsymtable
	.stabs "HRESULT:t61=r61;-2147483648;2147483647;",128,0,0,0
	.stabs "pvmt:t47=*46",128,0,0,0
	.stabs "PSHORTSTRING:t102=*20",128,0,0,0
	.stabs "TMSGSTRTABLE:Tt103=s8NAME:102,0,32;METHOD:33,32,32;",128,0,0,0
	.stabs ":t104=ar41;0;0;103",128,0,0,0
	.stabs "TSTRINGMESSAGETABLE:Tt105=s12COUNT:38,0,32;MSGSTRTABLE:104,32,64;",128,0,0,0
	.stabs "PSTRINGMESSAGETABLE:t75=*105",128,0,0,0
	.stabs "LONGWORD:t106=r106;0;-1;",128,0,0,0
	.stabs ":t107=ar41;0;7;43",128,0,0,0
	.stabs ":t108=ar41;0;7;43",128,0,0,0
	.stabs ":t109=ar41;0;5;43",128,0,0,0
	.stabs "TGUID:Tt110=s16DATA1:106,0,32;DATA2:15,32,16;DATA3:15,48,16;DATA4:107,64,64;D1:106,0,32;D2:15,32,16;D3:15,48,16;D4:108,64,64;TIME_LOW:106,0,32;TIME_MID:15,32,16;TIME_HI_AND_VERSION:15,48,16;CLOCK_SEQ_HI_AND_RESERVED:43,64,8;CLOCK_SEQ_LOW:43,72,8;NODE:109,80,48;",128,0,0,0
	.stabs "PGUID:t111=*110",128,0,0,0
	.stabs "TINTERFACEENTRYTYPE:Tt112=eETSTANDARD:0,ETVIRTUALMETHODRESULT:1,ETSTATICMETHODRESULT:2,ETFIELDVALUE:3,ETVIRTUALMETHODCLASS:4,ETSTATICMETHODCLASS:5,ETFIELDVALUECLASS:6,;",128,0,0,0
	.stabs "TINTERFACEENTRY:Tt113=s20IID:111,0,32;VTABLE:33,32,32;IOFFSET:106,64,32;IIDSTR:102,96,32;ITYPE:112,128,32;__PAD_DUMMY:33,128,32;",128,0,0,0
	.stabs "PINTERFACEENTRY:t88=*113",128,0,0,0
	.stabs ":t114=ar41;0;0;113",128,0,0,0
	.stabs "TINTERFACETABLE:Tt115=s24ENTRYCOUNT:106,0,32;ENTRIES:114,32,160;",128,0,0,0
	.stabs "PINTERFACETABLE:t91=*115",128,0,0,0
	.stabs "ANSISTRING:Tt93=*42",128,0,0,0
# Syms - Begin Staticsymtable
	.stabs "A:c=i1234;",36,0,12,0
	.stabs "C:c=s'\\001\\002\\003\\004';",36,0,13,0
	.stabs "CONSTBOOL1:c=i1;",36,0,14,0
	.stabs "CONSTBOOL2:c=i5;",36,0,15,0
	.stabs "CONSTCHAR:c=i65;",36,0,16,0
	.stabs "CONSTSET:c=i0;",36,0,17,0
	.stabs "CONSTSET2:c=i0;",36,0,18,0
	.stabs "CONSTFLOAT:c=r 3.1415000000000000E+0000;",36,0,19,0
	.stabs "POBJ:t1",128,0,24,0
	.stabs "TOBJ:Tt2",128,0,25,0
	.stabs "TOBJ2:Tt3",128,0,34,0
	.stabs "TOBJ3:Tt4",128,0,38,0
	.stabs "TOBJ32:Tt5",128,0,41,0
	.stabs "TOBJ4:Tt6",128,0,44,0
	.stabs "TCLASS:Tt8",128,0,47,0
	.stabs "TCLASS2:Tt10",128,0,52,0
	.stabs "ENUMTYP:Tt11",128,0,57,0
	.stabs "ARRAYTYP:t12",128,0,58,0
	.stabs "PROCTYP:t13",128,0,59,0
	.stabs "SETTYP:t14",128,0,60,0
	.stabs "CONSTORD:c=i0;",36,0,63,0
	.stabs "HELLO:S15",40,0,65,U_P$TESTPROGRAM_HELLO
	.stabs "X:S16",40,0,66,U_P$TESTPROGRAM_X
	.stabs "BOOL:S17",40,0,67,U_P$TESTPROGRAM_BOOL
	.stabs "T:S18",40,0,68,U_P$TESTPROGRAM_T
	.stabs "STR20:S19",40,0,69,U_P$TESTPROGRAM_STR20
	.stabs "STR255:S20",40,0,70,U_P$TESTPROGRAM_STR255
	.stabs "ARRAYW:S21",40,0,71,U_P$TESTPROGRAM_ARRAYW
	.stabs "ARRAYVAR:S12",40,0,72,U_P$TESTPROGRAM_ARRAYVAR
	.stabs "ENUMVAR:S22",40,0,73,U_P$TESTPROGRAM_ENUMVAR
	.stabs "ENUMVAR2:S11",40,0,74,U_P$TESTPROGRAM_ENUMVAR2
	.stabs "FILEVAR:S23",40,0,75,U_P$TESTPROGRAM_FILEVAR
	.stabs "FILEVARR:S24",40,0,76,U_P$TESTPROGRAM_FILEVARR
	.stabs "FILEVARW:S25",40,0,77,U_P$TESTPROGRAM_FILEVARW
	.stabs "PROCVAR:S26",40,0,78,U_P$TESTPROGRAM_PROCVAR
	.stabs "PROCVARD:S27",40,0,79,U_P$TESTPROGRAM_PROCVARD
	.stabs "PROCVARI:S13",40,0,80,U_P$TESTPROGRAM_PROCVARI
	.stabs "SETVARD:S28",40,0,81,U_P$TESTPROGRAM_SETVARD
	.stabs "SETVARI:S14",40,0,82,U_P$TESTPROGRAM_SETVARI
	.stabs "FLOAT1:S29",40,0,83,U_P$TESTPROGRAM_FLOAT1
	.stabs "FLOAT2:S30",40,0,84,U_P$TESTPROGRAM_FLOAT2
	.stabs "FLOAT3:S31",40,0,85,U_P$TESTPROGRAM_FLOAT3
	.stabs "FLOAT4:S32",40,0,86,U_P$TESTPROGRAM_FLOAT4
	.stabs "POINTER1:S33",40,0,87,U_P$TESTPROGRAM_POINTER1
	.stabs "POINTER2:S1",40,0,88,U_P$TESTPROGRAM_POINTER2
	.stabs "CLASSVAR1:S8",40,0,89,U_P$TESTPROGRAM_CLASSVAR1
	.stabs "CLASSVAR2:S10",40,0,90,U_P$TESTPROGRAM_CLASSVAR2
	.stabs "OBJ1:S2",40,0,91,U_P$TESTPROGRAM_OBJ1
	.stabs "OBJ2:S3",40,0,92,U_P$TESTPROGRAM_OBJ2
	.stabs "CHARARRAY:S34",40,0,93,U_P$TESTPROGRAM_CHARARRAY
	.stabs "EXTENDEDARRAY:S35",40,0,94,U_P$TESTPROGRAM_EXTENDEDARRAY
	.stabs "EXTENDEDPACKEDARRAY:S36",40,0,95,U_P$TESTPROGRAM_EXTENDEDPACKEDARRAY
	.stabs "SINGLEARRAYARRAY:S37",40,0,96,U_P$TESTPROGRAM_SINGLEARRAYARRAY
	.stabs "I:S38",40,0,159,U_P$TESTPROGRAM_I
	.stabs "J:S38",40,0,159,U_P$TESTPROGRAM_J
	.stabs "LENGTH:S38",40,0,160,U_P$TESTPROGRAM_LENGTH
# Syms - End Staticsymtable
# End asmlist al_stabs
# Begin asmlist al_procedures

.section .text.n_p$testprogram_tobj_$__init$$longbool,"x"
	.balign 16,0x90
.globl	P$TESTPROGRAM_TOBJ_$__INIT$$LONGBOOL
P$TESTPROGRAM_TOBJ_$__INIT$$LONGBOOL:
	.stabs "TOBJ__INIT:F40",36,0,98,P$TESTPROGRAM_TOBJ_$__INIT$$LONGBOOL
	.stabs "vmt:R33",64,0,26,2
	.stabs "vmt:33",160,0,26,-4
	.stabs "$t:v2",160,0,0,-8
# Temps allocated between ebp-8 and ebp-8
	.stabs "test.pas",132,0,0,.Lf1
.Lf1:
	.stabn 68,0,99,.Ll1 - P$TESTPROGRAM_TOBJ_$__INIT$$LONGBOOL
.Ll1:
# [test.pas]
# [99] begin
	pushl	%ebp
	movl	%esp,%ebp
	subl	$8,%esp
# Var $vmt located at ebp-4
# Var $self located at ebp-8
	movl	%eax,-8(%ebp)
	movl	%edx,-4(%ebp)
	.stabn 68,0,99,.Ll2 - P$TESTPROGRAM_TOBJ_$__INIT$$LONGBOOL
.Ll2:
	leal	-4(%ebp),%edx
	movl	-8(%ebp),%eax
	movl	$4,%ecx
	call	fpc_help_constructor
	movl	%eax,-8(%ebp)
	movl	-8(%ebp),%eax
	testl	%eax,%eax
	je	.Lj13
	jmp	.Lj14
.Lj13:
	jmp	.Lj3
.Lj14:
	.stabn 68,0,100,.Ll3 - P$TESTPROGRAM_TOBJ_$__INIT$$LONGBOOL
.Ll3:
# [100] Z:=1;
	movl	-8(%ebp),%eax
	movl	$1,(%eax)
.Lj3:
	.stabn 68,0,101,.Ll4 - P$TESTPROGRAM_TOBJ_$__INIT$$LONGBOOL
.Ll4:
# [101] end;
	movl	-8(%ebp),%eax
	leave
	ret
	.stabn 192,0,0,P$TESTPROGRAM_TOBJ_$__INIT$$LONGBOOL-P$TESTPROGRAM_TOBJ_$__INIT$$LONGBOOL
	.stabn 224,0,0,.Lt2-P$TESTPROGRAM_TOBJ_$__INIT$$LONGBOOL
.Lt2:

.section .text.n_p$testprogram_tobj_$__func$$boolean,"x"
	.balign 16,0x90
.globl	P$TESTPROGRAM_TOBJ_$__FUNC$$BOOLEAN
P$TESTPROGRAM_TOBJ_$__FUNC$$BOOLEAN:
	.stabs "TOBJ__FUNC:F17",36,0,103,P$TESTPROGRAM_TOBJ_$__FUNC$$BOOLEAN
	.stabs "$t:v2",160,0,0,-4
	.stabs "result:17",160,0,103,-8
# Temps allocated between ebp-8 and ebp-8
	.stabs "test.pas",132,0,0,.Lf2
.Lf2:
	.stabn 68,0,104,.Ll5 - P$TESTPROGRAM_TOBJ_$__FUNC$$BOOLEAN
.Ll5:
# [104] begin
	pushl	%ebp
	movl	%esp,%ebp
	subl	$8,%esp
# Var $self located at ebp-4
# Var $result located at ebp-8
	movl	%eax,-4(%ebp)
	.stabn 68,0,105,.Ll6 - P$TESTPROGRAM_TOBJ_$__FUNC$$BOOLEAN
.Ll6:
# [105] Func:=true;
	movb	$1,-8(%ebp)
	.stabn 68,0,106,.Ll7 - P$TESTPROGRAM_TOBJ_$__FUNC$$BOOLEAN
.Ll7:
# [106] end;
	movb	-8(%ebp),%al
	leave
	ret
	.stabs "FUNC:X17",160,0,0,-8
	.stabs "RESULT:X17",160,0,0,-8
	.stabn 192,0,0,P$TESTPROGRAM_TOBJ_$__FUNC$$BOOLEAN-P$TESTPROGRAM_TOBJ_$__FUNC$$BOOLEAN
	.stabn 224,0,0,.Lt3-P$TESTPROGRAM_TOBJ_$__FUNC$$BOOLEAN
.Lt3:

.section .text.n_p$testprogram_tobj_$__proc,"x"
	.balign 16,0x90
.globl	P$TESTPROGRAM_TOBJ_$__PROC
P$TESTPROGRAM_TOBJ_$__PROC:
	.stabs "TOBJ__PROC:F39",36,0,108,P$TESTPROGRAM_TOBJ_$__PROC
	.stabs "$t:v2",160,0,0,-4
# Temps allocated between ebp-4 and ebp-4
	.stabs "test.pas",132,0,0,.Lf3
.Lf3:
	.stabn 68,0,109,.Ll8 - P$TESTPROGRAM_TOBJ_$__PROC
.Ll8:
# [109] begin
	pushl	%ebp
	movl	%esp,%ebp
	subl	$4,%esp
# Var $self located at ebp-4
	movl	%eax,-4(%ebp)
	.stabn 68,0,110,.Ll9 - P$TESTPROGRAM_TOBJ_$__PROC
.Ll9:
# [110] if Func=false then Halt;
	movl	-4(%ebp),%eax
	call	P$TESTPROGRAM_TOBJ_$__FUNC$$BOOLEAN
	testb	%al,%al
	je	.Lj23
	jmp	.Lj24
.Lj23:
	movl	$0,%eax
	call	SYSTEM_HALT$LONGINT
.Lj24:
	.stabn 68,0,111,.Ll10 - P$TESTPROGRAM_TOBJ_$__PROC
.Ll10:
# [111] end;
	leave
	ret
	.stabn 192,0,0,P$TESTPROGRAM_TOBJ_$__PROC-P$TESTPROGRAM_TOBJ_$__PROC
	.stabn 224,0,0,.Lt4-P$TESTPROGRAM_TOBJ_$__PROC
.Lt4:

.section .text.n_p$testprogram_tobj_$__done,"x"
	.balign 16,0x90
.globl	P$TESTPROGRAM_TOBJ_$__DONE
P$TESTPROGRAM_TOBJ_$__DONE:
	.stabs "TOBJ__DONE:F39",36,0,113,P$TESTPROGRAM_TOBJ_$__DONE
	.stabs "vmt:R33",64,0,29,2
	.stabs "vmt:33",160,0,29,-4
	.stabs "$t:v2",160,0,0,-8
# Temps allocated between ebp-8 and ebp-8
	.stabs "test.pas",132,0,0,.Lf4
.Lf4:
	.stabn 68,0,114,.Ll11 - P$TESTPROGRAM_TOBJ_$__DONE
.Ll11:
# [114] begin
	pushl	%ebp
	movl	%esp,%ebp
	subl	$8,%esp
# Var $vmt located at ebp-4
# Var $self located at ebp-8
	movl	%eax,-8(%ebp)
	movl	%edx,-4(%ebp)
	.stabn 68,0,115,.Ll12 - P$TESTPROGRAM_TOBJ_$__DONE
.Ll12:
# [115] end;
	movl	-4(%ebp),%edx
	movl	-8(%ebp),%eax
	movl	$4,%ecx
	call	fpc_help_destructor
	leave
	ret
	.stabn 192,0,0,P$TESTPROGRAM_TOBJ_$__DONE-P$TESTPROGRAM_TOBJ_$__DONE
	.stabn 224,0,0,.Lt5-P$TESTPROGRAM_TOBJ_$__DONE
.Lt5:

.section .text.n_p$testprogram_tobj2_$__proc,"x"
	.balign 16,0x90
.globl	P$TESTPROGRAM_TOBJ2_$__PROC
P$TESTPROGRAM_TOBJ2_$__PROC:
	.stabs "TOBJ2__PROC:F39",36,0,117,P$TESTPROGRAM_TOBJ2_$__PROC
	.stabs "$t:v3",160,0,0,-4
# Temps allocated between ebp-4 and ebp-4
	.stabs "test.pas",132,0,0,.Lf5
.Lf5:
	.stabn 68,0,118,.Ll13 - P$TESTPROGRAM_TOBJ2_$__PROC
.Ll13:
# [118] begin
	pushl	%ebp
	movl	%esp,%ebp
	subl	$4,%esp
# Var $self located at ebp-4
	movl	%eax,-4(%ebp)
	.stabn 68,0,119,.Ll14 - P$TESTPROGRAM_TOBJ2_$__PROC
.Ll14:
# [119] Z:=4;
	movl	-4(%ebp),%eax
	movl	$4,(%eax)
	.stabn 68,0,120,.Ll15 - P$TESTPROGRAM_TOBJ2_$__PROC
.Ll15:
# [120] end;
	leave
	ret
	.stabn 192,0,0,P$TESTPROGRAM_TOBJ2_$__PROC-P$TESTPROGRAM_TOBJ2_$__PROC
	.stabn 224,0,0,.Lt6-P$TESTPROGRAM_TOBJ2_$__PROC
.Lt6:

.section .text.n_p$testprogram_tclass_$__create$$tclass,"x"
	.balign 16,0x90
.globl	P$TESTPROGRAM_TCLASS_$__CREATE$$TCLASS
P$TESTPROGRAM_TCLASS_$__CREATE$$TCLASS:
	.stabs "TCLASS__CREATE:F8",36,0,122,P$TESTPROGRAM_TCLASS_$__CREATE$$TCLASS
	.stabs "vmt:R33",64,0,49,2
	.stabs "vmt:33",160,0,49,-4
	.stabs "$t:p8",160,0,0,-8
# Temps allocated between ebp-88 and ebp-8
	.stabs "test.pas",132,0,0,.Lf6
.Lf6:
	.stabn 68,0,123,.Ll16 - P$TESTPROGRAM_TCLASS_$__CREATE$$TCLASS
.Ll16:
# [123] begin
	pushl	%ebp
	movl	%esp,%ebp
	subl	$88,%esp
# Var $vmt located at ebp-4
# Var $self located at ebp-8
	movl	%eax,-8(%ebp)
	movl	%edx,-4(%ebp)
	.stabn 68,0,123,.Ll17 - P$TESTPROGRAM_TCLASS_$__CREATE$$TCLASS
.Ll17:
	movl	-4(%ebp),%eax
	cmpl	$1,%eax
	ja	.Lj43
	jmp	.Lj44
.Lj43:
	movl	-4(%ebp),%eax
	movl	-4(%ebp),%edx
	call	*52(%edx)
	movl	%eax,-8(%ebp)
.Lj44:
	movl	-8(%ebp),%eax
	testl	%eax,%eax
	je	.Lj49
	jmp	.Lj50
.Lj49:
	jmp	.Lj41
.Lj50:
	.stabn 68,0,125,.Ll18 - P$TESTPROGRAM_TCLASS_$__CREATE$$TCLASS
.Ll18:
# [125] end;
	leal	-20(%ebp),%ecx
	leal	-44(%ebp),%edx
	movl	$1,%eax
	call	FPC_PUSHEXCEPTADDR
	call	FPC_SETJMP
	pushl	%eax
	testl	%eax,%eax
	jne	.Lj53
	leal	-60(%ebp),%ecx
	leal	-84(%ebp),%edx
	movl	$1,%eax
	call	FPC_PUSHEXCEPTADDR
	call	FPC_SETJMP
	pushl	%eax
	testl	%eax,%eax
	jne	.Lj57
	.stabn 68,0,124,.Ll19 - P$TESTPROGRAM_TCLASS_$__CREATE$$TCLASS
.Ll19:
# [124] Name:='TClass instance';
	movl	-8(%ebp),%eax
	leal	4(%eax),%eax
	movl	$_$TESTPROGRAM$_Ld1,%ecx
	movl	$255,%edx
	call	fpc_shortstr_to_shortstr
.Lj57:
	call	FPC_POPADDRSTACK
	popl	%eax
	testl	%eax,%eax
	je	.Lj58
	call	FPC_RERAISE
.Lj58:
	.stabn 68,0,125,.Ll20 - P$TESTPROGRAM_TCLASS_$__CREATE$$TCLASS
.Ll20:
	movl	-8(%ebp),%eax
	testl	%eax,%eax
	jne	.Lj68
	jmp	.Lj67
.Lj68:
	movl	-4(%ebp),%eax
	testl	%eax,%eax
	jne	.Lj66
	jmp	.Lj67
.Lj66:
	movl	-8(%ebp),%eax
	movl	-8(%ebp),%edx
	movl	(%edx),%edx
	call	*68(%edx)
.Lj67:
.Lj53:
	call	FPC_POPADDRSTACK
	popl	%eax
	testl	%eax,%eax
	je	.Lj55
	leal	-60(%ebp),%ecx
	leal	-88(%ebp),%edx
	movl	$1,%eax
	call	FPC_PUSHEXCEPTADDR
	call	FPC_SETJMP
	pushl	%eax
	testl	%eax,%eax
	jne	.Lj72
	movl	-4(%ebp),%eax
	testl	%eax,%eax
	jne	.Lj73
	jmp	.Lj74
.Lj73:
	movl	-8(%ebp),%eax
	movl	$-1,%edx
	movl	-8(%ebp),%ecx
	movl	(%ecx),%ecx
	call	*48(%ecx)
.Lj74:
	call	FPC_POPADDRSTACK
	call	FPC_RERAISE
.Lj72:
	call	FPC_POPADDRSTACK
	popl	%eax
	testl	%eax,%eax
	je	.Lj71
	call	FPC_POPSECONDOBJECTSTACK
	call	FPC_DESTROYEXCEPTION
	call	FPC_RERAISE
.Lj71:
	call	FPC_POPOBJECTSTACK
	call	FPC_DESTROYEXCEPTION
	jmp	.Lj55
.Lj55:
.Lj41:
	movl	-8(%ebp),%eax
	leave
	ret
	.stabn 192,0,0,P$TESTPROGRAM_TCLASS_$__CREATE$$TCLASS-P$TESTPROGRAM_TCLASS_$__CREATE$$TCLASS
	.stabn 224,0,0,.Lt7-P$TESTPROGRAM_TCLASS_$__CREATE$$TCLASS
.Lt7:

.section .text.n_p$testprogram_tclass2_$__create$$tclass2,"x"
	.balign 16,0x90
.globl	P$TESTPROGRAM_TCLASS2_$__CREATE$$TCLASS2
P$TESTPROGRAM_TCLASS2_$__CREATE$$TCLASS2:
	.stabs "TCLASS2__CREATE:F10",36,0,127,P$TESTPROGRAM_TCLASS2_$__CREATE$$TCLASS2
	.stabs "vmt:R33",64,0,54,2
	.stabs "vmt:33",160,0,54,-4
	.stabs "$t:p10",160,0,0,-8
# Temps allocated between ebp-88 and ebp-8
	.stabs "test.pas",132,0,0,.Lf7
.Lf7:
	.stabn 68,0,128,.Ll21 - P$TESTPROGRAM_TCLASS2_$__CREATE$$TCLASS2
.Ll21:
# [128] begin
	pushl	%ebp
	movl	%esp,%ebp
	subl	$88,%esp
# Var $vmt located at ebp-4
# Var $self located at ebp-8
	movl	%eax,-8(%ebp)
	movl	%edx,-4(%ebp)
	.stabn 68,0,128,.Ll22 - P$TESTPROGRAM_TCLASS2_$__CREATE$$TCLASS2
.Ll22:
	movl	-4(%ebp),%eax
	cmpl	$1,%eax
	ja	.Lj81
	jmp	.Lj82
.Lj81:
	movl	-4(%ebp),%eax
	movl	-4(%ebp),%edx
	call	*52(%edx)
	movl	%eax,-8(%ebp)
.Lj82:
	movl	-8(%ebp),%eax
	testl	%eax,%eax
	je	.Lj87
	jmp	.Lj88
.Lj87:
	jmp	.Lj79
.Lj88:
	.stabn 68,0,131,.Ll23 - P$TESTPROGRAM_TCLASS2_$__CREATE$$TCLASS2
.Ll23:
# [131] end;
	leal	-20(%ebp),%ecx
	leal	-44(%ebp),%edx
	movl	$1,%eax
	call	FPC_PUSHEXCEPTADDR
	call	FPC_SETJMP
	pushl	%eax
	testl	%eax,%eax
	jne	.Lj91
	leal	-60(%ebp),%ecx
	leal	-84(%ebp),%edx
	movl	$1,%eax
	call	FPC_PUSHEXCEPTADDR
	call	FPC_SETJMP
	pushl	%eax
	testl	%eax,%eax
	jne	.Lj95
	.stabn 68,0,129,.Ll24 - P$TESTPROGRAM_TCLASS2_$__CREATE$$TCLASS2
.Ll24:
# [129] Name:='TClass2 instance';
	movl	-8(%ebp),%eax
	leal	4(%eax),%eax
	movl	$_$TESTPROGRAM$_Ld2,%ecx
	movl	$255,%edx
	call	fpc_shortstr_to_shortstr
	.stabn 68,0,130,.Ll25 - P$TESTPROGRAM_TCLASS2_$__CREATE$$TCLASS2
.Ll25:
# [130] X:=7;
	movl	-8(%ebp),%eax
	movl	$7,260(%eax)
.Lj95:
	call	FPC_POPADDRSTACK
	popl	%eax
	testl	%eax,%eax
	je	.Lj96
	call	FPC_RERAISE
.Lj96:
	.stabn 68,0,131,.Ll26 - P$TESTPROGRAM_TCLASS2_$__CREATE$$TCLASS2
.Ll26:
	movl	-8(%ebp),%eax
	testl	%eax,%eax
	jne	.Lj108
	jmp	.Lj107
.Lj108:
	movl	-4(%ebp),%eax
	testl	%eax,%eax
	jne	.Lj106
	jmp	.Lj107
.Lj106:
	movl	-8(%ebp),%eax
	movl	-8(%ebp),%edx
	movl	(%edx),%edx
	call	*68(%edx)
.Lj107:
.Lj91:
	call	FPC_POPADDRSTACK
	popl	%eax
	testl	%eax,%eax
	je	.Lj93
	leal	-60(%ebp),%ecx
	leal	-88(%ebp),%edx
	movl	$1,%eax
	call	FPC_PUSHEXCEPTADDR
	call	FPC_SETJMP
	pushl	%eax
	testl	%eax,%eax
	jne	.Lj112
	movl	-4(%ebp),%eax
	testl	%eax,%eax
	jne	.Lj113
	jmp	.Lj114
.Lj113:
	movl	-8(%ebp),%eax
	movl	$-1,%edx
	movl	-8(%ebp),%ecx
	movl	(%ecx),%ecx
	call	*48(%ecx)
.Lj114:
	call	FPC_POPADDRSTACK
	call	FPC_RERAISE
.Lj112:
	call	FPC_POPADDRSTACK
	popl	%eax
	testl	%eax,%eax
	je	.Lj111
	call	FPC_POPSECONDOBJECTSTACK
	call	FPC_DESTROYEXCEPTION
	call	FPC_RERAISE
.Lj111:
	call	FPC_POPOBJECTSTACK
	call	FPC_DESTROYEXCEPTION
	jmp	.Lj93
.Lj93:
.Lj79:
	movl	-8(%ebp),%eax
	leave
	ret
	.stabn 192,0,0,P$TESTPROGRAM_TCLASS2_$__CREATE$$TCLASS2-P$TESTPROGRAM_TCLASS2_$__CREATE$$TCLASS2
	.stabn 224,0,0,.Lt8-P$TESTPROGRAM_TCLASS2_$__CREATE$$TCLASS2
.Lt8:

.section .text.n_p$testprogram_func1$word$word$boolean$trecord$$shortint,"x"
	.balign 16,0x90
.globl	P$TESTPROGRAM_FUNC1$WORD$WORD$BOOLEAN$TRECORD$$SHORTINT
P$TESTPROGRAM_FUNC1$WORD$WORD$BOOLEAN$TRECORD$$SHORTINT:
	.stabs "FUNC1:F41",36,0,133,P$TESTPROGRAM_FUNC1$WORD$WORD$BOOLEAN$TRECORD$$SHORTINT
	.stabs "X:R15",64,0,133,0
	.stabs "X:15",160,0,133,-4
	.stabs "Z:R15",64,0,133,2
	.stabs "Z:15",160,0,133,-8
	.stabs "Y:v17",160,0,133,-12
	.stabs "R:v18",160,0,133,8
	.stabs "result:41",160,0,133,-16
	.stabs "LOC:20",160,0,135,-272
# Temps allocated between ebp-272 and ebp-272
	.stabs "test.pas",132,0,0,.Lf8
.Lf8:
	.stabn 68,0,151,.Ll27 - P$TESTPROGRAM_FUNC1$WORD$WORD$BOOLEAN$TRECORD$$SHORTINT
.Ll27:
# [151] begin
	pushl	%ebp
	movl	%esp,%ebp
	subl	$272,%esp
# Var x located at ebp-4
# Var z located at ebp-8
# Var y located at ebp-12
# Var r located at ebp+8
# Var $result located at ebp-16
# Var loc located at ebp-272
	movw	%ax,-4(%ebp)
	movw	%dx,-8(%ebp)
	movl	%ecx,-12(%ebp)
	.stabn 68,0,152,.Ll28 - P$TESTPROGRAM_FUNC1$WORD$WORD$BOOLEAN$TRECORD$$SHORTINT
.Ll28:
# [152] loc:='This is a string';
	leal	-272(%ebp),%eax
	movl	$_$TESTPROGRAM$_Ld3,%ecx
	movl	$255,%edx
	call	fpc_shortstr_to_shortstr
	.stabn 68,0,153,.Ll29 - P$TESTPROGRAM_FUNC1$WORD$WORD$BOOLEAN$TRECORD$$SHORTINT
.Ll29:
# [153] if Hello=0 then X:=0 else X:=1;
	movzwl	U_P$TESTPROGRAM_HELLO,%eax
	testl	%eax,%eax
	je	.Lj131
	jmp	.Lj132
.Lj131:
	movw	$0,-4(%ebp)
	jmp	.Lj135
.Lj132:
	movw	$1,-4(%ebp)
.Lj135:
	.stabn 68,0,154,.Ll30 - P$TESTPROGRAM_FUNC1$WORD$WORD$BOOLEAN$TRECORD$$SHORTINT
.Ll30:
# [154] test_local(0,2);
	movl	%ebp,%eax
	movl	$2,%ecx
	movl	$0,%edx
	call	P$TESTPROGRAM_FUNC1$crcE9EB7FD8_TEST_LOCAL$LONGINT$LONGINT
	.stabn 68,0,155,.Ll31 - P$TESTPROGRAM_FUNC1$WORD$WORD$BOOLEAN$TRECORD$$SHORTINT
.Ll31:
# [155] indirect_call;
	movl	%ebp,%eax
	call	P$TESTPROGRAM_FUNC1$crcE9EB7FD8_INDIRECT_CALL
	.stabn 68,0,156,.Ll32 - P$TESTPROGRAM_FUNC1$WORD$WORD$BOOLEAN$TRECORD$$SHORTINT
.Ll32:
# [156] Func1:=X;
	movb	-4(%ebp),%al
	movb	%al,-16(%ebp)
	.stabn 68,0,157,.Ll33 - P$TESTPROGRAM_FUNC1$WORD$WORD$BOOLEAN$TRECORD$$SHORTINT
.Ll33:
# [157] end;
	movb	-16(%ebp),%al
	leave
	ret	$4
	.stabs "FUNC1:X41",160,0,0,-16
	.stabs "RESULT:X41",160,0,0,-16
	.stabn 192,0,0,P$TESTPROGRAM_FUNC1$WORD$WORD$BOOLEAN$TRECORD$$SHORTINT-P$TESTPROGRAM_FUNC1$WORD$WORD$BOOLEAN$TRECORD$$SHORTINT
	.stabn 224,0,0,.Lt9-P$TESTPROGRAM_FUNC1$WORD$WORD$BOOLEAN$TRECORD$$SHORTINT
.Lt9:

.section .text.n_p$testprogram_func1$crce9eb7fd8_indirect_call,"x"
	.balign 16,0x90
.globl	P$TESTPROGRAM_FUNC1$crcE9EB7FD8_INDIRECT_CALL
P$TESTPROGRAM_FUNC1$crcE9EB7FD8_INDIRECT_CALL:
	.stabs "INDIRECT_CALL:F39,INDIRECT_CALL,FUNC1",36,0,144,P$TESTPROGRAM_FUNC1$crcE9EB7FD8_INDIRECT_CALL
	.stabs "parentfp:R33",64,0,144,0
	.stabs "parentfp:33",160,0,144,-4
	.stabs "LOC:38",160,0,146,-8
# Temps allocated between ebp-8 and ebp-8
	.stabs "test.pas",132,0,0,.Lf9
.Lf9:
	.stabn 68,0,147,.Ll34 - P$TESTPROGRAM_FUNC1$crcE9EB7FD8_INDIRECT_CALL
.Ll34:
# [147] begin
	pushl	%ebp
	movl	%esp,%ebp
	subl	$8,%esp
# Var $parentfp located at ebp-4
# Var loc located at ebp-8
	movl	%eax,-4(%ebp)
	.stabn 68,0,148,.Ll35 - P$TESTPROGRAM_FUNC1$crcE9EB7FD8_INDIRECT_CALL
.Ll35:
# [148] loc:=1;
	movl	$1,-8(%ebp)
	.stabn 68,0,149,.Ll36 - P$TESTPROGRAM_FUNC1$crcE9EB7FD8_INDIRECT_CALL
.Ll36:
# [149] test_local(5,7);
	movl	-4(%ebp),%eax
	movl	$7,%ecx
	movl	$5,%edx
	call	P$TESTPROGRAM_FUNC1$crcE9EB7FD8_TEST_LOCAL$LONGINT$LONGINT
	.stabn 68,0,150,.Ll37 - P$TESTPROGRAM_FUNC1$crcE9EB7FD8_INDIRECT_CALL
.Ll37:
# [150] end;
	leave
	ret
	.stabn 192,0,0,P$TESTPROGRAM_FUNC1$crcE9EB7FD8_INDIRECT_CALL-P$TESTPROGRAM_FUNC1$crcE9EB7FD8_INDIRECT_CALL
	.stabn 224,0,0,.Lt11-P$TESTPROGRAM_FUNC1$crcE9EB7FD8_INDIRECT_CALL
.Lt11:

.section .text.n_p$testprogram_func1$crce9eb7fd8_test_local$longint$longint,"x"
	.balign 16,0x90
.globl	P$TESTPROGRAM_FUNC1$crcE9EB7FD8_TEST_LOCAL$LONGINT$LONGINT
P$TESTPROGRAM_FUNC1$crcE9EB7FD8_TEST_LOCAL$LONGINT$LONGINT:
	.stabs "TEST_LOCAL:F39,TEST_LOCAL,FUNC1",36,0,137,P$TESTPROGRAM_FUNC1$crcE9EB7FD8_TEST_LOCAL$LONGINT$LONGINT
	.stabs "C:R38",64,0,137,2
	.stabs "C:38",160,0,137,-4
	.stabs "F:R38",64,0,137,1
	.stabs "F:38",160,0,137,-8
	.stabs "parentfp:R33",64,0,137,0
	.stabs "parentfp:33",160,0,137,-12
# Temps allocated between ebp-20 and ebp-16
	.stabs "test.pas",132,0,0,.Lf10
.Lf10:
	.stabn 68,0,140,.Ll38 - P$TESTPROGRAM_FUNC1$crcE9EB7FD8_TEST_LOCAL$LONGINT$LONGINT
.Ll38:
# [140] begin
	pushl	%ebp
	movl	%esp,%ebp
	subl	$20,%esp
	movl	%ebx,-20(%ebp)
# Var c located at ebp-4
# Var f located at ebp-8
# Var $parentfp located at ebp-12
# Var int_loc located at ebp-16
	movl	%eax,-12(%ebp)
	movl	%edx,-4(%ebp)
	movl	%ecx,-8(%ebp)
	.stabn 68,0,141,.Ll39 - P$TESTPROGRAM_FUNC1$crcE9EB7FD8_TEST_LOCAL$LONGINT$LONGINT
.Ll39:
# [141] Writeln('dummy for browser');
	call	fpc_get_output
	movl	%eax,%ebx
	movl	%ebx,%edx
	movl	$_$TESTPROGRAM$_Ld4,%ecx
	movl	$0,%eax
	call	fpc_write_text_shortstr
	call	FPC_IOCHECK
	movl	%ebx,%eax
	call	fpc_writeln_end
	call	FPC_IOCHECK
	.stabn 68,0,142,.Ll40 - P$TESTPROGRAM_FUNC1$crcE9EB7FD8_TEST_LOCAL$LONGINT$LONGINT
.Ll40:
# [142] end;
	movl	-20(%ebp),%ebx
	leave
	ret
	.stabn 192,0,0,P$TESTPROGRAM_FUNC1$crcE9EB7FD8_TEST_LOCAL$LONGINT$LONGINT-P$TESTPROGRAM_FUNC1$crcE9EB7FD8_TEST_LOCAL$LONGINT$LONGINT
	.stabn 224,0,0,.Lt10-P$TESTPROGRAM_FUNC1$crcE9EB7FD8_TEST_LOCAL$LONGINT$LONGINT
.Lt10:

.section .text.n__main,"x"
	.balign 16,0x90
.globl	PASCALMAIN
PASCALMAIN:
.globl	_main
_main:
	.stabs "main:F39",36,0,12,_main
# Temps allocated between ebp-60 and ebp+0
	.stabs "test.pas",132,0,0,.Lf11
.Lf11:
	.stabn 68,0,162,.Ll41 - _main
.Ll41:
# [162] BEGIN
	pushl	%ebp
	movl	%esp,%ebp
	subl	$60,%esp
	movl	%ebx,-60(%ebp)
	movl	%esi,-56(%ebp)
	call	FPC_INITIALIZEUNITS
	.stabn 68,0,162,.Ll42 - _main
.Ll42:
	movl	$0,-52(%ebp)
	movl	$0,-48(%ebp)
	leal	-12(%ebp),%ecx
	leal	-36(%ebp),%edx
	movl	$1,%eax
	call	FPC_PUSHEXCEPTADDR
	call	FPC_SETJMP
	pushl	%eax
	testl	%eax,%eax
	jne	.Lj166
	.stabn 68,0,174,.Ll43 - _main
.Ll43:
# [174] for i:=low(ExtendedArray) to high(ExtendedArray) do
	movl	$1,U_P$TESTPROGRAM_I
	decl	U_P$TESTPROGRAM_I
	.balign 4,0x90
.Lj171:
	incl	U_P$TESTPROGRAM_I
	.stabn 68,0,175,.Ll44 - _main
.Ll44:
# [175] ExtendedArray[i]:=i;
	movl	U_P$TESTPROGRAM_I,%eax
	imull	$10,%eax
	fildl	U_P$TESTPROGRAM_I
	fstpt	U_P$TESTPROGRAM_EXTENDEDARRAY-10(,%eax)
	cmpl	$2000,U_P$TESTPROGRAM_I
	jl	.Lj171
	.stabn 68,0,176,.Ll45 - _main
.Ll45:
# [176] for i:=low(ExtendedPackedArray) to high(ExtendedPackedArray) do
	movl	$1,U_P$TESTPROGRAM_I
	decl	U_P$TESTPROGRAM_I
	.balign 4,0x90
.Lj176:
	incl	U_P$TESTPROGRAM_I
	.stabn 68,0,177,.Ll46 - _main
.Ll46:
# [177] ExtendedPackedArray[i]:=i;
	movl	U_P$TESTPROGRAM_I,%eax
	imull	$10,%eax
	fildl	U_P$TESTPROGRAM_I
	fstpt	U_P$TESTPROGRAM_EXTENDEDPACKEDARRAY-10(,%eax)
	cmpl	$2000,U_P$TESTPROGRAM_I
	jl	.Lj176
	.stabn 68,0,179,.Ll47 - _main
.Ll47:
# [179] for i:=1 to 10 do
	movl	$1,U_P$TESTPROGRAM_I
	decl	U_P$TESTPROGRAM_I
	.balign 4,0x90
.Lj181:
	incl	U_P$TESTPROGRAM_I
	.stabn 68,0,180,.Ll48 - _main
.Ll48:
# [180] for j:=1 to 10 do
	movl	$1,U_P$TESTPROGRAM_J
	decl	U_P$TESTPROGRAM_J
	.balign 4,0x90
.Lj184:
	incl	U_P$TESTPROGRAM_J
	.stabn 68,0,181,.Ll49 - _main
.Ll49:
# [181] SingleArrayArray[i,j]:=i*j;
	movl	U_P$TESTPROGRAM_I,%edx
	movl	U_P$TESTPROGRAM_J,%eax
	imull	%eax,%edx
	movl	%edx,-44(%ebp)
	fildl	-44(%ebp)
	movl	U_P$TESTPROGRAM_I,%eax
	imull	$40,%eax
	movl	U_P$TESTPROGRAM_J,%edx
	fstps	U_P$TESTPROGRAM_SINGLEARRAYARRAY-44(%eax,%edx,4)
	cmpl	$10,U_P$TESTPROGRAM_J
	jl	.Lj184
	cmpl	$10,U_P$TESTPROGRAM_I
	jl	.Lj181
	.stabn 68,0,183,.Ll50 - _main
.Ll50:
# [183] ClassVar1:=TClass2.create;
	movl	$VMT_P$TESTPROGRAM_TCLASS2,%edx
	movl	$0,%eax
	call	P$TESTPROGRAM_TCLASS2_$__CREATE$$TCLASS2
	movl	%eax,U_P$TESTPROGRAM_CLASSVAR1
	.stabn 68,0,184,.Ll51 - _main
.Ll51:
# [184] Obj1.Init;
	movl	$VMT_P$TESTPROGRAM_TOBJ,%edx
	movl	$U_P$TESTPROGRAM_OBJ1,%eax
	call	P$TESTPROGRAM_TOBJ_$__INIT$$LONGBOOL
	.stabn 68,0,185,.Ll52 - _main
.Ll52:
# [185] pointer2:=@Obj1;
	movl	$U_P$TESTPROGRAM_OBJ1,%eax
	movl	%eax,U_P$TESTPROGRAM_POINTER2
	.stabn 68,0,186,.Ll53 - _main
.Ll53:
# [186] Writeln('Obj1.Z=',Obj1.Z);
	call	fpc_get_output
	movl	%eax,%ebx
	movl	%ebx,%edx
	movl	$_$TESTPROGRAM$_Ld5,%ecx
	movl	$0,%eax
	call	fpc_write_text_shortstr
	call	FPC_IOCHECK
	movl	U_P$TESTPROGRAM_OBJ1,%ecx
	movl	%ebx,%edx
	movl	$0,%eax
	call	fpc_write_text_sint
	call	FPC_IOCHECK
	movl	%ebx,%eax
	call	fpc_writeln_end
	call	FPC_IOCHECK
	.stabn 68,0,187,.Ll54 - _main
.Ll54:
# [187] Obj1.done;
	movl	$U_P$TESTPROGRAM_OBJ1,%eax
	movl	$0,%edx
	movl	$U_P$TESTPROGRAM_OBJ1,%ecx
	movl	4(%ecx),%ecx
	call	*16(%ecx)
	.stabn 68,0,188,.Ll55 - _main
.Ll55:
# [188] X:=nil;
	movl	$0,U_P$TESTPROGRAM_X
	.stabn 68,0,190,.Ll56 - _main
.Ll56:
# [190] for i:=1 to 2000 do
	movl	$1,U_P$TESTPROGRAM_I
	decl	U_P$TESTPROGRAM_I
	.balign 4,0x90
.Lj223:
	incl	U_P$TESTPROGRAM_I
	.stabn 68,0,191,.Ll57 - _main
.Ll57:
# [191] CharArray[i]:=chr(32+(i mod (255-32)));
	movl	U_P$TESTPROGRAM_I,%eax
	cltd
	movl	$223,%ecx
	idivl	%ecx
	addl	$32,%edx
	movl	U_P$TESTPROGRAM_I,%eax
	movb	%dl,U_P$TESTPROGRAM_CHARARRAY-1(,%eax,1)
	cmpl	$2000,U_P$TESTPROGRAM_I
	jl	.Lj223
	.stabn 68,0,192,.Ll58 - _main
.Ll58:
# [192] writeln('Hello world!');
	call	fpc_get_output
	movl	%eax,%ebx
	movl	%ebx,%edx
	movl	$_$TESTPROGRAM$_Ld6,%ecx
	movl	$0,%eax
	call	fpc_write_text_shortstr
	call	FPC_IOCHECK
	movl	%ebx,%eax
	call	fpc_writeln_end
	call	FPC_IOCHECK
	.stabn 68,0,193,.Ll59 - _main
.Ll59:
# [193] Writeln('ParamCount = ',ParamCount);
	call	fpc_get_output
	movl	%eax,%ebx
	movl	%ebx,%edx
	movl	$_$TESTPROGRAM$_Ld7,%ecx
	movl	$0,%eax
	call	fpc_write_text_shortstr
	call	FPC_IOCHECK
	call	SYSTEM_PARAMCOUNT$$LONGINT
	movl	%eax,%ecx
	movl	%ebx,%edx
	movl	$0,%eax
	call	fpc_write_text_sint
	call	FPC_IOCHECK
	movl	%ebx,%eax
	call	fpc_writeln_end
	call	FPC_IOCHECK
	.stabn 68,0,194,.Ll60 - _main
.Ll60:
# [194] For i:=0 to paramcount do
	call	SYSTEM_PARAMCOUNT$$LONGINT
	movl	%eax,%ebx
	movl	$0,U_P$TESTPROGRAM_I
	cmpl	U_P$TESTPROGRAM_I,%ebx
	jl	.Lj253
	decl	U_P$TESTPROGRAM_I
	.balign 4,0x90
.Lj254:
	incl	U_P$TESTPROGRAM_I
	.stabn 68,0,195,.Ll61 - _main
.Ll61:
# [195] writeln('Paramstr(',i,') = '+Paramstr(i));
	call	fpc_get_output
	movl	%eax,%esi
	movl	%esi,%edx
	movl	$_$TESTPROGRAM$_Ld8,%ecx
	movl	$0,%eax
	call	fpc_write_text_shortstr
	call	FPC_IOCHECK
	movl	U_P$TESTPROGRAM_I,%ecx
	movl	%esi,%edx
	movl	$0,%eax
	call	fpc_write_text_sint
	call	FPC_IOCHECK
	leal	-48(%ebp),%eax
	call	FPC_ANSISTR_DECR_REF
	movl	$0,-48(%ebp)
	leal	-52(%ebp),%eax
	call	FPC_ANSISTR_DECR_REF
	movl	$0,-52(%ebp)
	leal	-52(%ebp),%edx
	movl	U_P$TESTPROGRAM_I,%eax
	call	OBJPAS_PARAMSTR$LONGINT$$ANSISTRING
	movl	-52(%ebp),%ecx
	leal	-48(%ebp),%eax
	movl	$_$TESTPROGRAM$_Ld9,%edx
	call	fpc_ansistr_concat
	movl	-48(%ebp),%ecx
	movl	%esi,%edx
	movl	$0,%eax
	call	fpc_write_text_ansistr
	call	FPC_IOCHECK
	movl	%esi,%eax
	call	fpc_writeln_end
	call	FPC_IOCHECK
	cmpl	U_P$TESTPROGRAM_I,%ebx
	jg	.Lj254
.Lj253:
	.stabn 68,0,196,.Ll62 - _main
.Ll62:
# [196] writeln(IsOdd(3));
	call	fpc_get_output
	movl	%eax,%esi
	movw	$3,%ax
	call	TEST2_ISODD$SMALLINT$$BOOLEAN
	movb	%al,%cl
	movl	%esi,%eax
	movl	$0,%ebx
	movl	%eax,%edx
	movl	%ebx,%eax
	call	fpc_write_text_boolean
	call	FPC_IOCHECK
	movl	%esi,%eax
	call	fpc_writeln_end
	call	FPC_IOCHECK
	.stabn 68,0,197,.Ll63 - _main
.Ll63:
# [197] writeln(Func1(5,5,Bool,T));
	call	fpc_get_output
	movl	%eax,%ebx
	pushl	$U_P$TESTPROGRAM_T
	movl	$U_P$TESTPROGRAM_BOOL,%ecx
	movw	$5,%dx
	movw	$5,%ax
	call	P$TESTPROGRAM_FUNC1$WORD$WORD$BOOLEAN$TRECORD$$SHORTINT
	movb	%al,%cl
	movsbl	%cl,%ecx
	movl	%ebx,%edx
	movl	$0,%eax
	call	fpc_write_text_sint
	call	FPC_IOCHECK
	movl	%ebx,%eax
	call	fpc_writeln_end
	call	FPC_IOCHECK
	.stabn 68,0,198,.Ll64 - _main
.Ll64:
# [198] new(X);
	movl	$8,%eax
	call	fpc_getmem
	movl	%eax,U_P$TESTPROGRAM_X
	.stabn 68,0,199,.Ll65 - _main
.Ll65:
# [199] new(X^.next);
	movl	$8,%eax
	call	fpc_getmem
	movl	U_P$TESTPROGRAM_X,%edx
	movl	%eax,4(%edx)
	.stabn 68,0,200,.Ll66 - _main
.Ll66:
# [200] X^.next^.next:=X;
	movl	U_P$TESTPROGRAM_X,%eax
	movl	4(%eax),%eax
	movl	U_P$TESTPROGRAM_X,%edx
	movl	%edx,4(%eax)
	.stabn 68,0,201,.Ll67 - _main
.Ll67:
# [201] dispose(X);
	movl	U_P$TESTPROGRAM_X,%eax
	call	fpc_freemem
	.stabn 68,0,204,.Ll68 - _main
.Ll68:
# [204] if (TestOne<>1) or (TestOne(5)<>5) or (TestOne('6')<>6) then
	call	TEST1_TESTONE$$LONGINT
	cmpl	$1,%eax
	jne	.Lj333
	jmp	.Lj336
.Lj336:
	movl	$5,%eax
	call	TEST1_TESTONE$LONGINT$$LONGINT
	cmpl	$5,%eax
	jne	.Lj333
	jmp	.Lj335
.Lj335:
	movl	$_$TESTPROGRAM$_Ld10,%eax
	call	TEST1_TESTONE$SHORTSTRING$$LONGINT
	cmpl	$6,%eax
	jne	.Lj333
	jmp	.Lj334
.Lj333:
	.stabn 68,0,206,.Ll69 - _main
.Ll69:
# [206] Writeln('Error while testing TestOne function overloads');
	call	fpc_get_output
	movl	%eax,%ebx
	movl	%ebx,%edx
	movl	$_$TESTPROGRAM$_Ld11,%ecx
	movl	$0,%eax
	call	fpc_write_text_shortstr
	call	FPC_IOCHECK
	movl	%ebx,%eax
	call	fpc_writeln_end
	call	FPC_IOCHECK
	.stabn 68,0,207,.Ll70 - _main
.Ll70:
# [207] RunError(200);
	movw	$200,%ax
	call	SYSTEM_RUNERROR$WORD
.Lj334:
	.stabn 68,0,209,.Ll71 - _main
.Ll71:
# [209] Halt(4);
	movl	$4,%eax
	call	SYSTEM_HALT$LONGINT
.Lj166:
	call	FPC_POPADDRSTACK
	.stabn 68,0,210,.Ll72 - _main
.Ll72:
# [210] END.
	leal	-52(%ebp),%eax
	call	FPC_ANSISTR_DECR_REF
	movl	$0,-52(%ebp)
	leal	-48(%ebp),%eax
	call	FPC_ANSISTR_DECR_REF
	movl	$0,-48(%ebp)
	popl	%eax
	testl	%eax,%eax
	je	.Lj167
	call	FPC_RERAISE
.Lj167:
	.stabn 68,0,210,.Ll73 - _main
.Ll73:
	call	FPC_DO_EXIT
	movl	-60(%ebp),%ebx
	movl	-56(%ebp),%esi
	leave
	ret
	.stabn 192,0,0,_main-_main
	.stabn 224,0,0,.Lt1-_main
.Lt1:

.section .fpc.n_links
	.long	DEBUGINFO_P$TESTPROGRAM
	.long	DEBUGSTART_P$TESTPROGRAM
	.long	DEBUGEND_P$TESTPROGRAM
	.long	DEBUGINFO_TEST1
	.long	DEBUGSTART_TEST1
	.long	DEBUGEND_TEST1
	.long	DEBUGINFO_TEST2
	.long	DEBUGSTART_TEST2
	.long	DEBUGEND_TEST2
# End asmlist al_procedures
# Begin asmlist al_globals

.section .bss
	.balign 2
# [65] var Hello : word;
	.globl U_P$TESTPROGRAM_HELLO
U_P$TESTPROGRAM_HELLO:
	.zero 2

.section .bss
	.balign 4
# [66] X: PRecord;
	.globl U_P$TESTPROGRAM_X
U_P$TESTPROGRAM_X:
	.zero 4

.section .bss
# [67] Bool: boolean;
	.globl U_P$TESTPROGRAM_BOOL
U_P$TESTPROGRAM_BOOL:
	.zero 1

.section .bss
	.balign 4
# [68] T : TRecord;
	.globl U_P$TESTPROGRAM_T
U_P$TESTPROGRAM_T:
	.zero 8

.section .bss
# [69] Str20 : string[20];
	.globl U_P$TESTPROGRAM_STR20
U_P$TESTPROGRAM_STR20:
	.zero 21

.section .bss
# [70] Str255: string;
	.globl U_P$TESTPROGRAM_STR255
U_P$TESTPROGRAM_STR255:
	.zero 256

.section .bss
	.balign 2
# [71] ArrayW: array[2..45] of word;
	.globl U_P$TESTPROGRAM_ARRAYW
U_P$TESTPROGRAM_ARRAYW:
	.zero 88

.section .bss
	.balign 4
# [72] ArrayVar: ArrayTyp;
	.globl U_P$TESTPROGRAM_ARRAYVAR
U_P$TESTPROGRAM_ARRAYVAR:
	.zero 40

.section .bss
	.balign 4
# [73] EnumVar: (enumElem1,enumElem2,enumElem3);
	.globl U_P$TESTPROGRAM_ENUMVAR
U_P$TESTPROGRAM_ENUMVAR:
	.zero 4

.section .bss
	.balign 4
# [74] EnumVar2: EnumTyp;
	.globl U_P$TESTPROGRAM_ENUMVAR2
U_P$TESTPROGRAM_ENUMVAR2:
	.zero 4

.section .bss
	.balign 16
# [75] FileVar: file;
	.globl U_P$TESTPROGRAM_FILEVAR
U_P$TESTPROGRAM_FILEVAR:
	.zero 332

.section .bss
	.balign 16
# [76] FileVarR: file of TRecord;
	.globl U_P$TESTPROGRAM_FILEVARR
U_P$TESTPROGRAM_FILEVARR:
	.zero 332

.section .bss
	.balign 16
# [77] FileVarW: file of word;
	.globl U_P$TESTPROGRAM_FILEVARW
U_P$TESTPROGRAM_FILEVARW:
	.zero 332

.section .bss
	.balign 4
# [78] ProcVar: procedure;
	.globl U_P$TESTPROGRAM_PROCVAR
U_P$TESTPROGRAM_PROCVAR:
	.zero 4

.section .bss
	.balign 4
# [79] ProcVarD: function(X: real): boolean;
	.globl U_P$TESTPROGRAM_PROCVARD
U_P$TESTPROGRAM_PROCVARD:
	.zero 4

.section .bss
	.balign 4
# [80] ProcVarI: ProcTyp;
	.globl U_P$TESTPROGRAM_PROCVARI
U_P$TESTPROGRAM_PROCVARI:
	.zero 4

.section .bss
	.balign 16
# [81] SetVarD: set of char;
	.globl U_P$TESTPROGRAM_SETVARD
U_P$TESTPROGRAM_SETVARD:
	.zero 32

.section .bss
	.balign 4
# [82] SetVarI: SetTyp;
	.globl U_P$TESTPROGRAM_SETVARI
U_P$TESTPROGRAM_SETVARI:
	.zero 4

.section .bss
	.balign 8
# [83] Float1: real;
	.globl U_P$TESTPROGRAM_FLOAT1
U_P$TESTPROGRAM_FLOAT1:
	.zero 8

.section .bss
	.balign 8
# [84] Float2: double;
	.globl U_P$TESTPROGRAM_FLOAT2
U_P$TESTPROGRAM_FLOAT2:
	.zero 8

.section .bss
	.balign 8
# [85] Float3: comp;
	.globl U_P$TESTPROGRAM_FLOAT3
U_P$TESTPROGRAM_FLOAT3:
	.zero 8

.section .bss
	.balign 16
# [86] Float4: extended;
	.globl U_P$TESTPROGRAM_FLOAT4
U_P$TESTPROGRAM_FLOAT4:
	.zero 10

.section .bss
	.balign 4
# [87] Pointer1: pointer;
	.globl U_P$TESTPROGRAM_POINTER1
U_P$TESTPROGRAM_POINTER1:
	.zero 4

.section .bss
	.balign 4
# [88] Pointer2: PObj;
	.globl U_P$TESTPROGRAM_POINTER2
U_P$TESTPROGRAM_POINTER2:
	.zero 4

.section .bss
	.balign 4
# [89] ClassVar1: TClass;
	.globl U_P$TESTPROGRAM_CLASSVAR1
U_P$TESTPROGRAM_CLASSVAR1:
	.zero 4

.section .bss
	.balign 4
# [90] ClassVar2: TClass2;
	.globl U_P$TESTPROGRAM_CLASSVAR2
U_P$TESTPROGRAM_CLASSVAR2:
	.zero 4

.section .bss
	.balign 4
# [91] Obj1: TObj;
	.globl U_P$TESTPROGRAM_OBJ1
U_P$TESTPROGRAM_OBJ1:
	.zero 8

.section .bss
	.balign 4
# [92] Obj2: TObj2;
	.globl U_P$TESTPROGRAM_OBJ2
U_P$TESTPROGRAM_OBJ2:
	.zero 8

.section .bss
# [93] CharArray : Array[1..2000] of char;
	.globl U_P$TESTPROGRAM_CHARARRAY
U_P$TESTPROGRAM_CHARARRAY:
	.zero 2000

.section .bss
	.balign 16
# [94] ExtendedArray : Array[1..2000] of extended;
	.globl U_P$TESTPROGRAM_EXTENDEDARRAY
U_P$TESTPROGRAM_EXTENDEDARRAY:
	.zero 20000

.section .bss
	.balign 16
# [95] ExtendedPackedArray : packed Array[1..2000] of extended;
	.globl U_P$TESTPROGRAM_EXTENDEDPACKEDARRAY
U_P$TESTPROGRAM_EXTENDEDPACKEDARRAY:
	.zero 20000

.section .bss
	.balign 4
# [96] SingleArrayArray : Array[1..10,1..10] of single;
	.globl U_P$TESTPROGRAM_SINGLEARRAYARRAY
U_P$TESTPROGRAM_SINGLEARRAYARRAY:
	.zero 400

.section .bss
	.balign 4
# [159] var i,j : longint;
	.globl U_P$TESTPROGRAM_I
U_P$TESTPROGRAM_I:
	.zero 4

.section .bss
	.balign 4
	.globl U_P$TESTPROGRAM_J
U_P$TESTPROGRAM_J:
	.zero 4

.section .bss
	.balign 4
# [160] Length : longint;
	.globl U_P$TESTPROGRAM_LENGTH
U_P$TESTPROGRAM_LENGTH:
	.zero 4

.section .data.n_THREADVARLIST_P$TESTPROGRAM,"d"
	.balign 4
.globl	THREADVARLIST_P$TESTPROGRAM
THREADVARLIST_P$TESTPROGRAM:
	.long	0

.section .data.n_VMT_P$TESTPROGRAM_TOBJ,"d"
	.balign 4
.globl	VMT_P$TESTPROGRAM_TOBJ
VMT_P$TESTPROGRAM_TOBJ:
	.long	8,-8,0
	.long	P$TESTPROGRAM_TOBJ_$__PROC
	.long	P$TESTPROGRAM_TOBJ_$__DONE
	.long	0

.section .data.n_VMT_P$TESTPROGRAM_TOBJ2,"d"
	.balign 4
.globl	VMT_P$TESTPROGRAM_TOBJ2
VMT_P$TESTPROGRAM_TOBJ2:
	.long	8,-8
	.long	VMT_P$TESTPROGRAM_TOBJ
	.long	P$TESTPROGRAM_TOBJ2_$__PROC
	.long	P$TESTPROGRAM_TOBJ_$__DONE
	.long	0

.section .data.n_VMT_P$TESTPROGRAM_TOBJ3,"d"
	.balign 4
.globl	VMT_P$TESTPROGRAM_TOBJ3
VMT_P$TESTPROGRAM_TOBJ3:
	.long	8,-8
	.long	VMT_P$TESTPROGRAM_TOBJ
	.long	P$TESTPROGRAM_TOBJ_$__PROC
	.long	P$TESTPROGRAM_TOBJ_$__DONE
	.long	0

.section .data.n_VMT_P$TESTPROGRAM_TOBJ32,"d"
	.balign 4
.globl	VMT_P$TESTPROGRAM_TOBJ32
VMT_P$TESTPROGRAM_TOBJ32:
	.long	8,-8
	.long	VMT_P$TESTPROGRAM_TOBJ3
	.long	P$TESTPROGRAM_TOBJ_$__PROC
	.long	P$TESTPROGRAM_TOBJ_$__DONE
	.long	0

.section .data.n_VMT_P$TESTPROGRAM_TOBJ4,"d"
	.balign 4
.globl	VMT_P$TESTPROGRAM_TOBJ4
VMT_P$TESTPROGRAM_TOBJ4:
	.long	8,-8
	.long	VMT_P$TESTPROGRAM_TOBJ
	.long	P$TESTPROGRAM_TOBJ_$__PROC
	.long	P$TESTPROGRAM_TOBJ_$__DONE
	.long	0

.section .data.n__$TESTPROGRAM$_Ld12,"d"
	.balign 4
.globl	_$TESTPROGRAM$_Ld12
_$TESTPROGRAM$_Ld12:
	.byte	6
	.ascii	"TClass"

.section .data.n_VMT_P$TESTPROGRAM_TCLASS,"d"
	.balign 4
.globl	VMT_P$TESTPROGRAM_TCLASS
VMT_P$TESTPROGRAM_TCLASS:
	.long	260,-260
	.long	VMT_SYSTEM_TOBJECT
	.long	_$TESTPROGRAM$_Ld12
	.long	0,0
	.long	_$TESTPROGRAM$_Ld13
	.long	RTTI_P$TESTPROGRAM_TCLASS
	.long	0,0
	.long	FPC_EMPTYINTF
	.long	0
	.long	SYSTEM_TOBJECT_$__DESTROY
	.long	SYSTEM_TOBJECT_$__NEWINSTANCE$$TOBJECT
	.long	SYSTEM_TOBJECT_$__FREEINSTANCE
	.long	SYSTEM_TOBJECT_$__SAFECALLEXCEPTION$TOBJECT$POINTER$$HRESULT
	.long	SYSTEM_TOBJECT_$__DEFAULTHANDLER$formal
	.long	SYSTEM_TOBJECT_$__AFTERCONSTRUCTION
	.long	SYSTEM_TOBJECT_$__BEFOREDESTRUCTION
	.long	SYSTEM_TOBJECT_$__DEFAULTHANDLERSTR$formal
	.long	SYSTEM_TOBJECT_$__DISPATCH$formal
	.long	SYSTEM_TOBJECT_$__DISPATCHSTR$formal
	.long	SYSTEM_TOBJECT_$__EQUALS$TOBJECT$$BOOLEAN
	.long	SYSTEM_TOBJECT_$__GETHASHCODE$$LONGINT
	.long	SYSTEM_TOBJECT_$__TOSTRING$$ANSISTRING
	.long	0

.section .data.n__$TESTPROGRAM$_Ld15,"d"
	.balign 4
.globl	_$TESTPROGRAM$_Ld15
_$TESTPROGRAM$_Ld15:
	.byte	7
	.ascii	"TClass2"

.section .data.n_VMT_P$TESTPROGRAM_TCLASS2,"d"
	.balign 4
.globl	VMT_P$TESTPROGRAM_TCLASS2
VMT_P$TESTPROGRAM_TCLASS2:
	.long	264,-264
	.long	VMT_P$TESTPROGRAM_TCLASS
	.long	_$TESTPROGRAM$_Ld15
	.long	0,0
	.long	_$TESTPROGRAM$_Ld16
	.long	RTTI_P$TESTPROGRAM_TCLASS2
	.long	0,0
	.long	FPC_EMPTYINTF
	.long	0
	.long	SYSTEM_TOBJECT_$__DESTROY
	.long	SYSTEM_TOBJECT_$__NEWINSTANCE$$TOBJECT
	.long	SYSTEM_TOBJECT_$__FREEINSTANCE
	.long	SYSTEM_TOBJECT_$__SAFECALLEXCEPTION$TOBJECT$POINTER$$HRESULT
	.long	SYSTEM_TOBJECT_$__DEFAULTHANDLER$formal
	.long	SYSTEM_TOBJECT_$__AFTERCONSTRUCTION
	.long	SYSTEM_TOBJECT_$__BEFOREDESTRUCTION
	.long	SYSTEM_TOBJECT_$__DEFAULTHANDLERSTR$formal
	.long	SYSTEM_TOBJECT_$__DISPATCH$formal
	.long	SYSTEM_TOBJECT_$__DISPATCHSTR$formal
	.long	SYSTEM_TOBJECT_$__EQUALS$TOBJECT$$BOOLEAN
	.long	SYSTEM_TOBJECT_$__GETHASHCODE$$LONGINT
	.long	SYSTEM_TOBJECT_$__TOSTRING$$ANSISTRING
	.long	0

.section .data.n_INITFINAL,"d"
	.balign 4
.globl	INITFINAL
INITFINAL:
	.long	3,0
	.long	INIT$_SYSTEM
	.long	0
	.long	INIT$_FPINTRES
	.long	0,0
	.long	FINALIZE$_OBJPAS

.section .data.n_FPC_THREADVARTABLES,"d"
	.balign 4
.globl	FPC_THREADVARTABLES
FPC_THREADVARTABLES:
	.long	7
	.long	THREADVARLIST_SYSTEM
	.long	THREADVARLIST_FPINTRES
	.long	THREADVARLIST_OBJPAS
	.long	THREADVARLIST_TEST1
	.long	THREADVARLIST_TEST2
	.long	THREADVARLIST_SYSINITPAS
	.long	THREADVARLIST_P$TESTPROGRAM

.section .data.n_FPC_RESOURCESTRINGTABLES,"d"
	.balign 4
.globl	FPC_RESOURCESTRINGTABLES
FPC_RESOURCESTRINGTABLES:
	.long	0

.section .data.n_FPC_WIDEINITTABLES,"d"
	.balign 4
.globl	FPC_WIDEINITTABLES
FPC_WIDEINITTABLES:
	.long	0

.section .fpc.n_version
	.balign 16
	.ascii	"FPC 2.6.4 [2014/03/06] for i386 - Win32"

.section .data.n___heapsize,"d"
	.balign 4
.globl	__heapsize
__heapsize:
	.long	0

.section .data.n___fpc_valgrind,"d"
.globl	__fpc_valgrind
__fpc_valgrind:
	.byte	0
# End asmlist al_globals
# Begin asmlist al_const
# End asmlist al_const
# Begin asmlist al_typedconsts

.section .rodata.n__$TESTPROGRAM$_Ld1,"d"
	.balign 4
.globl	_$TESTPROGRAM$_Ld1
_$TESTPROGRAM$_Ld1:
	.ascii	"\017TClass instance\000"

.section .rodata.n__$TESTPROGRAM$_Ld2,"d"
	.balign 4
.globl	_$TESTPROGRAM$_Ld2
_$TESTPROGRAM$_Ld2:
	.ascii	"\020TClass2 instance\000"

.section .rodata.n__$TESTPROGRAM$_Ld3,"d"
	.balign 4
.globl	_$TESTPROGRAM$_Ld3
_$TESTPROGRAM$_Ld3:
	.ascii	"\020This is a string\000"

.section .rodata.n__$TESTPROGRAM$_Ld4,"d"
	.balign 4
.globl	_$TESTPROGRAM$_Ld4
_$TESTPROGRAM$_Ld4:
	.ascii	"\021dummy for browser\000"

.section .rodata.n__$TESTPROGRAM$_Ld5,"d"
	.balign 4
.globl	_$TESTPROGRAM$_Ld5
_$TESTPROGRAM$_Ld5:
	.ascii	"\007Obj1.Z=\000"

.section .rodata.n__$TESTPROGRAM$_Ld6,"d"
	.balign 4
.globl	_$TESTPROGRAM$_Ld6
_$TESTPROGRAM$_Ld6:
	.ascii	"\014Hello world!\000"

.section .rodata.n__$TESTPROGRAM$_Ld7,"d"
	.balign 4
.globl	_$TESTPROGRAM$_Ld7
_$TESTPROGRAM$_Ld7:
	.ascii	"\015ParamCount = \000"

.section .rodata.n__$TESTPROGRAM$_Ld8,"d"
	.balign 4
.globl	_$TESTPROGRAM$_Ld8
_$TESTPROGRAM$_Ld8:
	.ascii	"\011Paramstr(\000"

.section .data.n__$TESTPROGRAM$_Ld9,"d"
	.balign 4
	.long	-1,4
.globl	_$TESTPROGRAM$_Ld9
_$TESTPROGRAM$_Ld9:
	.ascii	") = \000"

.section .rodata.n__$TESTPROGRAM$_Ld10,"d"
	.balign 4
.globl	_$TESTPROGRAM$_Ld10
_$TESTPROGRAM$_Ld10:
	.ascii	"\0016\000"

.section .rodata.n__$TESTPROGRAM$_Ld11,"d"
	.balign 4
.globl	_$TESTPROGRAM$_Ld11
_$TESTPROGRAM$_Ld11:
	.ascii	".Error while testing TestOne function overloads\000"
# End asmlist al_typedconsts
# Begin asmlist al_rotypedconsts
# End asmlist al_rotypedconsts
# Begin asmlist al_threadvars
# End asmlist al_threadvars
# Begin asmlist al_imports
# End asmlist al_imports
# Begin asmlist al_exports
# End asmlist al_exports
# Begin asmlist al_resources
# End asmlist al_resources
# Begin asmlist al_rtti

.section .data.n__$TESTPROGRAM$_Ld14,"d"
	.balign 4
.globl	_$TESTPROGRAM$_Ld13
_$TESTPROGRAM$_Ld13:
	.short	0
	.long	_$TESTPROGRAM$_Ld14
	.balign 4
.globl	_$TESTPROGRAM$_Ld14
_$TESTPROGRAM$_Ld14:
	.short	0

.section .data.n_RTTI_P$TESTPROGRAM_TCLASS,"d"
	.balign 4
.globl	RTTI_P$TESTPROGRAM_TCLASS
RTTI_P$TESTPROGRAM_TCLASS:
	.byte	15,6
	.ascii	"TClass"
	.long	VMT_P$TESTPROGRAM_TCLASS
	.long	RTTI_SYSTEM_TOBJECT
	.short	0
	.byte	11
	.ascii	"TestProgram"
	.short	0

.section .data.n__$TESTPROGRAM$_Ld17,"d"
	.balign 4
.globl	_$TESTPROGRAM$_Ld16
_$TESTPROGRAM$_Ld16:
	.short	0
	.long	_$TESTPROGRAM$_Ld17
	.balign 4
.globl	_$TESTPROGRAM$_Ld17
_$TESTPROGRAM$_Ld17:
	.short	0

.section .data.n_RTTI_P$TESTPROGRAM_TCLASS2,"d"
	.balign 4
.globl	RTTI_P$TESTPROGRAM_TCLASS2
RTTI_P$TESTPROGRAM_TCLASS2:
	.byte	15,7
	.ascii	"TClass2"
	.long	VMT_P$TESTPROGRAM_TCLASS2
	.long	RTTI_P$TESTPROGRAM_TCLASS
	.short	0
	.byte	11
	.ascii	"TestProgram"
	.short	0
# End asmlist al_rtti
# Begin asmlist al_dwarf_frame
# End asmlist al_dwarf_frame
# Begin asmlist al_dwarf_info
# End asmlist al_dwarf_info
# Begin asmlist al_dwarf_abbrev
# End asmlist al_dwarf_abbrev
# Begin asmlist al_dwarf_line
# End asmlist al_dwarf_line
# Begin asmlist al_picdata
# End asmlist al_picdata
# Begin asmlist al_resourcestrings
# End asmlist al_resourcestrings
# Begin asmlist al_objc_data
# End asmlist al_objc_data
# Begin asmlist al_objc_pools
# End asmlist al_objc_pools
# Begin asmlist al_end

.section .text.z_DEBUGEND_P$TESTPROGRAM,"x"
.globl	DEBUGEND_P$TESTPROGRAM
DEBUGEND_P$TESTPROGRAM:
	.stabs "",100,0,0,.Lf13
.Lf13:
# End asmlist al_end
procedure ProcInsideIncFile;
begin
  Writeln('Testing inc file');
end;

Patch

diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 9eea7ce..624976b 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -709,27 +709,26 @@  cp_print_static_field (struct type *type,
 	     &opts, current_language);
 }
 
-
-/* Find the field in *DOMAIN, or its non-virtual base classes, with
-   bit offset OFFSET.  Set *DOMAIN to the containing type and *FIELDNO
+/* Find the field in *SELF, or its non-virtual base classes, with
+   bit offset OFFSET.  Set *SELF to the containing type and *FIELDNO
    to the containing field number.  If OFFSET is not exactly at the
-   start of some field, set *DOMAIN to NULL.  */
+   start of some field, set *SELF to NULL.  */
 
 static void
-cp_find_class_member (struct type **domain_p, int *fieldno,
+cp_find_class_member (struct type **self_p, int *fieldno,
 		      LONGEST offset)
 {
-  struct type *domain;
+  struct type *self;
   unsigned int i;
   unsigned len;
 
-  *domain_p = check_typedef (*domain_p);
-  domain = *domain_p;
-  len = TYPE_NFIELDS (domain);
+  *self_p = check_typedef (*self_p);
+  self = *self_p;
+  len = TYPE_NFIELDS (self);
 
-  for (i = TYPE_N_BASECLASSES (domain); i < len; i++)
+  for (i = TYPE_N_BASECLASSES (self); i < len; i++)
     {
-      LONGEST bitpos = TYPE_FIELD_BITPOS (domain, i);
+      LONGEST bitpos = TYPE_FIELD_BITPOS (self, i);
 
       QUIT;
       if (offset == bitpos)
@@ -739,20 +738,20 @@  cp_find_class_member (struct type **domain_p, int *fieldno,
 	}
     }
 
-  for (i = 0; i < TYPE_N_BASECLASSES (domain); i++)
+  for (i = 0; i < TYPE_N_BASECLASSES (self); i++)
     {
-      LONGEST bitpos = TYPE_FIELD_BITPOS (domain, i);
-      LONGEST bitsize = 8 * TYPE_LENGTH (TYPE_FIELD_TYPE (domain, i));
+      LONGEST bitpos = TYPE_FIELD_BITPOS (self, i);
+      LONGEST bitsize = 8 * TYPE_LENGTH (TYPE_FIELD_TYPE (self, i));
 
       if (offset >= bitpos && offset < bitpos + bitsize)
 	{
-	  *domain_p = TYPE_FIELD_TYPE (domain, i);
-	  cp_find_class_member (domain_p, fieldno, offset - bitpos);
+	  *self_p = TYPE_FIELD_TYPE (self, i);
+	  cp_find_class_member (self_p, fieldno, offset - bitpos);
 	  return;
 	}
     }
 
-  *domain_p = NULL;
+  *self_p = NULL;
 }
 
 void
@@ -761,10 +760,10 @@  cp_print_class_member (const gdb_byte *valaddr, struct type *type,
 {
   enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
 
-  /* VAL is a byte offset into the structure type DOMAIN.
+  /* VAL is a byte offset into the structure type SELF_TYPE.
      Find the name of the field for that offset and
      print it.  */
-  struct type *domain = TYPE_SELF_TYPE (type);
+  struct type *self_type = TYPE_SELF_TYPE (type);
   LONGEST val;
   int fieldno;
 
@@ -788,20 +787,20 @@  cp_print_class_member (const gdb_byte *valaddr, struct type *type,
       return;
     }
 
-  cp_find_class_member (&domain, &fieldno, val << 3);
+  cp_find_class_member (&self_type, &fieldno, val << 3);
 
-  if (domain != NULL)
+  if (self_type != NULL)
     {
       const char *name;
 
       fputs_filtered (prefix, stream);
-      name = type_name_no_tag (domain);
+      name = type_name_no_tag (self_type);
       if (name)
 	fputs_filtered (name, stream);
       else
-	c_type_print_base (domain, stream, 0, 0, &type_print_raw_options);
+	c_type_print_base (self_type, stream, 0, 0, &type_print_raw_options);
       fprintf_filtered (stream, "::");
-      fputs_filtered (TYPE_FIELD_NAME (domain, fieldno), stream);
+      fputs_filtered (TYPE_FIELD_NAME (self_type, fieldno), stream);
     }
   else
     fprintf_filtered (stream, "%ld", (long) val);
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 715b090..3a30802 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -12995,7 +12995,7 @@  is_vtable_name (const char *name, struct dwarf2_cu *cu)
 static void
 quirk_gcc_member_function_pointer (struct type *type, struct objfile *objfile)
 {
-  struct type *pfn_type, *domain_type, *new_type;
+  struct type *pfn_type, *self_type, *new_type;
 
   /* Check for a structure with no name and two children.  */
   if (TYPE_CODE (type) != TYPE_CODE_STRUCT || TYPE_NFIELDS (type) != 2)
@@ -13022,9 +13022,9 @@  quirk_gcc_member_function_pointer (struct type *type, struct objfile *objfile)
       || TYPE_CODE (TYPE_FIELD_TYPE (pfn_type, 0)) != TYPE_CODE_PTR)
     return;
 
-  domain_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (pfn_type, 0));
+  self_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (pfn_type, 0));
   new_type = alloc_type (objfile);
-  smash_to_method_type (new_type, domain_type, TYPE_TARGET_TYPE (pfn_type),
+  smash_to_method_type (new_type, self_type, TYPE_TARGET_TYPE (pfn_type),
 			TYPE_FIELDS (pfn_type), TYPE_NFIELDS (pfn_type),
 			TYPE_VARARGS (pfn_type));
   smash_to_methodptr_type (type, new_type);
@@ -21995,6 +21995,9 @@  set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
   if (need_gnat_info (cu)
       && TYPE_CODE (type) != TYPE_CODE_FUNC
       && TYPE_CODE (type) != TYPE_CODE_FLT
+      && TYPE_CODE (type) != TYPE_CODE_METHODPTR
+      && TYPE_CODE (type) != TYPE_CODE_MEMBERPTR
+      && TYPE_CODE (type) != TYPE_CODE_METHOD
       && !HAVE_GNAT_AUX_INFO (type))
     INIT_GNAT_SPECIFIC (type);
 
diff --git a/gdb/gdb-gdb.py b/gdb/gdb-gdb.py
index 9b8ac62..5cc045b 100644
--- a/gdb/gdb-gdb.py
+++ b/gdb/gdb-gdb.py
@@ -209,6 +209,8 @@  class StructMainTypePrettyPrinter:
             img = ("calling_convention = %d"
                    % type_specific['func_stuff']['calling_convention'])
             # tail_call_list is not printed.
+        elif type_specific_kind == "TYPE_SPECIFIC_SELF_TYPE":
+            img = "self_type = %s" % type_specific['self_type']
         else:
             img = ("type_specific = ??? (unknown type_secific_kind: %s)"
                    % type_specific_kind)
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 23ce85d..d22ddf5 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1188,7 +1188,58 @@  init_vector_type (struct type *elt_type, int n)
   return array_type;
 }
 
-/* Smash TYPE to be a type of pointers to members of DOMAIN with type
+/* Internal routine called by TYPE_SELF_TYPE to return the type that TYPE
+   belongs to.  In c++ this is the class of "this", but TYPE_THIS_TYPE is too
+   confusing.  "self" is a common enough replacement for "this".
+   TYPE must be one of TYPE_CODE_METHODPTR, TYPE_CODE_MEMBERPTR, or
+   TYPE_CODE_METHOD.  */
+
+struct type *
+internal_type_self_type (struct type *type)
+{
+  switch (TYPE_CODE (type))
+    {
+    case TYPE_CODE_METHODPTR:
+    case TYPE_CODE_MEMBERPTR:
+      gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_SELF_TYPE);
+      return TYPE_MAIN_TYPE (type)->type_specific.self_type;
+    case TYPE_CODE_METHOD:
+      gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_FUNC);
+      return TYPE_MAIN_TYPE (type)->type_specific.func_stuff->self_type;
+    default:
+      gdb_assert_not_reached ("bad type");
+    }
+}
+
+/* Set the type of the class that TYPE belongs to.
+   In c++ this is the class of "this".
+   TYPE must be one of TYPE_CODE_METHODPTR, TYPE_CODE_MEMBERPTR, or
+   TYPE_CODE_METHOD.  */
+
+void
+set_type_self_type (struct type *type, struct type *self_type)
+{
+  switch (TYPE_CODE (type))
+    {
+    case TYPE_CODE_METHODPTR:
+    case TYPE_CODE_MEMBERPTR:
+      if (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_NONE)
+	TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_SELF_TYPE;
+      gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_SELF_TYPE);
+      TYPE_MAIN_TYPE (type)->type_specific.self_type = self_type;
+      break;
+    case TYPE_CODE_METHOD:
+      if (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_NONE)
+	INIT_FUNC_SPECIFIC (type);
+      gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_FUNC);
+      TYPE_MAIN_TYPE (type)->type_specific.func_stuff->self_type = self_type;
+      break;
+    default:
+      gdb_assert_not_reached ("bad type");
+    }
+}
+
+/* Smash TYPE to be a type of pointers to members of SELF_TYPE with type
    TO_TYPE.  A member pointer is a wierd thing -- it amounts to a
    typed offset into a struct, e.g. "an int at offset 8".  A MEMBER
    TYPE doesn't include the offset (that's the value of the MEMBER
@@ -1200,17 +1251,17 @@  init_vector_type (struct type *elt_type, int n)
    allocated.  */
 
 void
-smash_to_memberptr_type (struct type *type, struct type *domain,
+smash_to_memberptr_type (struct type *type, struct type *self_type,
 			 struct type *to_type)
 {
   smash_type (type);
+  TYPE_CODE (type) = TYPE_CODE_MEMBERPTR;
   TYPE_TARGET_TYPE (type) = to_type;
-  TYPE_SELF_TYPE (type) = domain;
+  set_type_self_type (type, self_type);
   /* Assume that a data member pointer is the same size as a normal
      pointer.  */
   TYPE_LENGTH (type)
     = gdbarch_ptr_bit (get_type_arch (to_type)) / TARGET_CHAR_BIT;
-  TYPE_CODE (type) = TYPE_CODE_MEMBERPTR;
 }
 
 /* Smash TYPE to be a type of pointer to methods type TO_TYPE.
@@ -1223,13 +1274,13 @@  void
 smash_to_methodptr_type (struct type *type, struct type *to_type)
 {
   smash_type (type);
+  TYPE_CODE (type) = TYPE_CODE_METHODPTR;
   TYPE_TARGET_TYPE (type) = to_type;
-  TYPE_SELF_TYPE (type) = TYPE_SELF_TYPE (to_type);
+  set_type_self_type (type, TYPE_SELF_TYPE (to_type));
   TYPE_LENGTH (type) = cplus_method_ptr_size (to_type);
-  TYPE_CODE (type) = TYPE_CODE_METHODPTR;
 }
 
-/* Smash TYPE to be a type of method of DOMAIN with type TO_TYPE.
+/* Smash TYPE to be a type of method of SELF_TYPE with type TO_TYPE.
    METHOD just means `function that gets an extra "this" argument'.
 
    When "smashing" the type, we preserve the objfile that the old type
@@ -1237,19 +1288,19 @@  smash_to_methodptr_type (struct type *type, struct type *to_type)
    allocated.  */
 
 void
-smash_to_method_type (struct type *type, struct type *domain,
+smash_to_method_type (struct type *type, struct type *self_type,
 		      struct type *to_type, struct field *args,
 		      int nargs, int varargs)
 {
   smash_type (type);
+  TYPE_CODE (type) = TYPE_CODE_METHOD;
   TYPE_TARGET_TYPE (type) = to_type;
-  TYPE_SELF_TYPE (type) = domain;
+  set_type_self_type (type, self_type);
   TYPE_FIELDS (type) = args;
   TYPE_NFIELDS (type) = nargs;
   if (varargs)
     TYPE_VARARGS (type) = 1;
   TYPE_LENGTH (type) = 1;	/* In practice, this is never needed.  */
-  TYPE_CODE (type) = TYPE_CODE_METHOD;
 }
 
 /* Return a typename for a struct/union/enum type without "struct ",
@@ -2279,13 +2330,12 @@  check_stub_method (struct type *type, int method_id, int signature_id)
 
   /* Now update the old "stub" type into a real type.  */
   mtype = TYPE_FN_FIELD_TYPE (f, signature_id);
-  TYPE_SELF_TYPE (mtype) = type;
-  TYPE_FIELDS (mtype) = argtypes;
-  TYPE_NFIELDS (mtype) = argcount;
+  /* MTYPE may currently be a function (TYPE_CODE_FUNC).
+     We want a method (TYPE_CODE_METHOD).  */
+  smash_to_method_type (mtype, type, TYPE_TARGET_TYPE (mtype),
+			argtypes, argcount, p[-2] == '.');
   TYPE_STUB (mtype) = 0;
   TYPE_FN_FIELD_STUB (f, signature_id) = 0;
-  if (p[-2] == '.')
-    TYPE_VARARGS (mtype) = 1;
 
   xfree (demangled_name);
 }
@@ -4019,6 +4069,12 @@  recursive_dump_type (struct type *type, int spaces)
                           TYPE_CALLING_CONVENTION (type));
 	/* tail_call_list is not printed.  */
 	break;
+
+      case TYPE_SPECIFIC_SELF_TYPE:
+	printfi_filtered (spaces, "self_type ");
+	gdb_print_host_address (TYPE_SELF_TYPE (type), gdb_stdout);
+	puts_filtered ("\n");
+	break;
     }
 
   if (spaces == 0)
@@ -4211,6 +4267,11 @@  copy_type_recursive (struct objfile *objfile,
     case TYPE_SPECIFIC_GNAT_STUFF:
       INIT_GNAT_SPECIFIC (new_type);
       break;
+    case TYPE_SPECIFIC_SELF_TYPE:
+      set_type_self_type (new_type,
+			  copy_type_recursive (objfile, TYPE_SELF_TYPE (type),
+					       copied_types));
+      break;
     default:
       gdb_assert_not_reached ("bad type_specific_kind");
     }
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index ef20743..79b6158 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -438,7 +438,7 @@  enum field_loc_kind
 /* * A discriminant to determine which field in the
    main_type.type_specific union is being used, if any.
 
-   For types such as TYPE_CODE_FLT or TYPE_CODE_FUNC, the use of this
+   For types such as TYPE_CODE_FLT, the use of this
    discriminant is really redundant, as we know from the type code
    which field is going to be used.  As such, it would be possible to
    reduce the size of this enum in order to save a bit or two for
@@ -452,7 +452,9 @@  enum type_specific_kind
   TYPE_SPECIFIC_CPLUS_STUFF,
   TYPE_SPECIFIC_GNAT_STUFF,
   TYPE_SPECIFIC_FLOATFORMAT,
-  TYPE_SPECIFIC_FUNC
+  /* Note: This is used by TYPE_CODE_FUNC and TYPE_CODE_METHOD.  */
+  TYPE_SPECIFIC_FUNC,
+  TYPE_SPECIFIC_SELF_TYPE
 };
 
 /* * Main structure representing a type in GDB.
@@ -677,13 +679,6 @@  struct main_type
      VPTR_BASETYPE is the base class which defined the virtual
      function table pointer.
 
-     For types that are pointer to member types (TYPE_CODE_METHODPTR,
-     TYPE_CODE_MEMBERPTR), VPTR_BASETYPE is the type that this pointer
-     is a member of.
-
-     For method types (TYPE_CODE_METHOD), VPTR_BASETYPE is the aggregate
-     type that contains the method.
-
      Unused otherwise.  */
 
   struct type *vptr_basetype;
@@ -711,9 +706,15 @@  struct main_type
 
     const struct floatformat **floatformat;
 
-    /* * For TYPE_CODE_FUNC types,  */
+    /* * For TYPE_CODE_FUNC and TYPE_CODE_METHOD types.  */
 
     struct func_type *func_stuff;
+
+    /* * For types that are pointer to member types (TYPE_CODE_METHODPTR,
+       TYPE_CODE_MEMBERPTR), SELF_TYPE is the type that this pointer
+       is a member of.  */
+
+    struct type *self_type;
   } type_specific;
 
   /* * Contains a location description value for the current type. Evaluating
@@ -903,7 +904,7 @@  struct cplus_struct_type
 	       
 	       (This comment used to say "The return value of the
 	       method", but that's wrong.  The function type is
-	       expected here, i.e. something with TYPE_CODE_FUNC, and
+	       expected here, i.e. something with TYPE_CODE_METHOD, and
 	       *not* the return-value type).  */
 
 	    struct type *type;
@@ -1013,7 +1014,7 @@  struct gnat_aux_type
     struct type* descriptive_type;
   };
 
-/* * For TYPE_CODE_FUNC types.  */
+/* * For TYPE_CODE_FUNC and TYPE_CODE_METHOD types.  */
 
 struct func_type
   {
@@ -1038,6 +1039,11 @@  struct func_type
        DW_TAG_GNU_call_site's exist in such function. */
 
     struct call_site *tail_call_list;
+
+    /* * For method types (TYPE_CODE_METHOD), the aggregate type that
+       contains the method.  */
+
+    struct type *self_type;
   };
 
 /* struct call_site_parameter can be referenced in callees by several ways.  */
@@ -1231,8 +1237,12 @@  extern void allocate_gnat_aux_type (struct type *);
 
 /* C++ */
 
+#define TYPE_SELF_TYPE(thistype) internal_type_self_type (thistype)
+/* Do not call this, use TYPE_SELF_TYPE.  */
+extern struct type *internal_type_self_type (struct type *);
+extern void set_type_self_type (struct type *, struct type *);
+
 #define TYPE_VPTR_BASETYPE(thistype) TYPE_MAIN_TYPE(thistype)->vptr_basetype
-#define TYPE_SELF_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->vptr_basetype
 #define TYPE_VPTR_FIELDNO(thistype) TYPE_MAIN_TYPE(thistype)->vptr_fieldno
 #define TYPE_NFN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields
 #define TYPE_SPECIFIC_FIELD(thistype) \
@@ -1654,7 +1664,7 @@  extern struct type *lookup_memberptr_type (struct type *, struct type *);
 
 extern struct type *lookup_methodptr_type (struct type *);
 
-extern void smash_to_method_type (struct type *type, struct type *domain,
+extern void smash_to_method_type (struct type *type, struct type *self_type,
 				  struct type *to_type, struct field *args,
 				  int nargs, int varargs);
 
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index eddda4f..cdcb354 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -584,8 +584,8 @@  gnuv3_print_method_ptr (const gdb_byte *contents,
 			struct type *type,
 			struct ui_file *stream)
 {
-  struct type *domain = TYPE_SELF_TYPE (type);
-  struct gdbarch *gdbarch = get_type_arch (domain);
+  struct type *self_type = TYPE_SELF_TYPE (type);
+  struct gdbarch *gdbarch = get_type_arch (self_type);
   CORE_ADDR ptr_value;
   LONGEST adjustment;
   int vbit;
@@ -611,7 +611,7 @@  gnuv3_print_method_ptr (const gdb_byte *contents,
 	 to an index, as used in TYPE_FN_FIELD_VOFFSET.  */
       voffset = ptr_value / TYPE_LENGTH (vtable_ptrdiff_type (gdbarch));
 
-      physname = gnuv3_find_method_in (domain, voffset, adjustment);
+      physname = gnuv3_find_method_in (self_type, voffset, adjustment);
 
       /* If we found a method, print that.  We don't bother to disambiguate
 	 possible paths to the method based on the adjustment.  */
@@ -709,17 +709,17 @@  gnuv3_method_ptr_to_value (struct value **this_p, struct value *method_ptr)
   struct gdbarch *gdbarch;
   const gdb_byte *contents = value_contents (method_ptr);
   CORE_ADDR ptr_value;
-  struct type *domain_type, *final_type, *method_type;
+  struct type *self_type, *final_type, *method_type;
   LONGEST adjustment;
   int vbit;
 
-  domain_type = TYPE_SELF_TYPE (check_typedef (value_type (method_ptr)));
-  final_type = lookup_pointer_type (domain_type);
+  self_type = TYPE_SELF_TYPE (check_typedef (value_type (method_ptr)));
+  final_type = lookup_pointer_type (self_type);
 
   method_type = TYPE_TARGET_TYPE (check_typedef (value_type (method_ptr)));
 
   /* Extract the pointer to member.  */
-  gdbarch = get_type_arch (domain_type);
+  gdbarch = get_type_arch (self_type);
   vbit = gnuv3_decode_method_ptr (gdbarch, contents, &ptr_value, &adjustment);
 
   /* First convert THIS to match the containing type of the pointer to
diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c
index 4e82938..21bca39 100644
--- a/gdb/m2-typeprint.c
+++ b/gdb/m2-typeprint.c
@@ -188,8 +188,12 @@  m2_range (struct type *type, struct ui_file *stream, int show,
 	  int level, const struct type_print_options *flags)
 {
   if (TYPE_HIGH_BOUND (type) == TYPE_LOW_BOUND (type))
-    m2_print_type (TYPE_SELF_TYPE (type), "", stream, show, level,
-		   flags);
+    {
+      /* FIXME: TYPE_TARGET_TYPE used to be TYPE_DOMAIN_TYPE but that was
+	 wrong.  Not sure if TYPE_TARGET_TYPE is correct though.  */
+      m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level,
+		     flags);
+    }
   else
     {
       struct type *target = TYPE_TARGET_TYPE (type);
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 1f46f75..423c442 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -2376,14 +2376,21 @@  read_member_functions (struct field_info *fip, char **pp, struct type *type,
 	      p++;
 	    }
 
-	  /* If this is just a stub, then we don't have the real name here.  */
+	  /* These are methods, not functions.  */
+	  if (TYPE_CODE (new_sublist->fn_field.type) == TYPE_CODE_FUNC)
+	    TYPE_CODE (new_sublist->fn_field.type) = TYPE_CODE_METHOD;
+	  else
+	    gdb_assert (TYPE_CODE (new_sublist->fn_field.type)
+			== TYPE_CODE_METHOD);
 
+	  /* If this is just a stub, then we don't have the real name here.  */
 	  if (TYPE_STUB (new_sublist->fn_field.type))
 	    {
 	      if (!TYPE_SELF_TYPE (new_sublist->fn_field.type))
-		TYPE_SELF_TYPE (new_sublist->fn_field.type) = type;
+		set_type_self_type (new_sublist->fn_field.type, type);
 	      new_sublist->fn_field.is_stub = 1;
 	    }
+
 	  new_sublist->fn_field.physname = savestring (*pp, p - *pp);
 	  *pp = p + 1;