3 Copyright (c) 1998-2000 by Florian Klaempfl
5 This units contains special support for the GDB
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 ****************************************************************************
29 strings
,cobjects
,globals
,aasm
;
34 N_STSYM
= 38; {initialized const }
35 N_LCSYM
= 40; {non initialized variable}
36 N_Function
= $24; {function or const }
40 N_RSYM
= $40; { register variable }
50 pai_stabs
= ^tai_stabs
;
52 tai_stabs
= object(tai
)
54 constructor init(_str
: pchar
);
55 destructor done
; virtual;
58 pai_stabn
= ^tai_stabn
;
60 tai_stabn
= object(tai
)
62 constructor init(_str
: pchar
);
63 destructor done
; virtual;
66 { insert a cut to split into several smaller files }
67 pai_force_line
= ^tai_force_line
;
68 tai_force_line
= object(tai
)
72 pai_stab_function_name
= ^tai_stab_function_name
;
74 tai_stab_function_name
= object(tai
)
76 constructor init(_str
: pchar
);
77 destructor done
; virtual;
81 DBX_counter
: plongint
= nil;
82 do_count_dbx
: boolean = false;
85 { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
86 "eip", "ps", "cs", "ss", "ds", "es", "fs", "gs", }
87 { this is the register order for GDB }
88 GDB_i386index
: array[tregister
] of shortint
=(-1,
89 0,1,2,3,4,5,6,7,0,1,2,3,4,5,7,0,1,2,3,0,1,2,3,
91 -1,-1,-1,-1,-1,-1,-1,-1,-1,
95 { I think, GDB doesn't know MMX (FK) }
96 -1,-1,-1,-1,-1,-1,-1,-1,
97 -1,-1,-1,-1,-1,-1,-1,-1
105 { to use N_EXCL we have to count the character in the stabs for
107 Code comes from stabs.c for ld
113 struct stab_link_includes_entry *incl_entry;
114 struct stab_link_includes_totals *t;
115 struct stab_excl_list *ne;
119 for (incl_sym = sym + STABSIZE;
121 incl_sym += STABSIZE)
125 incl_type = incl_sym[TYPEOFF];
128 else if (incl_type == N_EINCL)
134 else if (incl_type == N_BINCL)
140 str = ((char *) stabstrbuf
142 + bfd_get_32 (abfd, incl_sym + STRDXOFF));
143 for (; *str != '\0'; str++)
148 Skip the file number.
150 while (isdigit ((unsigned char) *str))
159 procedure count_dbx(st
: pchar
);
164 if assigned(dbx_counter
) then
166 {$IfDef ExtDebugDbx }
167 Comment(V_Info
,'Counting '+st
);
168 Comment(V_Info
,'count = '+tostr(dbx_counter
^));
169 Comment(V_Info
,'addr = '+tostr(longint(dbx_counter
)));
170 {$EndIf ExtDebugDbx }
172 while i
<=strlen(st
) do
175 if do_count
then exit
176 else do_count
:= true
180 dbx_counter
^ := dbx_counter
^+byte(st
[i
]);
185 while st
[i
] in ['0'..'9'] do inc(i
);
195 constructor tai_stabs
.init(_str
: pchar
);
207 destructor tai_stabs
.done
;
214 constructor tai_stabn
.init(_str
: pchar
);
222 destructor tai_stabn
.done
;
229 constructor tai_force_line
.init
;
236 constructor tai_stab_function_name
.init(_str
: pchar
);
240 typ
:=ait_stab_function_name
;
244 destructor tai_stab_function_name
.done
;
254 Revision 1.1 2002/02/19 08:22:20 sasu
257 Revision 1.1 2000/07/13 06:29:50 michael
260 Revision 1.17 2000/05/12 05:57:34 pierre
261 * * get it to compile with Delphi by Kovacs Attila Zoltan
263 Revision 1.16 2000/05/11 09:40:11 pierre
264 * some DBX changes but it still does not work !
266 Revision 1.15 2000/02/09 13:22:52 peter
269 Revision 1.14 2000/01/07 01:14:27 peter
270 * updated copyright to 2000
272 Revision 1.13 1999/11/09 23:51:25 pierre
275 Revision 1.12 1999/08/04 00:23:01 florian
276 * renamed i386asm and i386base to cpuasm and cpubase