|
��������
syms - ������ ������� ���� � ������� �� ������ �����
���������
#include <syms.h>
��������
��������� ����� �������� ������� �������� ����������
��� ���������, ������� � �������� ��������� ����� [��.
sdb(1)]. ���������� � ������� ����� [��. linenum(4)] �
�� ������, ������������� � ���������, ��������� ���������� ��������� �� ������ ��������� C-������. ������
������� ���� � ��������� ����� �������� ��������� �������:
������� ���� ������� �� ��������� ������������� ����� (18 ����). �������, ����������� ���, ����� ���������� ������ �����, ������������ ������, �������� ��� �������� � ������ ����������. ���� ��������� ��������������� C-���������:
#define SYMNMLEN 8 /* ������������ ���������� �������� � ������ ����� */ #define FILNMLEN 14 /* ������������ ���������� �������� � ����� ����� */ #define DIMNUM 4 /* ����������� ������� �� ��������������� ������� */ struct syment { union { /* ��� ������� ������� ����� ����� */ char _n_name[SYMNMLEN]; /* ����� ����� */ struct { long _n_zeroes; /* ���� == 0, �� � ������� ������� */ long _n_offset; /* �������� � ����. ������� */ } _n_n; char *_n_nptr[2]; } _n; long n_value; /* �������� ����� */ short n_scnum; /* ����� ������ */ unsigned short n_type; /* ��� � ����������� ��� */ char n_sclass; /* ����� ������ */ char n_numaux; /* ����� ��������������� ��������� */ }; #define n_name _n._n_name #define n_zeroes _n._n_n._n_zeroes #define n_offset _n._n_n._n_offset #define n_nptr _n._n_nptr[1]
����� �������� ���� ������� �� ���������� ����� <syms.h>. ��� �������� ��������� ���� ��������� ������ ����������, ��� ���������� � ����� ��������; � ����� ������ �� ������ ���������, ����������� ���, ������� ��������������� ��������. ��������������� �������� ����� ��� �� ������, ��� � ��������; �� ������ �������� ����:
union auxent { struct { long x_tagndx; /* ������ ��������� ���������, �� �������� ��� ������������ */ union { struct { unsigned short x_lnno; /* ����� ������ ����������� */ unsigned short x_size; /* ������ �������, ��������� ��� �� �������� */ } x_lnsz; long x_fsize; /* ������ ������� */ } x_misc; union { struct { long x_lnnoptr; long x_endndx; } x_fcn; struct { /* ���� ������, �� ��� ����������� (�� 4) */ unsigned short x_dimen [DIMNUM]; } x_ary; } x_fcnary; unsigned short x_tvndx; } x_sym; struct { char x_fname [FILNMLEN]; /* ��� ����� (�������� ���� �������) */ } x_file; struct { long x_scnlen; /* ����� ������ */ unsigned short x_nreloc; /* ����� ����. � ���. � ��������� ������ */ unsigned short x_nlinno; /* ����� ����. � ���. � ������� ����� */ } x_scn; struct { long x_tvfill; unsigned short x_tvlen; unsigned short x_tvran[2]; } x_tv; };�������� ������� ���� ����������, ������� � 0.
��. �����
a.out(4), linenum(4).
sdb(1) � ����������� ������������.
���������������
�� �����������, � ������� ��� int ������������ ����
long, ������ long � ������� ���� ����������� int. �����
�������, � ������� ����������� ���������� � ���, ��� ��
����� ���� ������� ���: ��� int ��� ��� long.
|