1990-10-01 15:28:28 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1990 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*
|
|
|
|
* Author: Ceriel J.H. Jacobs
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* D E B U G G E R S Y M B O L T A B L E */
|
|
|
|
|
1994-06-27 08:03:14 +00:00
|
|
|
/* $Id$ */
|
1990-10-01 15:28:28 +00:00
|
|
|
|
2013-05-12 19:45:55 +00:00
|
|
|
#include "parameters.h"
|
1990-10-01 15:28:28 +00:00
|
|
|
|
|
|
|
#ifdef DBSYMTAB
|
|
|
|
|
|
|
|
#include <alloc.h>
|
|
|
|
#include <em_arith.h>
|
|
|
|
#include <em_label.h>
|
|
|
|
#include <em_code.h>
|
|
|
|
#include <flt_arith.h>
|
|
|
|
#include <stb.h>
|
|
|
|
|
2019-02-18 16:42:15 +00:00
|
|
|
#include "stab.h"
|
2013-05-12 19:45:55 +00:00
|
|
|
#include "idf.h"
|
1990-10-01 15:28:28 +00:00
|
|
|
#include "LLlex.h"
|
|
|
|
#include "stack.h"
|
|
|
|
#include "def.h"
|
|
|
|
#include "type.h"
|
|
|
|
#include "struct.h"
|
|
|
|
#include "field.h"
|
|
|
|
#include "Lpars.h"
|
|
|
|
#include "level.h"
|
2019-02-18 16:42:15 +00:00
|
|
|
#include "print.h"
|
1990-10-01 15:28:28 +00:00
|
|
|
|
2019-02-18 16:42:15 +00:00
|
|
|
extern long full_mask[];
|
1990-10-01 15:28:28 +00:00
|
|
|
|
|
|
|
#define INCR_SIZE 64
|
|
|
|
|
2019-02-18 16:42:15 +00:00
|
|
|
static struct db_str
|
|
|
|
{
|
|
|
|
unsigned sz;
|
|
|
|
char *base;
|
|
|
|
char *currpos;
|
1990-10-01 15:28:28 +00:00
|
|
|
} db_str;
|
|
|
|
|
2019-02-18 16:42:15 +00:00
|
|
|
static void create_db_str(void)
|
1990-10-01 15:28:28 +00:00
|
|
|
{
|
2019-02-18 16:42:15 +00:00
|
|
|
if (!db_str.base)
|
|
|
|
{
|
1990-10-01 15:28:28 +00:00
|
|
|
db_str.base = Malloc(INCR_SIZE);
|
|
|
|
db_str.sz = INCR_SIZE;
|
|
|
|
}
|
|
|
|
db_str.currpos = db_str.base;
|
|
|
|
}
|
|
|
|
|
2019-02-18 16:42:15 +00:00
|
|
|
static void addc_db_str(int c)
|
1990-10-01 15:28:28 +00:00
|
|
|
{
|
|
|
|
int df = db_str.currpos - db_str.base;
|
2019-02-18 16:42:15 +00:00
|
|
|
if (df >= db_str.sz - 1)
|
|
|
|
{
|
1990-10-01 15:28:28 +00:00
|
|
|
db_str.sz += INCR_SIZE;
|
|
|
|
db_str.base = Realloc(db_str.base, db_str.sz);
|
|
|
|
db_str.currpos = db_str.base + df;
|
|
|
|
}
|
|
|
|
*db_str.currpos++ = c;
|
|
|
|
*db_str.currpos = '\0';
|
|
|
|
}
|
|
|
|
|
2019-02-18 16:42:15 +00:00
|
|
|
static void adds_db_str(char *s)
|
1990-10-01 15:28:28 +00:00
|
|
|
{
|
2019-02-18 16:42:15 +00:00
|
|
|
while (*s)
|
|
|
|
addc_db_str(*s++);
|
1990-10-01 15:28:28 +00:00
|
|
|
}
|
|
|
|
|
2019-02-18 16:42:15 +00:00
|
|
|
static void stb_type(register struct type *tp)
|
1990-10-01 15:28:28 +00:00
|
|
|
{
|
Begin to add `long long` to C compiler for linux386.
Add long long type, but without literals; you can't say '123LL' yet.
You can try constant operations, like `(long long)123 + 1`, but the
compiler's `arith` type might not be wide enough. Conversions,
shifts, and some other operations don't work in i386 ncg; I am using a
union instead of conversions:
union q {
long long ll;
unsigned long long ull;
int i[2];
};
Hack plat/linux386/descr to enable long long (size 8, alignment 4)
only for this platform. The default for other platforms is to disable
long long (size -1).
In lang/cem/cemcom.ansi,
- BigPars, SmallPars: Add default size, alignment of long long.
- align.h: Add lnglng_align.
- arith.c: Convert arithmetic operands to long long or unsigned long
long when necessary; avoid conversion from long long to long.
Allow long long as an arithmetic, integral, or logical operand.
- ch3.c: Handle long long like int and long when erroneously applying
a selector, like `long long ll; ll.member` or `ll->member`. Add
long long to integral and arithmetic types.
- code.c: Add long long to type stabs for debugging.
- conversion.c: Add long long to integral conversions.
- cstoper.c: Write masks up to full_mask[8]. Add FIXME comment.
- declar.g: Parse `long long` in code.
- decspecs.c: Understand long long in type declarations.
- eval.c: Add long long to operations, to generate code like `adi 8`.
Don't use `ldc` with constant over 4 bytes.
- ival.g: Allow long long in initializations.
- main.c: Set lnglng_type and related values.
- options.c: Add option like `-Vq8.4` to set long long to size 8,
alignment 4. I chose 'q', because Perl's pack and Ruby's
Array#pack use 'q' for 64-bit or long long values; it might be a
reference to BSD's old quad_t alias for long long.
- sizes.h: Add lnglng_size.
- stab.c: Allow long long when writing the type stab for debugging.
Switch from calculating the ranges to hardcoding them in strings;
add 8-byte ranges as a special case. This also hardcodes the
unsigned 4-byte range as "0;-1". Before it was either "0;-1" or
"0;4294967295", depending on sizeof(long) in the compiler.
- struct.c: Try long long bitfield, but it will probably give the
error, "bit field type long long does not fit in a word".
- switch.c: Update comment.
- tokenname.c: Define LNGLNG (long long) like LNGDBL (long double).
- type.c, type.str: Add lnglng_type and ulnglng_type. Add function
no_long_long() to check if long long is disabled.
2019-09-02 15:24:44 +00:00
|
|
|
char buf[128], *range;
|
2019-02-18 16:42:15 +00:00
|
|
|
static int stb_count;
|
|
|
|
long l;
|
Begin to add `long long` to C compiler for linux386.
Add long long type, but without literals; you can't say '123LL' yet.
You can try constant operations, like `(long long)123 + 1`, but the
compiler's `arith` type might not be wide enough. Conversions,
shifts, and some other operations don't work in i386 ncg; I am using a
union instead of conversions:
union q {
long long ll;
unsigned long long ull;
int i[2];
};
Hack plat/linux386/descr to enable long long (size 8, alignment 4)
only for this platform. The default for other platforms is to disable
long long (size -1).
In lang/cem/cemcom.ansi,
- BigPars, SmallPars: Add default size, alignment of long long.
- align.h: Add lnglng_align.
- arith.c: Convert arithmetic operands to long long or unsigned long
long when necessary; avoid conversion from long long to long.
Allow long long as an arithmetic, integral, or logical operand.
- ch3.c: Handle long long like int and long when erroneously applying
a selector, like `long long ll; ll.member` or `ll->member`. Add
long long to integral and arithmetic types.
- code.c: Add long long to type stabs for debugging.
- conversion.c: Add long long to integral conversions.
- cstoper.c: Write masks up to full_mask[8]. Add FIXME comment.
- declar.g: Parse `long long` in code.
- decspecs.c: Understand long long in type declarations.
- eval.c: Add long long to operations, to generate code like `adi 8`.
Don't use `ldc` with constant over 4 bytes.
- ival.g: Allow long long in initializations.
- main.c: Set lnglng_type and related values.
- options.c: Add option like `-Vq8.4` to set long long to size 8,
alignment 4. I chose 'q', because Perl's pack and Ruby's
Array#pack use 'q' for 64-bit or long long values; it might be a
reference to BSD's old quad_t alias for long long.
- sizes.h: Add lnglng_size.
- stab.c: Allow long long when writing the type stab for debugging.
Switch from calculating the ranges to hardcoding them in strings;
add 8-byte ranges as a special case. This also hardcodes the
unsigned 4-byte range as "0;-1". Before it was either "0;-1" or
"0;4294967295", depending on sizeof(long) in the compiler.
- struct.c: Try long long bitfield, but it will probably give the
error, "bit field type long long does not fit in a word".
- switch.c: Update comment.
- tokenname.c: Define LNGLNG (long long) like LNGDBL (long double).
- type.c, type.str: Add lnglng_type and ulnglng_type. Add function
no_long_long() to check if long long is disabled.
2019-09-02 15:24:44 +00:00
|
|
|
int uns;
|
1990-10-01 15:28:28 +00:00
|
|
|
|
2019-02-18 16:42:15 +00:00
|
|
|
if (tp->tp_dbindex > 0)
|
|
|
|
{
|
1990-10-01 15:28:28 +00:00
|
|
|
adds_db_str(sprint(buf, "%d", tp->tp_dbindex));
|
|
|
|
return;
|
|
|
|
}
|
2019-02-18 16:42:15 +00:00
|
|
|
if (tp->tp_dbindex < 0 && tp->tp_size < 0)
|
|
|
|
{
|
1990-10-19 11:50:32 +00:00
|
|
|
adds_db_str(sprint(buf, "%d", -tp->tp_dbindex));
|
1990-10-01 15:28:28 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-02-18 16:42:15 +00:00
|
|
|
if (tp->tp_dbindex <= 0)
|
|
|
|
{
|
1990-10-19 11:50:32 +00:00
|
|
|
tp->tp_dbindex = ++stb_count;
|
|
|
|
}
|
|
|
|
adds_db_str(sprint(buf, "%d=", tp->tp_dbindex));
|
2019-02-18 16:42:15 +00:00
|
|
|
switch (tp->tp_fund)
|
|
|
|
{
|
1990-10-01 15:28:28 +00:00
|
|
|
/* simple types ... */
|
1990-10-19 11:50:32 +00:00
|
|
|
case VOID:
|
|
|
|
adds_db_str(sprint(buf, "%d", void_type->tp_dbindex));
|
|
|
|
break;
|
1990-10-01 15:28:28 +00:00
|
|
|
case INT:
|
|
|
|
case LONG:
|
Begin to add `long long` to C compiler for linux386.
Add long long type, but without literals; you can't say '123LL' yet.
You can try constant operations, like `(long long)123 + 1`, but the
compiler's `arith` type might not be wide enough. Conversions,
shifts, and some other operations don't work in i386 ncg; I am using a
union instead of conversions:
union q {
long long ll;
unsigned long long ull;
int i[2];
};
Hack plat/linux386/descr to enable long long (size 8, alignment 4)
only for this platform. The default for other platforms is to disable
long long (size -1).
In lang/cem/cemcom.ansi,
- BigPars, SmallPars: Add default size, alignment of long long.
- align.h: Add lnglng_align.
- arith.c: Convert arithmetic operands to long long or unsigned long
long when necessary; avoid conversion from long long to long.
Allow long long as an arithmetic, integral, or logical operand.
- ch3.c: Handle long long like int and long when erroneously applying
a selector, like `long long ll; ll.member` or `ll->member`. Add
long long to integral and arithmetic types.
- code.c: Add long long to type stabs for debugging.
- conversion.c: Add long long to integral conversions.
- cstoper.c: Write masks up to full_mask[8]. Add FIXME comment.
- declar.g: Parse `long long` in code.
- decspecs.c: Understand long long in type declarations.
- eval.c: Add long long to operations, to generate code like `adi 8`.
Don't use `ldc` with constant over 4 bytes.
- ival.g: Allow long long in initializations.
- main.c: Set lnglng_type and related values.
- options.c: Add option like `-Vq8.4` to set long long to size 8,
alignment 4. I chose 'q', because Perl's pack and Ruby's
Array#pack use 'q' for 64-bit or long long values; it might be a
reference to BSD's old quad_t alias for long long.
- sizes.h: Add lnglng_size.
- stab.c: Allow long long when writing the type stab for debugging.
Switch from calculating the ranges to hardcoding them in strings;
add 8-byte ranges as a special case. This also hardcodes the
unsigned 4-byte range as "0;-1". Before it was either "0;-1" or
"0;4294967295", depending on sizeof(long) in the compiler.
- struct.c: Try long long bitfield, but it will probably give the
error, "bit field type long long does not fit in a word".
- switch.c: Update comment.
- tokenname.c: Define LNGLNG (long long) like LNGDBL (long double).
- type.c, type.str: Add lnglng_type and ulnglng_type. Add function
no_long_long() to check if long long is disabled.
2019-09-02 15:24:44 +00:00
|
|
|
case LNGLNG:
|
1990-10-01 15:28:28 +00:00
|
|
|
case CHAR:
|
|
|
|
case SHORT:
|
Begin to add `long long` to C compiler for linux386.
Add long long type, but without literals; you can't say '123LL' yet.
You can try constant operations, like `(long long)123 + 1`, but the
compiler's `arith` type might not be wide enough. Conversions,
shifts, and some other operations don't work in i386 ncg; I am using a
union instead of conversions:
union q {
long long ll;
unsigned long long ull;
int i[2];
};
Hack plat/linux386/descr to enable long long (size 8, alignment 4)
only for this platform. The default for other platforms is to disable
long long (size -1).
In lang/cem/cemcom.ansi,
- BigPars, SmallPars: Add default size, alignment of long long.
- align.h: Add lnglng_align.
- arith.c: Convert arithmetic operands to long long or unsigned long
long when necessary; avoid conversion from long long to long.
Allow long long as an arithmetic, integral, or logical operand.
- ch3.c: Handle long long like int and long when erroneously applying
a selector, like `long long ll; ll.member` or `ll->member`. Add
long long to integral and arithmetic types.
- code.c: Add long long to type stabs for debugging.
- conversion.c: Add long long to integral conversions.
- cstoper.c: Write masks up to full_mask[8]. Add FIXME comment.
- declar.g: Parse `long long` in code.
- decspecs.c: Understand long long in type declarations.
- eval.c: Add long long to operations, to generate code like `adi 8`.
Don't use `ldc` with constant over 4 bytes.
- ival.g: Allow long long in initializations.
- main.c: Set lnglng_type and related values.
- options.c: Add option like `-Vq8.4` to set long long to size 8,
alignment 4. I chose 'q', because Perl's pack and Ruby's
Array#pack use 'q' for 64-bit or long long values; it might be a
reference to BSD's old quad_t alias for long long.
- sizes.h: Add lnglng_size.
- stab.c: Allow long long when writing the type stab for debugging.
Switch from calculating the ranges to hardcoding them in strings;
add 8-byte ranges as a special case. This also hardcodes the
unsigned 4-byte range as "0;-1". Before it was either "0;-1" or
"0;4294967295", depending on sizeof(long) in the compiler.
- struct.c: Try long long bitfield, but it will probably give the
error, "bit field type long long does not fit in a word".
- switch.c: Update comment.
- tokenname.c: Define LNGLNG (long long) like LNGDBL (long double).
- type.c, type.str: Add lnglng_type and ulnglng_type. Add function
no_long_long() to check if long long is disabled.
2019-09-02 15:24:44 +00:00
|
|
|
switch ((tp->tp_size << 3) + !tp->tp_unsigned)
|
2019-02-18 16:42:15 +00:00
|
|
|
{
|
Begin to add `long long` to C compiler for linux386.
Add long long type, but without literals; you can't say '123LL' yet.
You can try constant operations, like `(long long)123 + 1`, but the
compiler's `arith` type might not be wide enough. Conversions,
shifts, and some other operations don't work in i386 ncg; I am using a
union instead of conversions:
union q {
long long ll;
unsigned long long ull;
int i[2];
};
Hack plat/linux386/descr to enable long long (size 8, alignment 4)
only for this platform. The default for other platforms is to disable
long long (size -1).
In lang/cem/cemcom.ansi,
- BigPars, SmallPars: Add default size, alignment of long long.
- align.h: Add lnglng_align.
- arith.c: Convert arithmetic operands to long long or unsigned long
long when necessary; avoid conversion from long long to long.
Allow long long as an arithmetic, integral, or logical operand.
- ch3.c: Handle long long like int and long when erroneously applying
a selector, like `long long ll; ll.member` or `ll->member`. Add
long long to integral and arithmetic types.
- code.c: Add long long to type stabs for debugging.
- conversion.c: Add long long to integral conversions.
- cstoper.c: Write masks up to full_mask[8]. Add FIXME comment.
- declar.g: Parse `long long` in code.
- decspecs.c: Understand long long in type declarations.
- eval.c: Add long long to operations, to generate code like `adi 8`.
Don't use `ldc` with constant over 4 bytes.
- ival.g: Allow long long in initializations.
- main.c: Set lnglng_type and related values.
- options.c: Add option like `-Vq8.4` to set long long to size 8,
alignment 4. I chose 'q', because Perl's pack and Ruby's
Array#pack use 'q' for 64-bit or long long values; it might be a
reference to BSD's old quad_t alias for long long.
- sizes.h: Add lnglng_size.
- stab.c: Allow long long when writing the type stab for debugging.
Switch from calculating the ranges to hardcoding them in strings;
add 8-byte ranges as a special case. This also hardcodes the
unsigned 4-byte range as "0;-1". Before it was either "0;-1" or
"0;4294967295", depending on sizeof(long) in the compiler.
- struct.c: Try long long bitfield, but it will probably give the
error, "bit field type long long does not fit in a word".
- switch.c: Update comment.
- tokenname.c: Define LNGLNG (long long) like LNGDBL (long double).
- type.c, type.str: Add lnglng_type and ulnglng_type. Add function
no_long_long() to check if long long is disabled.
2019-09-02 15:24:44 +00:00
|
|
|
#define R(s) range = #s; break
|
|
|
|
case 0010: R(0;255);
|
|
|
|
case 0011: R(-128;127);
|
|
|
|
case 0020: R(0;65535);
|
|
|
|
case 0021: R(-32768;32767);
|
|
|
|
default: R(0;-1); /* acts as 0;4294967295 */
|
|
|
|
case 0041: R(-2147483648;2147483647);
|
|
|
|
/* The stabs reader in gdb(1) needs an octal integer
|
|
|
|
when its value doesn't fit in type long.
|
|
|
|
*/
|
|
|
|
case 0100: R(0;01777777777777777777777);
|
|
|
|
case 0101: R(01000000000000000000000;0777777777777777777777);
|
|
|
|
#undef R
|
1990-10-01 15:28:28 +00:00
|
|
|
}
|
Begin to add `long long` to C compiler for linux386.
Add long long type, but without literals; you can't say '123LL' yet.
You can try constant operations, like `(long long)123 + 1`, but the
compiler's `arith` type might not be wide enough. Conversions,
shifts, and some other operations don't work in i386 ncg; I am using a
union instead of conversions:
union q {
long long ll;
unsigned long long ull;
int i[2];
};
Hack plat/linux386/descr to enable long long (size 8, alignment 4)
only for this platform. The default for other platforms is to disable
long long (size -1).
In lang/cem/cemcom.ansi,
- BigPars, SmallPars: Add default size, alignment of long long.
- align.h: Add lnglng_align.
- arith.c: Convert arithmetic operands to long long or unsigned long
long when necessary; avoid conversion from long long to long.
Allow long long as an arithmetic, integral, or logical operand.
- ch3.c: Handle long long like int and long when erroneously applying
a selector, like `long long ll; ll.member` or `ll->member`. Add
long long to integral and arithmetic types.
- code.c: Add long long to type stabs for debugging.
- conversion.c: Add long long to integral conversions.
- cstoper.c: Write masks up to full_mask[8]. Add FIXME comment.
- declar.g: Parse `long long` in code.
- decspecs.c: Understand long long in type declarations.
- eval.c: Add long long to operations, to generate code like `adi 8`.
Don't use `ldc` with constant over 4 bytes.
- ival.g: Allow long long in initializations.
- main.c: Set lnglng_type and related values.
- options.c: Add option like `-Vq8.4` to set long long to size 8,
alignment 4. I chose 'q', because Perl's pack and Ruby's
Array#pack use 'q' for 64-bit or long long values; it might be a
reference to BSD's old quad_t alias for long long.
- sizes.h: Add lnglng_size.
- stab.c: Allow long long when writing the type stab for debugging.
Switch from calculating the ranges to hardcoding them in strings;
add 8-byte ranges as a special case. This also hardcodes the
unsigned 4-byte range as "0;-1". Before it was either "0;-1" or
"0;4294967295", depending on sizeof(long) in the compiler.
- struct.c: Try long long bitfield, but it will probably give the
error, "bit field type long long does not fit in a word".
- switch.c: Update comment.
- tokenname.c: Define LNGLNG (long long) like LNGDBL (long double).
- type.c, type.str: Add lnglng_type and ulnglng_type. Add function
no_long_long() to check if long long is disabled.
2019-09-02 15:24:44 +00:00
|
|
|
adds_db_str(sprint(buf, "r%d;%s", tp->tp_dbindex, range));
|
1990-10-01 15:28:28 +00:00
|
|
|
break;
|
|
|
|
case FLOAT:
|
|
|
|
case DOUBLE:
|
|
|
|
case LNGDBL:
|
2019-02-18 16:42:15 +00:00
|
|
|
adds_db_str(
|
|
|
|
sprint(buf, "r%d;%ld;0", tp->tp_dbindex, (long) tp->tp_size));
|
1990-10-01 15:28:28 +00:00
|
|
|
break;
|
|
|
|
|
2019-02-18 16:42:15 +00:00
|
|
|
/* constructed types ... */
|
1990-10-01 15:28:28 +00:00
|
|
|
case POINTER:
|
|
|
|
addc_db_str('*');
|
1990-10-19 11:50:32 +00:00
|
|
|
stb_type(tp->tp_up);
|
1990-10-01 15:28:28 +00:00
|
|
|
break;
|
|
|
|
case ARRAY:
|
2019-02-18 16:42:15 +00:00
|
|
|
if (tp->tp_size > 0)
|
|
|
|
{
|
1990-10-01 15:28:28 +00:00
|
|
|
adds_db_str("ar");
|
1990-10-19 11:50:32 +00:00
|
|
|
stb_type(int_type);
|
2019-02-18 16:42:15 +00:00
|
|
|
adds_db_str(
|
|
|
|
sprint(buf, ";0;%ld;",
|
|
|
|
tp->tp_size / tp->tp_up->tp_size - 1));
|
1990-10-19 11:50:32 +00:00
|
|
|
stb_type(tp->tp_up);
|
1990-10-01 15:28:28 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ENUM:
|
2019-02-18 16:42:15 +00:00
|
|
|
if (tp->tp_size < 0)
|
|
|
|
{
|
|
|
|
adds_db_str(sprint(buf, "xe%s:", tp->tp_idf->id_text));
|
1990-10-19 11:50:32 +00:00
|
|
|
tp->tp_dbindex = -tp->tp_dbindex;
|
1990-10-01 15:28:28 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
addc_db_str('e');
|
|
|
|
{
|
|
|
|
register struct stack_entry *se = local_level->sl_entry;
|
|
|
|
|
2019-02-18 16:42:15 +00:00
|
|
|
while (se)
|
|
|
|
{
|
|
|
|
register struct def *edef = se->se_idf->id_def;
|
|
|
|
while (edef)
|
|
|
|
{
|
|
|
|
if (edef->df_type == tp && edef->df_sc == ENUM)
|
|
|
|
{
|
|
|
|
adds_db_str(
|
|
|
|
sprint(buf, "%s:%ld,", se->se_idf->id_text,
|
|
|
|
edef->df_address));
|
1990-10-01 15:28:28 +00:00
|
|
|
}
|
|
|
|
edef = edef->next;
|
|
|
|
}
|
|
|
|
se = se->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
addc_db_str(';');
|
|
|
|
break;
|
|
|
|
case STRUCT:
|
|
|
|
case UNION:
|
2019-02-18 16:42:15 +00:00
|
|
|
if (tp->tp_size < 0)
|
|
|
|
{
|
|
|
|
adds_db_str(
|
|
|
|
sprint(buf, "x%c%s:", tp->tp_fund == STRUCT ? 's' : 'u',
|
|
|
|
tp->tp_idf->id_text));
|
1990-10-19 11:50:32 +00:00
|
|
|
tp->tp_dbindex = -tp->tp_dbindex;
|
1990-10-01 15:28:28 +00:00
|
|
|
break;
|
|
|
|
}
|
2019-02-18 16:42:15 +00:00
|
|
|
adds_db_str(
|
|
|
|
sprint(buf, "%c%ld", tp->tp_fund == STRUCT ? 's' : 'u',
|
|
|
|
tp->tp_size));
|
1990-10-01 15:28:28 +00:00
|
|
|
{
|
2019-02-18 16:42:15 +00:00
|
|
|
register struct sdef *sdef = tp->tp_sdef;
|
1990-10-01 15:28:28 +00:00
|
|
|
|
2019-02-18 16:42:15 +00:00
|
|
|
while (sdef)
|
|
|
|
{
|
1990-10-01 15:28:28 +00:00
|
|
|
adds_db_str(sdef->sd_idf->id_text);
|
|
|
|
addc_db_str(':');
|
2019-02-18 16:42:15 +00:00
|
|
|
if (sdef->sd_type->tp_fund == FIELD)
|
|
|
|
{
|
1990-10-19 11:50:32 +00:00
|
|
|
stb_type(sdef->sd_type->tp_up);
|
2019-02-18 16:42:15 +00:00
|
|
|
adds_db_str(
|
|
|
|
sprint(buf, ",%ld,%ld;",
|
|
|
|
sdef->sd_offset * 8
|
|
|
|
+ sdef->sd_type->tp_field->fd_shift,
|
|
|
|
sdef->sd_type->tp_field->fd_width));
|
1990-10-01 15:28:28 +00:00
|
|
|
}
|
2019-02-18 16:42:15 +00:00
|
|
|
else
|
|
|
|
{
|
1990-10-19 11:50:32 +00:00
|
|
|
stb_type(sdef->sd_type);
|
2019-02-18 16:42:15 +00:00
|
|
|
adds_db_str(
|
|
|
|
sprint(buf, ",%ld,%ld;", sdef->sd_offset * 8,
|
|
|
|
sdef->sd_type->tp_size * 8));
|
1990-10-01 15:28:28 +00:00
|
|
|
}
|
|
|
|
sdef = sdef->sd_sdef;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
addc_db_str(';');
|
|
|
|
break;
|
|
|
|
case FUNCTION:
|
|
|
|
addc_db_str('f');
|
1990-10-19 11:50:32 +00:00
|
|
|
stb_type(tp->tp_up);
|
1990-10-01 15:28:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-18 16:42:15 +00:00
|
|
|
void stb_tag(register struct tag *tg, char *str)
|
1990-10-01 15:28:28 +00:00
|
|
|
{
|
|
|
|
create_db_str();
|
|
|
|
adds_db_str(str);
|
|
|
|
adds_db_str(":T");
|
1990-10-19 11:50:32 +00:00
|
|
|
stb_type(tg->tg_type);
|
1990-10-01 15:28:28 +00:00
|
|
|
addc_db_str(';');
|
|
|
|
C_ms_stb_cst(db_str.base,
|
2019-02-18 16:42:15 +00:00
|
|
|
N_LSYM,
|
|
|
|
tg->tg_type == void_type || tg->tg_type->tp_size >= 32767 ?
|
|
|
|
0 : (int) tg->tg_type->tp_size, (arith) 0);
|
1990-10-01 15:28:28 +00:00
|
|
|
}
|
|
|
|
|
2019-02-18 16:42:15 +00:00
|
|
|
void stb_typedef(register struct type *tp, char *str)
|
1990-10-01 15:28:28 +00:00
|
|
|
{
|
|
|
|
create_db_str();
|
|
|
|
adds_db_str(str);
|
|
|
|
adds_db_str(":t");
|
1990-10-19 11:50:32 +00:00
|
|
|
stb_type(tp);
|
1990-10-01 15:28:28 +00:00
|
|
|
addc_db_str(';');
|
|
|
|
C_ms_stb_cst(db_str.base,
|
2019-02-18 16:42:15 +00:00
|
|
|
N_LSYM, tp == void_type || tp->tp_size >= 32767 ? 0 : (int) tp->tp_size,
|
|
|
|
(arith) 0);
|
1990-10-01 15:28:28 +00:00
|
|
|
}
|
|
|
|
|
2019-02-18 16:42:15 +00:00
|
|
|
void stb_string(register struct def *df, int kind, char* str)
|
1990-10-01 15:28:28 +00:00
|
|
|
{
|
2019-02-18 16:42:15 +00:00
|
|
|
register struct type *tp = df->df_type;
|
1990-10-01 15:28:28 +00:00
|
|
|
|
|
|
|
create_db_str();
|
|
|
|
adds_db_str(str);
|
|
|
|
addc_db_str(':');
|
2019-02-18 16:42:15 +00:00
|
|
|
switch (kind)
|
|
|
|
{
|
1990-10-01 15:28:28 +00:00
|
|
|
case FUNCTION:
|
|
|
|
addc_db_str(df->df_sc == STATIC ? 'f' : 'F');
|
1990-10-19 11:50:32 +00:00
|
|
|
stb_type(tp->tp_up);
|
1990-10-01 15:28:28 +00:00
|
|
|
addc_db_str(';');
|
|
|
|
C_ms_stb_pnam(db_str.base, N_FUN, 1 /* proclevel */, str);
|
|
|
|
break;
|
|
|
|
default:
|
2019-02-18 16:42:15 +00:00
|
|
|
if (df->df_sc == FORMAL
|
|
|
|
|| (df->df_sc == REGISTER && df->df_address >= 0))
|
|
|
|
{
|
|
|
|
/* value parameter */
|
1990-10-01 15:28:28 +00:00
|
|
|
addc_db_str('p');
|
1990-10-19 11:50:32 +00:00
|
|
|
stb_type(tp);
|
1990-10-01 15:28:28 +00:00
|
|
|
addc_db_str(';');
|
|
|
|
C_ms_stb_cst(db_str.base, N_PSYM, 0, df->df_address);
|
|
|
|
}
|
2019-02-18 16:42:15 +00:00
|
|
|
else if (df->df_sc != AUTO && df->df_sc != REGISTER)
|
|
|
|
{
|
|
|
|
/* global */
|
1993-10-25 15:34:08 +00:00
|
|
|
int stabtp = df->df_initialized ? N_STSYM : N_LCSYM;
|
2019-02-18 16:42:15 +00:00
|
|
|
if (df->df_sc == STATIC)
|
|
|
|
{
|
|
|
|
if (df->df_level >= L_LOCAL)
|
|
|
|
{
|
1990-10-01 15:28:28 +00:00
|
|
|
addc_db_str('V');
|
|
|
|
}
|
2019-02-18 16:42:15 +00:00
|
|
|
else
|
|
|
|
{
|
1990-10-01 15:28:28 +00:00
|
|
|
addc_db_str('S');
|
|
|
|
}
|
|
|
|
}
|
2019-02-18 16:42:15 +00:00
|
|
|
else
|
|
|
|
{
|
1990-10-01 15:28:28 +00:00
|
|
|
addc_db_str('G');
|
|
|
|
}
|
1990-10-19 11:50:32 +00:00
|
|
|
stb_type(tp);
|
1990-10-01 15:28:28 +00:00
|
|
|
addc_db_str(';');
|
2019-02-18 16:42:15 +00:00
|
|
|
if (df->df_sc == STATIC && df->df_level >= L_LOCAL)
|
|
|
|
{
|
|
|
|
C_ms_stb_dlb(db_str.base, stabtp, 0, (label) df->df_address,
|
|
|
|
(arith) 0);
|
1990-10-02 17:13:40 +00:00
|
|
|
}
|
2019-02-18 16:42:15 +00:00
|
|
|
else
|
|
|
|
{
|
1993-10-25 15:34:08 +00:00
|
|
|
C_ms_stb_dnam(db_str.base, stabtp, 0, str, (arith) 0);
|
1990-10-02 17:13:40 +00:00
|
|
|
}
|
1990-10-01 15:28:28 +00:00
|
|
|
}
|
2019-02-18 16:42:15 +00:00
|
|
|
else
|
|
|
|
{ /* local variable */
|
|
|
|
stb_type(tp); /* assign type num to avoid
|
|
|
|
difficult to parse string */
|
1990-10-01 15:28:28 +00:00
|
|
|
addc_db_str(';');
|
|
|
|
C_ms_stb_cst(db_str.base, N_LSYM, 0, df->df_address);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1991-12-17 13:12:22 +00:00
|
|
|
#endif /* DBSYMTAB */
|