ReactOS  0.4.14-dev-317-g96040ec
stabs.c File Reference
#include "config.h"
#include "wine/port.h"
#include <sys/types.h>
#include <fcntl.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "dbghelp_private.h"
#include "wine/debug.h"
Include dependency graph for stabs.c:

Go to the source code of this file.

Classes

struct  stab_nlist
 
struct  include_def
 
struct  ParseTypedefData
 
struct  ParseTypedefData::PTS_Error
 
struct  pts_range_value
 
struct  pending_loc_var
 
struct  pending_line
 
struct  pending_object
 
struct  pending_list
 

Macros

#define strtoull   _strtoui64
 
#define N_STAB   0xe0
 
#define N_TYPE   0x1e
 
#define N_EXT   0x01
 
#define N_UNDF   0x00
 
#define N_ABS   0x02
 
#define N_GSYM   0x20
 
#define N_FUN   0x24
 
#define N_STSYM   0x26
 
#define N_LCSYM   0x28
 
#define N_MAIN   0x2a
 
#define N_ROSYM   0x2c
 
#define N_BNSYM   0x2e
 
#define N_OPT   0x3c
 
#define N_RSYM   0x40
 
#define N_SLINE   0x44
 
#define N_ENSYM   0x4e
 
#define N_SO   0x64
 
#define N_OSO   0x66
 
#define N_LSYM   0x80
 
#define N_BINCL   0x82
 
#define N_SOL   0x84
 
#define N_PSYM   0xa0
 
#define N_EINCL   0xa2
 
#define N_LBRAC   0xc0
 
#define N_EXCL   0xc2
 
#define N_RBRAC   0xe0
 
#define MAX_INCLUDES   5120
 
#define PTS_DEBUG
 
#define PTS_ABORTIF(ptd, t)   do { if (t) { stabs_pts_push((ptd), __LINE__); return -1;} } while (0)
 

Enumerations

enum  pending_obj_kind { PENDING_VAR, PENDING_LINE }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (dbghelp_stabs)
 
static void stab_strcpy (char *dest, int sz, const char *source)
 
static int stabs_new_include (const char *file, unsigned long val)
 
static int stabs_find_include (const char *file, unsigned long val)
 
static int stabs_add_include (int idx)
 
static void stabs_reset_includes (void)
 
static void stabs_free_includes (void)
 
static struct symt ** stabs_find_ref (long filenr, long subnr)
 
static struct symt ** stabs_read_type_enum (const char **x)
 
static void stabs_pts_push (struct ParseTypedefData *ptd, unsigned line)
 
static int stabs_get_basic (struct ParseTypedefData *ptd, unsigned basic, struct symt **symt)
 
static int stabs_pts_read_type_def (struct ParseTypedefData *ptd, const char *typename, struct symt **dt)
 
static int stabs_pts_read_id (struct ParseTypedefData *ptd)
 
static int stabs_pts_read_number (struct ParseTypedefData *ptd, long *v)
 
static int stabs_pts_read_type_reference (struct ParseTypedefData *ptd, long *filenr, long *subnr)
 
static int stabs_pts_read_range_value (struct ParseTypedefData *ptd, struct pts_range_value *prv)
 
static int stabs_pts_read_range (struct ParseTypedefData *ptd, const char *typename, struct symt **dt)
 
static int stabs_pts_read_method_info (struct ParseTypedefData *ptd)
 
static int stabs_pts_read_aggregate (struct ParseTypedefData *ptd, struct symt_udt *sdt)
 
static int stabs_pts_read_enum (struct ParseTypedefData *ptd, struct symt_enum *edt)
 
static int stabs_pts_read_array (struct ParseTypedefData *ptd, struct symt **adt)
 
static int stabs_parse_typedef (struct module *module, const char *ptr, const char *typename)
 
static struct symtstabs_parse_type (const char *stab)
 
static void pending_make_room (struct pending_list *pending)
 
static void pending_add_var (struct pending_list *pending, const char *name, enum DataKind dt, const struct location *loc)
 
static void pending_add_line (struct pending_list *pending, int source_idx, int line_num, unsigned long offset, unsigned long load_offset)
 
static void pending_flush (struct pending_list *pending, struct module *module, struct symt_function *func, struct symt_block *block)
 
static void stabs_finalize_function (struct module *module, struct symt_function *func, unsigned long size)
 
static void stabbuf_append (char **buf, unsigned *buf_size, const char *str)
 
BOOL stabs_parse (struct module *module, unsigned long load_offset, const void *pv_stab_ptr, int stablen, const char *strs, int strtablen, stabs_def_cb callback, void *user)
 

Variables

static include_definclude_defs = NULL
 
static int num_include_def = 0
 
static int num_alloc_include_def = 0
 
static int cu_include_stack [MAX_INCLUDES]
 
static int cu_include_stk_idx = 0
 
static struct symt ** cu_vector = NULL
 
static int cu_nrofentries = 0
 
static struct symt_basicstabs_basic [36]
 

Macro Definition Documentation

◆ MAX_INCLUDES

#define MAX_INCLUDES   5120

Definition at line 172 of file stabs.c.

◆ N_ABS

#define N_ABS   0x02

Definition at line 91 of file stabs.c.

◆ N_BINCL

#define N_BINCL   0x82

Definition at line 108 of file stabs.c.

◆ N_BNSYM

#define N_BNSYM   0x2e

Definition at line 100 of file stabs.c.

◆ N_EINCL

#define N_EINCL   0xa2

Definition at line 111 of file stabs.c.

◆ N_ENSYM

#define N_ENSYM   0x4e

Definition at line 104 of file stabs.c.

◆ N_EXCL

#define N_EXCL   0xc2

Definition at line 113 of file stabs.c.

◆ N_EXT

#define N_EXT   0x01

Definition at line 83 of file stabs.c.

◆ N_FUN

#define N_FUN   0x24

Definition at line 95 of file stabs.c.

◆ N_GSYM

#define N_GSYM   0x20

Definition at line 94 of file stabs.c.

◆ N_LBRAC

#define N_LBRAC   0xc0

Definition at line 112 of file stabs.c.

◆ N_LCSYM

#define N_LCSYM   0x28

Definition at line 97 of file stabs.c.

◆ N_LSYM

#define N_LSYM   0x80

Definition at line 107 of file stabs.c.

◆ N_MAIN

#define N_MAIN   0x2a

Definition at line 98 of file stabs.c.

◆ N_OPT

#define N_OPT   0x3c

Definition at line 101 of file stabs.c.

◆ N_OSO

#define N_OSO   0x66

Definition at line 106 of file stabs.c.

◆ N_PSYM

#define N_PSYM   0xa0

Definition at line 110 of file stabs.c.

◆ N_RBRAC

#define N_RBRAC   0xe0

Definition at line 114 of file stabs.c.

◆ N_ROSYM

#define N_ROSYM   0x2c

Definition at line 99 of file stabs.c.

◆ N_RSYM

#define N_RSYM   0x40

Definition at line 102 of file stabs.c.

◆ N_SLINE

#define N_SLINE   0x44

Definition at line 103 of file stabs.c.

◆ N_SO

#define N_SO   0x64

Definition at line 105 of file stabs.c.

◆ N_SOL

#define N_SOL   0x84

Definition at line 109 of file stabs.c.

◆ N_STAB

#define N_STAB   0xe0

Definition at line 77 of file stabs.c.

◆ N_STSYM

#define N_STSYM   0x26

Definition at line 96 of file stabs.c.

◆ N_TYPE

#define N_TYPE   0x1e

Definition at line 80 of file stabs.c.

◆ N_UNDF

#define N_UNDF   0x00

Definition at line 88 of file stabs.c.

◆ PTS_ABORTIF

#define PTS_ABORTIF (   ptd,
  t 
)    do { if (t) { stabs_pts_push((ptd), __LINE__); return -1;} } while (0)

Definition at line 356 of file stabs.c.

◆ PTS_DEBUG

#define PTS_DEBUG

Definition at line 331 of file stabs.c.

◆ strtoull

#define strtoull   _strtoui64

Definition at line 72 of file stabs.c.

Enumeration Type Documentation

◆ pending_obj_kind

Enumerator
PENDING_VAR 
PENDING_LINE 

Definition at line 1118 of file stabs.c.

1119 {
1120  PENDING_VAR,
1121  PENDING_LINE,
1122 };

Function Documentation

◆ pending_add_line()

static void pending_add_line ( struct pending_list pending,
int  source_idx,
int  line_num,
unsigned long  offset,
unsigned long  load_offset 
)
inlinestatic

Definition at line 1188 of file stabs.c.

1191 {
1192  pending_make_room(pending);
1193  pending->objs[pending->num].tag = PENDING_LINE;
1194  pending->objs[pending->num].u.line.source_idx = source_idx;
1195  pending->objs[pending->num].u.line.line_num = line_num;
1196  pending->objs[pending->num].u.line.offset = offset;
1197  pending->objs[pending->num].u.line.load_offset = load_offset;
1198  pending->num++;
1199 }
unsigned num
Definition: stabs.c:1152
GLintptr offset
Definition: glext.h:5920
static void pending_make_room(struct pending_list *pending)
Definition: stabs.c:1156
struct pending_object * objs
Definition: stabs.c:1151

Referenced by stabs_parse().

◆ pending_add_var()

static void pending_add_var ( struct pending_list pending,
const char name,
enum DataKind  dt,
const struct location loc 
)
inlinestatic

Definition at line 1175 of file stabs.c.

1177 {
1178  pending_make_room(pending);
1179  pending->objs[pending->num].tag = PENDING_VAR;
1180  stab_strcpy(pending->objs[pending->num].u.var.name,
1181  sizeof(pending->objs[pending->num].u.var.name), name);
1182  pending->objs[pending->num].u.var.type = stabs_parse_type(name);
1183  pending->objs[pending->num].u.var.kind = dt;
1184  pending->objs[pending->num].u.var.loc = *loc;
1185  pending->num++;
1186 }
static void stab_strcpy(char *dest, int sz, const char *source)
Definition: stabs.c:129
unsigned num
Definition: stabs.c:1152
static void pending_make_room(struct pending_list *pending)
Definition: stabs.c:1156
static struct symt * stabs_parse_type(const char *stab)
Definition: stabs.c:1087
struct pending_object * objs
Definition: stabs.c:1151
Definition: name.c:36

Referenced by stabs_parse().

◆ pending_flush()

static void pending_flush ( struct pending_list pending,
struct module module,
struct symt_function func,
struct symt_block block 
)
static

Definition at line 1201 of file stabs.c.

1203 {
1204  unsigned int i;
1205 
1206  for (i = 0; i < pending->num; i++)
1207  {
1208  switch (pending->objs[i].tag)
1209  {
1210  case PENDING_VAR:
1212  pending->objs[i].u.var.kind, &pending->objs[i].u.var.loc,
1213  block, pending->objs[i].u.var.type, pending->objs[i].u.var.name);
1214  break;
1215  case PENDING_LINE:
1216  if (module->type == DMT_MACHO)
1217  pending->objs[i].u.line.offset -= func->address - pending->objs[i].u.line.load_offset;
1218  symt_add_func_line(module, func, pending->objs[i].u.line.source_idx,
1219  pending->objs[i].u.line.line_num, pending->objs[i].u.line.offset);
1220  break;
1221  default:
1222  ERR("Unknown pending object tag %u\n", (unsigned)pending->objs[i].tag);
1223  break;
1224  }
1225  }
1226  pending->num = 0;
1227 }
static unsigned int block
Definition: xmlmemory.c:118
GLenum func
Definition: glext.h:6028
struct symt_data * symt_add_func_local(struct module *module, struct symt_function *func, enum DataKind dt, const struct location *loc, struct symt_block *block, struct symt *type, const char *name) DECLSPEC_HIDDEN
Definition: symbol.c:380
unsigned num
Definition: stabs.c:1152
enum module_type type
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void symt_add_func_line(struct module *module, struct symt_function *func, unsigned source_idx, int line_num, unsigned long offset) DECLSPEC_HIDDEN
Definition: symbol.c:328
struct pending_object * objs
Definition: stabs.c:1151
#define ERR(fmt,...)
Definition: debug.h:109

Referenced by stabs_parse().

◆ pending_make_room()

static void pending_make_room ( struct pending_list pending)
inlinestatic

Definition at line 1156 of file stabs.c.

1157 {
1158  if (pending->num == pending->allocated)
1159  {
1160  if (!pending->objs)
1161  {
1162  pending->allocated = 8;
1163  pending->objs = HeapAlloc(GetProcessHeap(), 0,
1164  pending->allocated * sizeof(pending->objs[0]));
1165  }
1166  else
1167  {
1168  pending->allocated *= 2;
1169  pending->objs = HeapReAlloc(GetProcessHeap(), 0, pending->objs,
1170  pending->allocated * sizeof(pending->objs[0]));
1171  }
1172  }
1173 }
unsigned num
Definition: stabs.c:1152
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
struct pending_object * objs
Definition: stabs.c:1151
unsigned allocated
Definition: stabs.c:1153
#define HeapReAlloc
Definition: compat.h:393

Referenced by pending_add_line(), and pending_add_var().

◆ stab_strcpy()

static void stab_strcpy ( char dest,
int  sz,
const char source 
)
static

Definition at line 129 of file stabs.c.

130 {
131  char* ptr = dest;
132  /*
133  * A strcpy routine that stops when we hit the ':' character.
134  * Faster than copying the whole thing, and then nuking the
135  * ':'.
136  * Takes also care of (valid) a::b constructs
137  */
138  while (*source != '\0')
139  {
140  if (source[0] != ':' && sz-- > 0) *ptr++ = *source++;
141  else if (source[1] == ':' && (sz -= 2) > 0)
142  {
143  *ptr++ = *source++;
144  *ptr++ = *source++;
145  }
146  else break;
147  }
148  *ptr-- = '\0';
149  /* GCC emits, in some cases, a .<digit>+ suffix.
150  * This is used for static variable inside functions, so
151  * that we can have several such variables with same name in
152  * the same compilation unit
153  * We simply ignore that suffix when present (we also get rid
154  * of it in ELF symtab parsing)
155  */
156  if (ptr >= dest && isdigit(*ptr))
157  {
158  while (ptr > dest && isdigit(*ptr)) ptr--;
159  if (*ptr == '.') *ptr = '\0';
160  }
161  assert(sz > 0);
162 }
#define assert(x)
Definition: debug.h:53
static PVOID ptr
Definition: dispmode.c:27
#define isdigit(c)
Definition: acclib.h:68
static char * dest
Definition: rtl.c:135

Referenced by pending_add_var(), and stabs_parse().

◆ stabbuf_append()

static void stabbuf_append ( char **  buf,
unsigned *  buf_size,
const char str 
)
inlinestatic

Definition at line 1260 of file stabs.c.

1261 {
1262  unsigned str_len, buf_len;
1263 
1264  str_len = strlen(str);
1265  buf_len = strlen(*buf);
1266 
1267  if(str_len+buf_len >= *buf_size) {
1268  *buf_size += buf_len + str_len;
1269  *buf = HeapReAlloc(GetProcessHeap(), 0, *buf, *buf_size);
1270  }
1271 
1272  strcpy(*buf+buf_len, str);
1273 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define str_len
Definition: treelist.c:89
const WCHAR * str
#define GetProcessHeap()
Definition: compat.h:395
#define HeapReAlloc
Definition: compat.h:393
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

Referenced by stabs_parse().

◆ stabs_add_include()

static int stabs_add_include ( int  idx)
static

Definition at line 221 of file stabs.c.

222 {
223  if (idx < 0) return -1;
225 
226  /* if this happens, just bump MAX_INCLUDES */
227  /* we could also handle this as another dynarray */
230  return cu_include_stk_idx;
231 }
#define assert(x)
Definition: debug.h:53
unsigned int idx
Definition: utils.c:41
static int cu_include_stack[MAX_INCLUDES]
Definition: stabs.c:177
#define MAX_INCLUDES
Definition: stabs.c:172
static int cu_include_stk_idx
Definition: stabs.c:178

Referenced by stabs_parse().

◆ stabs_finalize_function()

static void stabs_finalize_function ( struct module module,
struct symt_function func,
unsigned long  size 
)
static

Definition at line 1238 of file stabs.c.

1240 {
1241  IMAGEHLP_LINE64 il;
1242  struct location loc;
1243 
1244  if (!func) return;
1246  /* To define the debug-start of the function, we use the second line number.
1247  * Not 100% bullet proof, but better than nothing
1248  */
1249  if (symt_fill_func_line_info(module, func, func->address, &il) &&
1251  {
1252  loc.kind = loc_absolute;
1253  loc.offset = il.Address - func->address;
1255  &loc, NULL);
1256  }
1257  if (size) func->size = size;
1258 }
GLenum func
Definition: glext.h:6028
BOOL symt_fill_func_line_info(const struct module *module, const struct symt_function *func, DWORD64 addr, IMAGEHLP_LINE64 *line) DECLSPEC_HIDDEN
Definition: symbol.c:1488
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
BOOL symt_get_func_line_next(const struct module *module, PIMAGEHLP_LINE64 line) DECLSPEC_HIDDEN
Definition: symbol.c:1730
struct symt_hierarchy_point * symt_add_function_point(struct module *module, struct symt_function *func, enum SymTagEnum point, const struct location *loc, const char *name) DECLSPEC_HIDDEN
Definition: symbol.c:454
BOOL symt_normalize_function(struct module *module, const struct symt_function *func) DECLSPEC_HIDDEN
Definition: symbol.c:475
DWORD64 Address
Definition: compat.h:748

Referenced by stabs_parse().

◆ stabs_find_include()

static int stabs_find_include ( const char file,
unsigned long  val 
)
static

Definition at line 208 of file stabs.c.

209 {
210  int i;
211 
212  for (i = 0; i < num_include_def; i++)
213  {
214  if (val == include_defs[i].value &&
215  strcmp(file, include_defs[i].name) == 0)
216  return i;
217  }
218  return -1;
219 }
static include_def * include_defs
Definition: stabs.c:174
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLuint GLfloat * val
Definition: glext.h:7180
static int num_include_def
Definition: stabs.c:175
Definition: name.c:36
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
Definition: fci.c:126

Referenced by stabs_parse().

◆ stabs_find_ref()

static struct symt** stabs_find_ref ( long  filenr,
long  subnr 
)
static

Definition at line 262 of file stabs.c.

263 {
264  struct symt** ret;
265 
266  /* FIXME: I could perhaps create a dummy include_def for each compilation
267  * unit which would allow not to handle those two cases separately
268  */
269  if (filenr == 0)
270  {
271  if (cu_nrofentries <= subnr)
272  {
273  cu_nrofentries = max( cu_nrofentries * 2, subnr + 1 );
274  if (!cu_vector)
276  sizeof(cu_vector[0]) * cu_nrofentries);
277  else
279  cu_vector, sizeof(cu_vector[0]) * cu_nrofentries);
280  }
281  ret = &cu_vector[subnr];
282  }
283  else
284  {
285  include_def* idef;
286 
287  assert(filenr <= cu_include_stk_idx);
288  idef = &include_defs[cu_include_stack[filenr]];
289 
290  if (idef->nrofentries <= subnr)
291  {
292  idef->nrofentries = max( idef->nrofentries * 2, subnr + 1 );
293  if (!idef->vector)
295  sizeof(idef->vector[0]) * idef->nrofentries);
296  else
298  idef->vector, sizeof(idef->vector[0]) * idef->nrofentries);
299  }
300  ret = &idef->vector[subnr];
301  }
302  TRACE("(%ld,%ld) => %p (%p)\n", filenr, subnr, ret, *ret);
303  return ret;
304 }
#define max(a, b)
Definition: svc.c:63
#define assert(x)
Definition: debug.h:53
static include_def * include_defs
Definition: stabs.c:174
struct symt ** vector
Definition: stabs.c:168
int nrofentries
Definition: stabs.c:169
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static int cu_nrofentries
Definition: stabs.c:180
int ret
static int cu_include_stack[MAX_INCLUDES]
Definition: stabs.c:177
#define HeapReAlloc
Definition: compat.h:393
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static int cu_include_stk_idx
Definition: stabs.c:178
static struct symt ** cu_vector
Definition: stabs.c:179

Referenced by stabs_pts_read_type_def(), and stabs_read_type_enum().

◆ stabs_free_includes()

static void stabs_free_includes ( void  )
static

Definition at line 243 of file stabs.c.

244 {
245  int i;
246 
248  for (i = 0; i < num_include_def; i++)
249  {
252  }
254  include_defs = NULL;
255  num_include_def = 0;
258  cu_vector = NULL;
259  cu_nrofentries = 0;
260 }
static int num_alloc_include_def
Definition: stabs.c:176
static include_def * include_defs
Definition: stabs.c:174
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
static int num_include_def
Definition: stabs.c:175
static int cu_nrofentries
Definition: stabs.c:180
static void stabs_reset_includes(void)
Definition: stabs.c:233
Definition: name.c:36
static struct symt ** cu_vector
Definition: stabs.c:179
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by stabs_parse().

◆ stabs_get_basic()

static int stabs_get_basic ( struct ParseTypedefData ptd,
unsigned  basic,
struct symt **  symt 
)
static

Definition at line 361 of file stabs.c.

362 {
363  PTS_ABORTIF(ptd, basic >= sizeof(stabs_basic) / sizeof(stabs_basic[0]));
364 
365  if (!stabs_basic[basic])
366  {
367  switch (basic)
368  {
369  case 1: stabs_basic[basic] = symt_new_basic(ptd->module, btInt, "int", 4); break;
370  case 2: stabs_basic[basic] = symt_new_basic(ptd->module, btChar, "char", 1); break;
371  case 3: stabs_basic[basic] = symt_new_basic(ptd->module, btInt, "short int", 2); break;
372  case 4: stabs_basic[basic] = symt_new_basic(ptd->module, btInt, "long int", 4); break;
373  case 5: stabs_basic[basic] = symt_new_basic(ptd->module, btUInt, "unsigned char", 1); break;
374  case 6: stabs_basic[basic] = symt_new_basic(ptd->module, btInt, "signed char", 1); break;
375  case 7: stabs_basic[basic] = symt_new_basic(ptd->module, btUInt, "unsigned short int", 2); break;
376  case 8: stabs_basic[basic] = symt_new_basic(ptd->module, btUInt, "unsigned int", 4); break;
377  case 9: stabs_basic[basic] = symt_new_basic(ptd->module, btUInt, "unsigned", 2); break;
378  case 10: stabs_basic[basic] = symt_new_basic(ptd->module, btUInt, "unsigned long int", 2); break;
379  case 11: stabs_basic[basic] = symt_new_basic(ptd->module, btVoid, "void", 0); break;
380  case 12: stabs_basic[basic] = symt_new_basic(ptd->module, btFloat, "float", 4); break;
381  case 13: stabs_basic[basic] = symt_new_basic(ptd->module, btFloat, "double", 8); break;
382  case 14: stabs_basic[basic] = symt_new_basic(ptd->module, btFloat, "long double", 12); break;
383  case 15: stabs_basic[basic] = symt_new_basic(ptd->module, btInt, "integer", 4); break;
384  case 16: stabs_basic[basic] = symt_new_basic(ptd->module, btBool, "bool", 1); break;
385  /* case 17: short real */
386  /* case 18: real */
387  case 25: stabs_basic[basic] = symt_new_basic(ptd->module, btComplex, "float complex", 8); break;
388  case 26: stabs_basic[basic] = symt_new_basic(ptd->module, btComplex, "double complex", 16); break;
389  case 30: stabs_basic[basic] = symt_new_basic(ptd->module, btWChar, "wchar_t", 2); break;
390  case 31: stabs_basic[basic] = symt_new_basic(ptd->module, btInt, "long long int", 8); break;
391  case 32: stabs_basic[basic] = symt_new_basic(ptd->module, btUInt, "long long unsigned", 8); break;
392  /* starting at 35 are wine extensions (especially for R implementation) */
393  case 35: stabs_basic[basic] = symt_new_basic(ptd->module, btComplex, "long double complex", 24); break;
394  default: PTS_ABORTIF(ptd, 1);
395  }
396  }
397  *symt = &stabs_basic[basic]->symt;
398  return 0;
399 }
struct module * module
Definition: stabs.c:337
#define PTS_ABORTIF(ptd, t)
Definition: stabs.c:356
struct symt_basic * symt_new_basic(struct module *module, enum BasicType, const char *typename, unsigned size) DECLSPEC_HIDDEN
Definition: type.c:193
static struct symt_basic * stabs_basic[36]
Definition: stabs.c:181
Definition: compat.h:1262

Referenced by stabs_pts_read_type_def().

◆ stabs_new_include()

static int stabs_new_include ( const char file,
unsigned long  val 
)
static

Definition at line 183 of file stabs.c.

184 {
186  {
187  if (!include_defs)
188  {
189  num_alloc_include_def = 256;
191  sizeof(include_defs[0]) * num_alloc_include_def);
192  }
193  else
194  {
197  sizeof(include_defs[0]) * num_alloc_include_def);
198  }
199  }
204 
205  return num_include_def++;
206 }
static int num_alloc_include_def
Definition: stabs.c:176
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static include_def * include_defs
Definition: stabs.c:174
unsigned long value
Definition: stabs.c:167
struct symt ** vector
Definition: stabs.c:168
smooth NULL
Definition: ftsmooth.c:416
int nrofentries
Definition: stabs.c:169
GLuint GLfloat * val
Definition: glext.h:7180
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static int num_include_def
Definition: stabs.c:175
#define HeapReAlloc
Definition: compat.h:393
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
char * name
Definition: stabs.c:166
Definition: fci.c:126

Referenced by stabs_parse().

◆ stabs_parse()

BOOL stabs_parse ( struct module module,
unsigned long  load_offset,
const void pv_stab_ptr,
int  stablen,
const char strs,
int  strtablen,
stabs_def_cb  callback,
void user 
)

Definition at line 1275 of file stabs.c.

1279 {
1280  struct symt_function* curr_func = NULL;
1281  struct symt_block* block = NULL;
1282  struct symt_compiland* compiland = NULL;
1283  char* srcpath = NULL;
1284  int i;
1285  int nstab;
1286  const char* ptr;
1287  char* stabbuff;
1288  unsigned int stabbufflen;
1289  const struct stab_nlist* stab_ptr = pv_stab_ptr;
1290  const char* strs_end;
1291  int strtabinc;
1292  char symname[4096];
1293  unsigned incl[32];
1294  int incl_stk = -1;
1295  int source_idx = -1;
1296  struct pending_list pending_block;
1297  struct pending_list pending_func;
1298  BOOL ret = TRUE;
1299  struct location loc;
1300  unsigned char type;
1301 
1302  nstab = stablen / sizeof(struct stab_nlist);
1303  strs_end = strs + strtablen;
1304 
1305  memset(stabs_basic, 0, sizeof(stabs_basic));
1306  memset(&pending_block, 0, sizeof(pending_block));
1307  memset(&pending_func, 0, sizeof(pending_func));
1308 
1309  /*
1310  * Allocate a buffer into which we can build stab strings for cases
1311  * where the stab is continued over multiple lines.
1312  */
1313  stabbufflen = 65536;
1314  stabbuff = HeapAlloc(GetProcessHeap(), 0, stabbufflen);
1315 
1316  strtabinc = 0;
1317  stabbuff[0] = '\0';
1318  for (i = 0; i < nstab; i++, stab_ptr++)
1319  {
1320  ptr = strs + stab_ptr->n_strx;
1321  if ((ptr > strs_end) || (ptr + strlen(ptr) > strs_end))
1322  {
1323  WARN("Bad stabs string %p\n", ptr);
1324  continue;
1325  }
1326  if (*ptr != '\0' && (ptr[strlen(ptr) - 1] == '\\'))
1327  {
1328  /*
1329  * Indicates continuation. Append this to the buffer, and go onto the
1330  * next record. Repeat the process until we find a stab without the
1331  * '/' character, as this indicates we have the whole thing.
1332  */
1333  stabbuf_append(&stabbuff, &stabbufflen, ptr);
1334  continue;
1335  }
1336  else if (stabbuff[0] != '\0')
1337  {
1338  stabbuf_append(&stabbuff, &stabbufflen, ptr);
1339  ptr = stabbuff;
1340  }
1341 
1342  if (stab_ptr->n_type & N_STAB)
1343  type = stab_ptr->n_type;
1344  else
1345  type = (stab_ptr->n_type & N_TYPE);
1346 
1347  /* only symbol entries contain a typedef */
1348  switch (type)
1349  {
1350  case N_GSYM:
1351  case N_LCSYM:
1352  case N_STSYM:
1353  case N_RSYM:
1354  case N_LSYM:
1355  case N_ROSYM:
1356  case N_PSYM:
1357  if (strchr(ptr, '=') != NULL)
1358  {
1359  /*
1360  * The stabs aren't in writable memory, so copy it over so we are
1361  * sure we can scribble on it.
1362  */
1363  if (ptr != stabbuff)
1364  {
1365  stabbuff[0] = 0;
1366  stabbuf_append(&stabbuff, &stabbufflen, ptr);
1367  ptr = stabbuff;
1368  }
1369  stab_strcpy(symname, sizeof(symname), ptr);
1370  if (!stabs_parse_typedef(module, ptr, symname))
1371  {
1372  /* skip this definition */
1373  stabbuff[0] = '\0';
1374  continue;
1375  }
1376  }
1377  }
1378 
1379  switch (type)
1380  {
1381  case N_GSYM:
1382  /*
1383  * These are useless with ELF. They have no value, and you have to
1384  * read the normal symbol table to get the address. Thus we
1385  * ignore them, and when we process the normal symbol table
1386  * we should do the right thing.
1387  *
1388  * With a.out or mingw, they actually do make some amount of sense.
1389  */
1390  stab_strcpy(symname, sizeof(symname), ptr);
1391  loc.kind = loc_absolute;
1392  loc.reg = 0;
1393  loc.offset = load_offset + stab_ptr->n_value;
1394  symt_new_global_variable(module, compiland, symname, TRUE /* FIXME */,
1395  loc, 0, stabs_parse_type(ptr));
1396  break;
1397  case N_LCSYM:
1398  case N_STSYM:
1399  /* These are static symbols and BSS symbols. */
1400  stab_strcpy(symname, sizeof(symname), ptr);
1401  loc.kind = loc_absolute;
1402  loc.reg = 0;
1403  loc.offset = load_offset + stab_ptr->n_value;
1404  symt_new_global_variable(module, compiland, symname, TRUE /* FIXME */,
1405  loc, 0, stabs_parse_type(ptr));
1406  break;
1407  case N_LBRAC:
1408  if (curr_func)
1409  {
1410  block = symt_open_func_block(module, curr_func, block,
1411  stab_ptr->n_value, 0);
1412  pending_flush(&pending_block, module, curr_func, block);
1413  }
1414  break;
1415  case N_RBRAC:
1416  if (curr_func)
1417  block = symt_close_func_block(module, curr_func, block,
1418  stab_ptr->n_value);
1419  break;
1420  case N_PSYM:
1421  /* These are function parameters. */
1422  if (curr_func != NULL)
1423  {
1424  struct symt* param_type = stabs_parse_type(ptr);
1425  stab_strcpy(symname, sizeof(symname), ptr);
1426  loc.kind = loc_regrel;
1427  loc.reg = dbghelp_current_cpu->frame_regno;
1428  loc.offset = stab_ptr->n_value;
1429  symt_add_func_local(module, curr_func,
1430  (int)stab_ptr->n_value >= 0 ? DataIsParam : DataIsLocal,
1431  &loc, NULL, param_type, symname);
1433  (struct symt_function_signature*)curr_func->type,
1434  param_type);
1435  }
1436  break;
1437  case N_RSYM:
1438  /* These are registers (as local variables) */
1439  if (curr_func != NULL)
1440  {
1441  loc.kind = loc_register;
1442  loc.offset = 0;
1443 
1444  switch (stab_ptr->n_value)
1445  {
1446  case 0: loc.reg = CV_REG_EAX; break;
1447  case 1: loc.reg = CV_REG_ECX; break;
1448  case 2: loc.reg = CV_REG_EDX; break;
1449  case 3: loc.reg = CV_REG_EBX; break;
1450  case 4: loc.reg = CV_REG_ESP; break;
1451  case 5: loc.reg = CV_REG_EBP; break;
1452  case 6: loc.reg = CV_REG_ESI; break;
1453  case 7: loc.reg = CV_REG_EDI; break;
1454  case 11:
1455  case 12:
1456  case 13:
1457  case 14:
1458  case 15:
1459  case 16:
1460  case 17:
1461  case 18:
1462  case 19: loc.reg = CV_REG_ST0 + stab_ptr->n_value - 12; break;
1463  case 21:
1464  case 22:
1465  case 23:
1466  case 24:
1467  case 25:
1468  case 26:
1469  case 27:
1470  case 28: loc.reg = CV_REG_XMM0 + stab_ptr->n_value - 21; break;
1471  case 29:
1472  case 30:
1473  case 31:
1474  case 32:
1475  case 33:
1476  case 34:
1477  case 35:
1478  case 36: loc.reg = CV_REG_MM0 + stab_ptr->n_value - 29; break;
1479  default:
1480  FIXME("Unknown register value (%lu)\n", (unsigned long)stab_ptr->n_value);
1481  loc.reg = CV_REG_NONE;
1482  break;
1483  }
1484  stab_strcpy(symname, sizeof(symname), ptr);
1485  if (ptr[strlen(symname) + 1] == 'P')
1486  {
1487  struct symt* param_type = stabs_parse_type(ptr);
1488  stab_strcpy(symname, sizeof(symname), ptr);
1489  symt_add_func_local(module, curr_func, DataIsParam, &loc,
1490  NULL, param_type, symname);
1492  (struct symt_function_signature*)curr_func->type,
1493  param_type);
1494  }
1495  else
1496  pending_add_var(&pending_block, ptr, DataIsLocal, &loc);
1497  }
1498  break;
1499  case N_LSYM:
1500  /* These are local variables */
1501  loc.kind = loc_regrel;
1502  loc.reg = dbghelp_current_cpu->frame_regno;
1503  loc.offset = stab_ptr->n_value;
1504  if (curr_func != NULL) pending_add_var(&pending_block, ptr, DataIsLocal, &loc);
1505  break;
1506  case N_SLINE:
1507  /*
1508  * This is a line number. These are always relative to the start
1509  * of the function (N_FUN), and this makes the lookup easier.
1510  */
1511  assert(source_idx >= 0);
1512  if (curr_func != NULL)
1513  {
1514  unsigned long offset = stab_ptr->n_value;
1515  if (module->type == DMT_MACHO)
1516  offset -= curr_func->address - load_offset;
1517  symt_add_func_line(module, curr_func, source_idx,
1518  stab_ptr->n_desc, offset);
1519  }
1520  else pending_add_line(&pending_func, source_idx, stab_ptr->n_desc,
1521  stab_ptr->n_value, load_offset);
1522  break;
1523  case N_FUN:
1524  /*
1525  * For now, just declare the various functions. Later
1526  * on, we will add the line number information and the
1527  * local symbols.
1528  */
1529  /*
1530  * Copy the string to a temp buffer so we
1531  * can kill everything after the ':'. We do
1532  * it this way because otherwise we end up dirtying
1533  * all of the pages related to the stabs, and that
1534  * sucks up swap space like crazy.
1535  */
1536  stab_strcpy(symname, sizeof(symname), ptr);
1537  if (*symname)
1538  {
1539  struct symt_function_signature* func_type;
1540 
1541  if (curr_func)
1542  {
1543  /* First, clean up the previous function we were working on.
1544  * Assume size of the func is the delta between current offset
1545  * and offset of last function
1546  */
1547  stabs_finalize_function(module, curr_func,
1548  stab_ptr->n_value ?
1549  (load_offset + stab_ptr->n_value - curr_func->address) : 0);
1550  }
1551  func_type = symt_new_function_signature(module,
1552  stabs_parse_type(ptr), -1);
1553  curr_func = symt_new_function(module, compiland, symname,
1554  load_offset + stab_ptr->n_value, 0,
1555  &func_type->symt);
1556  pending_flush(&pending_func, module, curr_func, NULL);
1557  }
1558  else
1559  {
1560  /* some versions of GCC to use a N_FUN "" to mark the end of a function
1561  * and n_value contains the size of the func
1562  */
1563  stabs_finalize_function(module, curr_func, stab_ptr->n_value);
1564  curr_func = NULL;
1565  }
1566  break;
1567  case N_SO:
1568  /*
1569  * This indicates a new source file. Append the records
1570  * together, to build the correct path name.
1571  */
1572  if (*ptr == '\0') /* end of N_SO file */
1573  {
1574  /* Nuke old path. */
1575  HeapFree(GetProcessHeap(), 0, srcpath);
1576  srcpath = NULL;
1577  stabs_finalize_function(module, curr_func, 0);
1578  curr_func = NULL;
1579  source_idx = -1;
1580  incl_stk = -1;
1581  assert(block == NULL);
1582  compiland = NULL;
1583  }
1584  else
1585  {
1586  int len = strlen(ptr);
1587  if (ptr[len-1] != '/')
1588  {
1590  source_idx = source_new(module, srcpath, ptr);
1591  compiland = symt_new_compiland(module, 0 /* FIXME */, source_idx);
1592  }
1593  else
1594  {
1595  srcpath = HeapAlloc(GetProcessHeap(), 0, len + 1);
1596  strcpy(srcpath, ptr);
1597  }
1598  }
1599  break;
1600  case N_SOL:
1601  source_idx = source_new(module, srcpath, ptr);
1602  break;
1603  case N_UNDF:
1604  strs += strtabinc;
1605  strtabinc = stab_ptr->n_value;
1606  /* I'm not sure this is needed, so trace it before we obsolete it */
1607  if (curr_func)
1608  {
1609  FIXME("UNDF: curr_func %s\n", curr_func->hash_elt.name);
1610  stabs_finalize_function(module, curr_func, 0); /* FIXME */
1611  curr_func = NULL;
1612  }
1613  break;
1614  case N_OPT:
1615  /* Ignore this. We don't care what it points to. */
1616  break;
1617  case N_BINCL:
1619  assert(incl_stk < (int)(sizeof(incl) / sizeof(incl[0])) - 1);
1620  incl[++incl_stk] = source_idx;
1621  source_idx = source_new(module, NULL, ptr);
1622  break;
1623  case N_EINCL:
1624  assert(incl_stk >= 0);
1625  source_idx = incl[incl_stk--];
1626  break;
1627  case N_EXCL:
1628  if (stabs_add_include(stabs_find_include(ptr, stab_ptr->n_value)) < 0)
1629  {
1630  ERR("Excluded header not found (%s,%ld)\n", ptr, (unsigned long)stab_ptr->n_value);
1632  ret = FALSE;
1633  goto done;
1634  }
1635  break;
1636  case N_MAIN:
1637  /* Always ignore these. GCC doesn't even generate them. */
1638  break;
1639  case N_BNSYM:
1640  case N_ENSYM:
1641  case N_OSO:
1642  /* Always ignore these, they seem to be used only on Darwin. */
1643  break;
1644  case N_ABS:
1645 #ifdef N_SECT
1646  case N_SECT:
1647 #endif
1648  /* FIXME: Other definition types (N_TEXT, N_DATA, N_BSS, ...)? */
1649  if (callback)
1650  {
1651  BOOL is_public = (stab_ptr->n_type & N_EXT);
1652  BOOL is_global = is_public;
1653 
1654 #ifdef N_PEXT
1655  /* "private extern"; shared among compilation units in a shared
1656  * library, but not accessible from outside the library. */
1657  if (stab_ptr->n_type & N_PEXT)
1658  {
1659  is_public = FALSE;
1660  is_global = TRUE;
1661  }
1662 #endif
1663 
1664  if (*ptr == '_') ptr++;
1665  stab_strcpy(symname, sizeof(symname), ptr);
1666 
1667  callback(module, load_offset, symname, stab_ptr->n_value,
1668  is_public, is_global, stab_ptr->n_other, compiland, user);
1669  }
1670  break;
1671  default:
1672  ERR("Unknown stab type 0x%02x\n", type);
1673  break;
1674  }
1675  stabbuff[0] = '\0';
1676  TRACE("0x%02x %lx %s\n",
1677  stab_ptr->n_type, (unsigned long)stab_ptr->n_value, debugstr_a(strs + stab_ptr->n_strx));
1678  }
1680  module->module.CVSig = 'S' | ('T' << 8) | ('A' << 16) | ('B' << 24);
1681  /* FIXME: we could have a finer grain here */
1687 done:
1688  HeapFree(GetProcessHeap(), 0, stabbuff);
1690  HeapFree(GetProcessHeap(), 0, pending_block.objs);
1691  HeapFree(GetProcessHeap(), 0, pending_func.objs);
1692  HeapFree(GetProcessHeap(), 0, srcpath);
1693 
1694  return ret;
1695 }
static unsigned int block
Definition: xmlmemory.c:118
static void stab_strcpy(char *dest, int sz, const char *source)
Definition: stabs.c:129
#define TRUE
Definition: types.h:120
struct symt_block * symt_open_func_block(struct module *module, struct symt_function *func, struct symt_block *block, unsigned pc, unsigned len) DECLSPEC_HIDDEN
Definition: symbol.c:415
#define N_BINCL
Definition: stabs.c:108
static void stabs_finalize_function(struct module *module, struct symt_function *func, unsigned long size)
Definition: stabs.c:1238
Definition: compat.h:712
struct cpu * dbghelp_current_cpu
Definition: dbghelp.c:150
struct symt_data * symt_add_func_local(struct module *module, struct symt_function *func, enum DataKind dt, const struct location *loc, struct symt_block *block, struct symt *type, const char *name) DECLSPEC_HIDDEN
Definition: symbol.c:380
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void pending_flush(struct pending_list *pending, struct module *module, struct symt_function *func, struct symt_block *block)
Definition: stabs.c:1201
#define WARN(fmt,...)
Definition: debug.h:111
static void stabbuf_append(char **buf, unsigned *buf_size, const char *str)
Definition: stabs.c:1260
#define N_GSYM
Definition: stabs.c:94
GLintptr offset
Definition: glext.h:5920
static int stabs_new_include(const char *file, unsigned long val)
Definition: stabs.c:183
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define assert(x)
Definition: debug.h:53
static void pending_add_line(struct pending_list *pending, int source_idx, int line_num, unsigned long offset, unsigned long load_offset)
Definition: stabs.c:1188
#define N_ROSYM
Definition: stabs.c:99
struct symt_compiland * symt_new_compiland(struct module *module, unsigned long address, unsigned src_idx) DECLSPEC_HIDDEN
Definition: symbol.c:209
char n_other
Definition: stabs.c:120
#define N_FUN
Definition: stabs.c:95
#define N_PSYM
Definition: stabs.c:110
enum module_type type
#define N_SOL
Definition: stabs.c:109
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void module_reset_debug_info(struct module *module) DECLSPEC_HIDDEN
Definition: module.c:1122
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:110
BOOL symt_add_function_signature_parameter(struct module *module, struct symt_function_signature *sig, struct symt *param) DECLSPEC_HIDDEN
Definition: type.c:395
static PVOID ptr
Definition: dispmode.c:27
#define N_EINCL
Definition: stabs.c:111
void symt_add_func_line(struct module *module, struct symt_function *func, unsigned source_idx, int line_num, unsigned long offset) DECLSPEC_HIDDEN
Definition: symbol.c:328
smooth NULL
Definition: ftsmooth.c:416
static struct symt * stabs_parse_type(const char *stab)
Definition: stabs.c:1087
#define N_LSYM
Definition: stabs.c:107
#define N_EXCL
Definition: stabs.c:113
#define N_UNDF
Definition: stabs.c:88
struct symt_data * symt_new_global_variable(struct module *module, struct symt_compiland *parent, const char *name, unsigned is_static, struct location loc, unsigned long size, struct symt *type) DECLSPEC_HIDDEN
Definition: symbol.c:258
#define N_STSYM
Definition: stabs.c:96
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
#define TRACE(s)
Definition: solgame.cpp:4
#define N_RBRAC
Definition: stabs.c:114
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define N_MAIN
Definition: stabs.c:98
#define N_TYPE
Definition: stabs.c:80
#define debugstr_a
Definition: kernel32.h:31
#define N_SLINE
Definition: stabs.c:103
struct symt * type
static int stabs_parse_typedef(struct module *module, const char *ptr, const char *typename)
Definition: stabs.c:1034
int ret
SYM_TYPE SymType
Definition: compat.h:724
#define N_RSYM
Definition: stabs.c:102
#define N_LCSYM
Definition: stabs.c:97
unsigned char n_type
Definition: stabs.c:119
static void stabs_free_includes(void)
Definition: stabs.c:243
#define N_OSO
Definition: stabs.c:106
GLenum GLsizei len
Definition: glext.h:6722
static struct symt_basic * stabs_basic[36]
Definition: stabs.c:181
static void pending_add_var(struct pending_list *pending, const char *name, enum DataKind dt, const struct location *loc)
Definition: stabs.c:1175
#define ERR(fmt,...)
Definition: debug.h:109
#define N_ENSYM
Definition: stabs.c:104
#define N_BNSYM
Definition: stabs.c:100
#define N_EXT
Definition: stabs.c:83
#define N_SO
Definition: stabs.c:105
#define N_OPT
Definition: stabs.c:101
struct symt_function * symt_new_function(struct module *module, struct symt_compiland *parent, const char *name, unsigned long addr, unsigned long size, struct symt *type) DECLSPEC_HIDDEN
Definition: symbol.c:295
#define N_ABS
Definition: stabs.c:91
struct symt_function_signature * symt_new_function_signature(struct module *module, struct symt *ret_type, enum CV_call_e call_conv) DECLSPEC_HIDDEN
Definition: type.c:378
unsigned n_strx
Definition: stabs.c:118
char * strchr(const char *String, int ch)
Definition: utclib.c:501
unsigned long address
unsigned source_new(struct module *module, const char *basedir, const char *source) DECLSPEC_HIDDEN
Definition: source.c:67
static void stabs_reset_includes(void)
Definition: stabs.c:233
unsigned n_value
Definition: stabs.c:125
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define N_STAB
Definition: stabs.c:77
static int stabs_add_include(int idx)
Definition: stabs.c:221
short n_desc
Definition: stabs.c:121
#define memset(x, y, z)
Definition: compat.h:39
IMAGEHLP_MODULEW64 module
void user(int argc, const char *argv[])
Definition: cmds.c:1350
struct symt_block * symt_close_func_block(struct module *module, const struct symt_function *func, struct symt_block *block, unsigned pc) DECLSPEC_HIDDEN
Definition: symbol.c:442
#define HeapFree(x, y, z)
Definition: compat.h:394
#define N_LBRAC
Definition: stabs.c:112
struct hash_table_elt hash_elt
static int stabs_find_include(const char *file, unsigned long val)
Definition: stabs.c:208

Referenced by pe_load_stabs().

◆ stabs_parse_type()

static struct symt* stabs_parse_type ( const char stab)
static

Definition at line 1087 of file stabs.c.

1088 {
1089  const char* c = stab - 1;
1090 
1091  /*
1092  * Look through the stab definition, and figure out what struct symt
1093  * this represents. If we have something we know about, assign the
1094  * type.
1095  * According to "The \"stabs\" debug format" (Rev 2.130) the name may be
1096  * a C++ name and contain double colons e.g. foo::bar::baz:t5=*6.
1097  */
1098  do
1099  {
1100  if ((c = strchr(c + 1, ':')) == NULL) return NULL;
1101  } while (*++c == ':');
1102 
1103  /*
1104  * The next characters say more about the type (i.e. data, function, etc)
1105  * of symbol. Skip them. (C++ for example may have Tt).
1106  * Actually this is a very weak description; I think Tt is the only
1107  * multiple combination we should see.
1108  */
1109  while (*c && *c != '(' && !isdigit(*c))
1110  c++;
1111  /*
1112  * The next is either an integer or a (integer,integer).
1113  * The stabs_read_type_enum() takes care that stab_types is large enough.
1114  */
1115  return *stabs_read_type_enum(&c);
1116 }
static struct symt ** stabs_read_type_enum(const char **x)
Definition: stabs.c:306
smooth NULL
Definition: ftsmooth.c:416
#define isdigit(c)
Definition: acclib.h:68
const GLubyte * c
Definition: glext.h:8905
char * strchr(const char *String, int ch)
Definition: utclib.c:501

Referenced by pending_add_var(), and stabs_parse().

◆ stabs_parse_typedef()

static int stabs_parse_typedef ( struct module module,
const char ptr,
const char typename 
)
static

Definition at line 1034 of file stabs.c.

1036 {
1037  struct ParseTypedefData ptd;
1038  struct symt* dt;
1039  int ret = -1;
1040 
1041  /* check for already existing definition */
1042 
1043  TRACE("%s => %s\n", typename, debugstr_a(ptr));
1044  ptd.module = module;
1045  ptd.idx = 0;
1046 #ifdef PTS_DEBUG
1047  ptd.err_idx = 0;
1048 #endif
1049  for (ptd.ptr = ptr - 1; ;)
1050  {
1051  ptd.ptr = strchr(ptd.ptr + 1, ':');
1052  if (ptd.ptr == NULL || *++ptd.ptr != ':') break;
1053  }
1054  if (ptd.ptr)
1055  {
1056  if (*ptd.ptr != '(') ptd.ptr++;
1057  /* most of type definitions take one char, except Tt */
1058  if (*ptd.ptr != '(') ptd.ptr++;
1059  ret = stabs_pts_read_type_def(&ptd, typename, &dt);
1060  }
1061 
1062  if (ret == -1 || *ptd.ptr)
1063  {
1064 #ifdef PTS_DEBUG
1065  int i;
1066  TRACE("Failure on %s\n", debugstr_a(ptr));
1067  if (ret == -1)
1068  {
1069  for (i = 0; i < ptd.err_idx; i++)
1070  {
1071  TRACE("[%d]: line %d => %s\n",
1072  i, ptd.errors[i].line, debugstr_a(ptd.errors[i].ptr));
1073  }
1074  }
1075  else
1076  TRACE("[0]: => %s\n", debugstr_a(ptd.ptr));
1077 
1078 #else
1079  ERR("Failure on %s at %s\n", debugstr_a(ptr), debugstr_a(ptd.ptr));
1080 #endif
1081  return FALSE;
1082  }
1083 
1084  return TRUE;
1085 }
#define TRUE
Definition: types.h:120
HMODULE module
Definition: main.cpp:47
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static int stabs_pts_read_type_def(struct ParseTypedefData *ptd, const char *typename, struct symt **dt)
Definition: stabs.c:816
#define debugstr_a
Definition: kernel32.h:31
int ret
#define ERR(fmt,...)
Definition: debug.h:109
char * strchr(const char *String, int ch)
Definition: utclib.c:501

Referenced by stabs_parse().

◆ stabs_pts_push()

static void stabs_pts_push ( struct ParseTypedefData ptd,
unsigned  line 
)
static

Definition at line 349 of file stabs.c.

350 {
351  assert(ptd->err_idx < sizeof(ptd->errors) / sizeof(ptd->errors[0]));
352  ptd->errors[ptd->err_idx].line = line;
353  ptd->errors[ptd->err_idx].ptr = ptd->ptr;
354  ptd->err_idx++;
355 }
#define assert(x)
Definition: debug.h:53
const char * ptr
Definition: stabs.c:334
char line[200]
Definition: main.c:97
struct ParseTypedefData::PTS_Error errors[16]

◆ stabs_pts_read_aggregate()

static int stabs_pts_read_aggregate ( struct ParseTypedefData ptd,
struct symt_udt sdt 
)
inlinestatic

Definition at line 631 of file stabs.c.

633 {
634  long sz, ofs;
635  struct symt* adt;
636  struct symt* dt = NULL;
637  int idx;
638  int doadd;
639 
640  PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, &sz) == -1);
641 
642  doadd = symt_set_udt_size(ptd->module, sdt, sz);
643  if (*ptd->ptr == '!') /* C++ inheritance */
644  {
645  long num_classes;
646 
647  ptd->ptr++;
648  PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, &num_classes) == -1);
649  PTS_ABORTIF(ptd, *ptd->ptr++ != ',');
650  while (--num_classes >= 0)
651  {
652  ptd->ptr += 2; /* skip visibility and inheritance */
653  PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, &ofs) == -1);
654  PTS_ABORTIF(ptd, *ptd->ptr++ != ',');
655 
656  PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, NULL, &adt) == -1);
657 
658  if (doadd && adt)
659  {
660  char tmp[256];
661  DWORD64 size;
662 
663  strcpy(tmp, "__inherited_class_");
664  strcat(tmp, symt_get_name(adt));
665 
666  /* FIXME: TI_GET_LENGTH will not always work, especially when adt
667  * has just been seen as a forward definition and not the real stuff
668  * yet.
669  * As we don't use much the size of members in structs, this may not
670  * be much of a problem
671  */
672  symt_get_info(ptd->module, adt, TI_GET_LENGTH, &size);
673  symt_add_udt_element(ptd->module, sdt, tmp, adt, ofs, (DWORD)size * 8);
674  }
675  PTS_ABORTIF(ptd, *ptd->ptr++ != ';');
676  }
677 
678  }
679  /* if the structure has already been filled, just redo the parsing
680  * but don't store results into the struct
681  * FIXME: there's a quite ugly memory leak in there...
682  */
683 
684  /* Now parse the individual elements of the structure/union. */
685  while (*ptd->ptr != ';')
686  {
687  /* agg_name : type ',' <int:offset> ',' <int:size> */
688  idx = ptd->idx;
689 
690  if (ptd->ptr[0] == '$' && ptd->ptr[1] == 'v')
691  {
692  long x;
693 
694  if (ptd->ptr[2] == 'f')
695  {
696  /* C++ virtual method table */
697  ptd->ptr += 3;
698  stabs_read_type_enum(&ptd->ptr);
699  PTS_ABORTIF(ptd, *ptd->ptr++ != ':');
700  PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, NULL, &dt) == -1);
701  PTS_ABORTIF(ptd, *ptd->ptr++ != ',');
702  PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, &x) == -1);
703  PTS_ABORTIF(ptd, *ptd->ptr++ != ';');
704  ptd->idx = idx;
705  continue;
706  }
707  else if (ptd->ptr[2] == 'b')
708  {
709  ptd->ptr += 3;
710  PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, NULL, &dt) == -1);
711  PTS_ABORTIF(ptd, *ptd->ptr++ != ':');
712  PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, NULL, &dt) == -1);
713  PTS_ABORTIF(ptd, *ptd->ptr++ != ',');
714  PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, &x) == -1);
715  PTS_ABORTIF(ptd, *ptd->ptr++ != ';');
716  ptd->idx = idx;
717  continue;
718  }
719  }
720 
721  PTS_ABORTIF(ptd, stabs_pts_read_id(ptd) == -1);
722  /* Ref. TSDF R2.130 Section 7.4. When the field name is a method name
723  * it is followed by two colons rather than one.
724  */
725  if (*ptd->ptr == ':')
726  {
727  ptd->ptr++;
729  ptd->idx = idx;
730  continue;
731  }
732  else
733  {
734  /* skip C++ member protection /0 /1 or /2 */
735  if (*ptd->ptr == '/') ptd->ptr += 2;
736  }
737  PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, NULL, &adt) == -1);
738 
739  switch (*ptd->ptr++)
740  {
741  case ',':
742  PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, &ofs) == -1);
743  PTS_ABORTIF(ptd, *ptd->ptr++ != ',');
744  PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, &sz) == -1);
745  PTS_ABORTIF(ptd, *ptd->ptr++ != ';');
746 
747  if (doadd) symt_add_udt_element(ptd->module, sdt, ptd->buf + idx, adt, ofs, sz);
748  break;
749  case ':':
750  {
751  const char* tmp;
752  /* method parameters... terminated by ';' */
753  PTS_ABORTIF(ptd, !(tmp = strchr(ptd->ptr, ';')));
754  ptd->ptr = tmp + 1;
755  }
756  break;
757  default:
758  PTS_ABORTIF(ptd, TRUE);
759  }
760  ptd->idx = idx;
761  }
762  PTS_ABORTIF(ptd, *ptd->ptr++ != ';');
763  if (*ptd->ptr == '~')
764  {
765  ptd->ptr++;
766  PTS_ABORTIF(ptd, *ptd->ptr++ != '%');
767  PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, NULL, &dt) == -1);
768  PTS_ABORTIF(ptd, *ptd->ptr++ != ';');
769  }
770  return 0;
771 }
static int stabs_pts_read_method_info(struct ParseTypedefData *ptd)
Definition: stabs.c:592
#define TRUE
Definition: types.h:120
struct module * module
Definition: stabs.c:337
BOOL symt_set_udt_size(struct module *module, struct symt_udt *type, unsigned size) DECLSPEC_HIDDEN
Definition: type.c:243
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
static struct symt ** stabs_read_type_enum(const char **x)
Definition: stabs.c:306
#define PTS_ABORTIF(ptd, t)
Definition: stabs.c:356
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
const char * symt_get_name(const struct symt *sym) DECLSPEC_HIDDEN
Definition: type.c:82
unsigned int idx
Definition: utils.c:41
const char * ptr
Definition: stabs.c:334
smooth NULL
Definition: ftsmooth.c:416
BOOL symt_add_udt_element(struct module *module, struct symt_udt *udt_type, const char *name, struct symt *elt_type, unsigned offset, unsigned size) DECLSPEC_HIDDEN
Definition: type.c:265
GLsizeiptr size
Definition: glext.h:5919
static int stabs_pts_read_type_def(struct ParseTypedefData *ptd, const char *typename, struct symt **dt)
Definition: stabs.c:816
static int stabs_pts_read_number(struct ParseTypedefData *ptd, long *v)
Definition: stabs.c:432
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL symt_get_info(struct module *module, const struct symt *type, IMAGEHLP_SYMBOL_TYPE_INFO req, void *pInfo) DECLSPEC_HIDDEN
Definition: type.c:537
uint64_t DWORD64
Definition: typedefs.h:65
char * strchr(const char *String, int ch)
Definition: utclib.c:501
static int stabs_pts_read_id(struct ParseTypedefData *ptd)
Definition: stabs.c:404
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
char buf[1024]
Definition: stabs.c:335

Referenced by stabs_pts_read_type_def().

◆ stabs_pts_read_array()

static int stabs_pts_read_array ( struct ParseTypedefData ptd,
struct symt **  adt 
)
inlinestatic

Definition at line 792 of file stabs.c.

794 {
795  long lo, hi;
796  struct symt* range_dt;
797  struct symt* base_dt;
798 
799  /* ar<typeinfo_nodef>;<int>;<int>;<typeinfo> */
800 
801  PTS_ABORTIF(ptd, *ptd->ptr++ != 'r');
802 
803  PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, NULL, &range_dt) == -1);
804  PTS_ABORTIF(ptd, *ptd->ptr++ != ';'); /* ';' */
805  PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, &lo) == -1);
806  PTS_ABORTIF(ptd, *ptd->ptr++ != ';'); /* ';' */
807  PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, &hi) == -1);
808  PTS_ABORTIF(ptd, *ptd->ptr++ != ';'); /* ';' */
809 
810  PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, NULL, &base_dt) == -1);
811 
812  *adt = &symt_new_array(ptd->module, lo, hi, base_dt, range_dt)->symt;
813  return 0;
814 }
struct module * module
Definition: stabs.c:337
#define PTS_ABORTIF(ptd, t)
Definition: stabs.c:356
const char * ptr
Definition: stabs.c:334
smooth NULL
Definition: ftsmooth.c:416
static int stabs_pts_read_type_def(struct ParseTypedefData *ptd, const char *typename, struct symt **dt)
Definition: stabs.c:816
struct symt_array * symt_new_array(struct module *module, int min, int max, struct symt *base, struct symt *index) DECLSPEC_HIDDEN
Definition: type.c:346
static int stabs_pts_read_number(struct ParseTypedefData *ptd, long *v)
Definition: stabs.c:432

Referenced by stabs_pts_read_type_def().

◆ stabs_pts_read_enum()

static int stabs_pts_read_enum ( struct ParseTypedefData ptd,
struct symt_enum edt 
)
inlinestatic

Definition at line 773 of file stabs.c.

775 {
776  long value;
777  int idx;
778 
779  while (*ptd->ptr != ';')
780  {
781  idx = ptd->idx;
782  PTS_ABORTIF(ptd, stabs_pts_read_id(ptd) == -1);
783  PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, &value) == -1);
784  PTS_ABORTIF(ptd, *ptd->ptr++ != ',');
785  symt_add_enum_element(ptd->module, edt, ptd->buf + idx, value);
786  ptd->idx = idx;
787  }
788  ptd->ptr++;
789  return 0;
790 }
struct module * module
Definition: stabs.c:337
BOOL symt_add_enum_element(struct module *module, struct symt_enum *enum_type, const char *name, int value) DECLSPEC_HIDDEN
Definition: type.c:320
#define PTS_ABORTIF(ptd, t)
Definition: stabs.c:356
unsigned int idx
Definition: utils.c:41
const char * ptr
Definition: stabs.c:334
static int stabs_pts_read_number(struct ParseTypedefData *ptd, long *v)
Definition: stabs.c:432
GLsizei const GLfloat * value
Definition: glext.h:6069
static int stabs_pts_read_id(struct ParseTypedefData *ptd)
Definition: stabs.c:404
char buf[1024]
Definition: stabs.c:335

Referenced by stabs_pts_read_type_def().

◆ stabs_pts_read_id()

static int stabs_pts_read_id ( struct ParseTypedefData ptd)
static

Definition at line 404 of file stabs.c.

405 {
406  const char* first = ptd->ptr;
407  unsigned int template = 0;
408  char ch;
409 
410  while ((ch = *ptd->ptr++) != '\0')
411  {
412  switch (ch)
413  {
414  case ':':
415  if (template == 0)
416  {
417  unsigned int len = ptd->ptr - first - 1;
418  PTS_ABORTIF(ptd, len >= sizeof(ptd->buf) - ptd->idx);
419  memcpy(ptd->buf + ptd->idx, first, len);
420  ptd->buf[ptd->idx + len] = '\0';
421  ptd->idx += len + 1;
422  return 0;
423  }
424  break;
425  case '<': template++; break;
426  case '>': PTS_ABORTIF(ptd, template == 0); template--; break;
427  }
428  }
429  return -1;
430 }
#define PTS_ABORTIF(ptd, t)
Definition: stabs.c:356
const GLint * first
Definition: glext.h:5794
const char * ptr
Definition: stabs.c:334
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
char buf[1024]
Definition: stabs.c:335

Referenced by stabs_pts_read_aggregate(), stabs_pts_read_enum(), and stabs_pts_read_type_def().

◆ stabs_pts_read_method_info()

static int stabs_pts_read_method_info ( struct ParseTypedefData ptd)
inlinestatic

Definition at line 592 of file stabs.c.

593 {
594  struct symt* dt;
595  const char* tmp;
596  char mthd;
597 
598  do
599  {
600  /* get type of return value */
601  PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, NULL, &dt) == -1);
602  if (*ptd->ptr == ';') ptd->ptr++;
603 
604  /* get types of parameters */
605  if (*ptd->ptr == ':')
606  {
607  PTS_ABORTIF(ptd, !(tmp = strchr(ptd->ptr + 1, ';')));
608  ptd->ptr = tmp + 1;
609  }
610  PTS_ABORTIF(ptd, !(*ptd->ptr >= '0' && *ptd->ptr <= '9'));
611  ptd->ptr++;
612  PTS_ABORTIF(ptd, !(ptd->ptr[0] >= 'A' && *ptd->ptr <= 'D'));
613  mthd = *++ptd->ptr;
614  PTS_ABORTIF(ptd, mthd != '.' && mthd != '?' && mthd != '*');
615  ptd->ptr++;
616  if (mthd == '*')
617  {
618  long int ofs;
619 
620  PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, &ofs) == -1);
621  PTS_ABORTIF(ptd, *ptd->ptr++ != ';');
622  PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, NULL, &dt) == -1);
623  PTS_ABORTIF(ptd, *ptd->ptr++ != ';');
624  }
625  } while (*ptd->ptr != ';');
626  ptd->ptr++;
627 
628  return 0;
629 }
#define PTS_ABORTIF(ptd, t)
Definition: stabs.c:356
const char * ptr
Definition: stabs.c:334
smooth NULL
Definition: ftsmooth.c:416
static int stabs_pts_read_type_def(struct ParseTypedefData *ptd, const char *typename, struct symt **dt)
Definition: stabs.c:816
static int stabs_pts_read_number(struct ParseTypedefData *ptd, long *v)
Definition: stabs.c:432
char * strchr(const char *String, int ch)
Definition: utclib.c:501

Referenced by stabs_pts_read_aggregate().

◆ stabs_pts_read_number()

static int stabs_pts_read_number ( struct ParseTypedefData ptd,
long v 
)
static

Definition at line 432 of file stabs.c.

433 {
434  char* last;
435 
436  *v = strtol(ptd->ptr, &last, 10);
437  PTS_ABORTIF(ptd, last == ptd->ptr);
438  ptd->ptr = last;
439  return 0;
440 }
POINT last
Definition: font.c:46
#define PTS_ABORTIF(ptd, t)
Definition: stabs.c:356
const char * ptr
Definition: stabs.c:334
const GLdouble * v
Definition: gl.h:2040
_Check_return_ long __cdecl strtol(_In_z_ const char *_Str, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)

Referenced by stabs_pts_read_aggregate(), stabs_pts_read_array(), stabs_pts_read_enum(), stabs_pts_read_method_info(), stabs_pts_read_type_def(), and stabs_pts_read_type_reference().

◆ stabs_pts_read_range()

static int stabs_pts_read_range ( struct ParseTypedefData ptd,
const char typename,
struct symt **  dt 
)
static

Definition at line 510 of file stabs.c.

512 {
513  struct symt* ref;
514  struct pts_range_value lo;
515  struct pts_range_value hi;
516  unsigned size;
517  enum BasicType bt;
518  int i;
519  ULONGLONG v;
520 
521  /* type ';' <int> ';' <int> ';' */
522  PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, NULL, &ref) == -1);
523  PTS_ABORTIF(ptd, *ptd->ptr++ != ';'); /* ';' */
524  PTS_ABORTIF(ptd, stabs_pts_read_range_value(ptd, &lo) == -1);
525  PTS_ABORTIF(ptd, *ptd->ptr++ != ';'); /* ';' */
526  PTS_ABORTIF(ptd, stabs_pts_read_range_value(ptd, &hi) == -1);
527  PTS_ABORTIF(ptd, *ptd->ptr++ != ';'); /* ';' */
528 
529  /* basically, we don't use ref... in some cases, for example, float is declared
530  * as a derived type of int... which won't help us... so we guess the types
531  * from the various formats
532  */
533  if (lo.sign == 0 && hi.sign < 0)
534  {
535  bt = btUInt;
536  size = hi.val;
537  }
538  else if (lo.sign < 0 && hi.sign == 0)
539  {
540  bt = btUInt;
541  size = lo.val;
542  }
543  else if (lo.sign > 0 && hi.sign == 0)
544  {
545  bt = btFloat;
546  size = lo.val;
547  }
548  else if (lo.sign < 0 && hi.sign > 0)
549  {
550  v = 1 << 7;
551  for (i = 7; i < 64; i += 8)
552  {
553  if (lo.val == v && hi.val == v - 1)
554  {
555  bt = btInt;
556  size = (i + 1) / 8;
557  break;
558  }
559  v <<= 8;
560  }
561  PTS_ABORTIF(ptd, i >= 64);
562  }
563  else if (lo.sign == 0 && hi.sign > 0)
564  {
565  if (hi.val == 127) /* specific case for char... */
566  {
567  bt = btChar;
568  size = 1;
569  }
570  else
571  {
572  v = 1;
573  for (i = 8; i <= 64; i += 8)
574  {
575  v <<= 8;
576  if (hi.val + 1 == v)
577  {
578  bt = btUInt;
579  size = (i + 1) / 8;
580  break;
581  }
582  }
583  PTS_ABORTIF(ptd, i > 64);
584  }
585  }
586  else PTS_ABORTIF(ptd, 1);
587 
588  *dt = &symt_new_basic(ptd->module, bt, typename, size)->symt;
589  return 0;
590 }
BasicType
Definition: compat.h:1256
struct module * module
Definition: stabs.c:337
#define PTS_ABORTIF(ptd, t)
Definition: stabs.c:356
Definition: send.c:47
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLenum GLint ref
Definition: glext.h:6028
const char * ptr
Definition: stabs.c:334
smooth NULL
Definition: ftsmooth.c:416
struct symt_basic * symt_new_basic(struct module *module, enum BasicType, const char *typename, unsigned size) DECLSPEC_HIDDEN
Definition: type.c:193
GLsizeiptr size
Definition: glext.h:5919
static int stabs_pts_read_type_def(struct ParseTypedefData *ptd, const char *typename, struct symt **dt)
Definition: stabs.c:816
uint64_t ULONGLONG
Definition: typedefs.h:65
const GLdouble * v
Definition: gl.h:2040
static int stabs_pts_read_range_value(struct ParseTypedefData *ptd, struct pts_range_value *prv)
Definition: stabs.c:468
Definition: compat.h:1262

Referenced by stabs_pts_read_type_def().

◆ stabs_pts_read_range_value()

static int stabs_pts_read_range_value ( struct ParseTypedefData ptd,
struct pts_range_value prv 
)
static

Definition at line 468 of file stabs.c.

469 {
470  char* last;
471 
472  switch (*ptd->ptr)
473  {
474  case '0':
475  while (*ptd->ptr == '0') ptd->ptr++;
476  if (*ptd->ptr >= '1' && *ptd->ptr <= '7')
477  {
478  switch (ptd->ptr[1])
479  {
480  case '0':
481  PTS_ABORTIF(ptd, ptd->ptr[0] != '1');
482  prv->sign = -1;
483  prv->val = 0;
484  while (isdigit(*ptd->ptr)) prv->val = (prv->val << 3) + *ptd->ptr++ - '0';
485  break;
486  case '7':
487  prv->sign = 1;
488  prv->val = 0;
489  while (isdigit(*ptd->ptr)) prv->val = (prv->val << 3) + *ptd->ptr++ - '0';
490  break;
491  default: PTS_ABORTIF(ptd, 1); break;
492  }
493  } else prv->sign = 0;
494  break;
495  case '-':
496  prv->sign = -1;
497  prv->val = strtoull(++ptd->ptr, &last, 10);
498  ptd->ptr = last;
499  break;
500  case '+':
501  default:
502  prv->sign = 1;
503  prv->val = strtoull(ptd->ptr, &last, 10);
504  ptd->ptr = last;
505  break;
506  }
507  return 0;
508 }
POINT last
Definition: font.c:46
#define PTS_ABORTIF(ptd, t)
Definition: stabs.c:356
while(1)
Definition: macro.lex.yy.c:740
const char * ptr
Definition: stabs.c:334
ULONGLONG val
Definition: stabs.c:464
#define isdigit(c)
Definition: acclib.h:68
#define strtoull
Definition: stabs.c:72

Referenced by stabs_pts_read_range().

◆ stabs_pts_read_type_def()

static int stabs_pts_read_type_def ( struct ParseTypedefData ptd,
const char typename,
struct symt **  dt 
)
static

Definition at line 816 of file stabs.c.

818 {
819  int idx;
820  long sz = -1;
821  struct symt* new_dt = NULL; /* newly created data type */
822  struct symt* ref_dt; /* referenced data type (pointer...) */
823  long filenr1, subnr1, tmp;
824 
825  /* things are a bit complicated because of the way the typedefs are stored inside
826  * the file, because addresses can change when realloc is done, so we must call
827  * over and over stabs_find_ref() to keep the correct values around
828  */
829  PTS_ABORTIF(ptd, stabs_pts_read_type_reference(ptd, &filenr1, &subnr1) == -1);
830 
831  while (*ptd->ptr == '=')
832  {
833  ptd->ptr++;
834  PTS_ABORTIF(ptd, new_dt != NULL);
835 
836  /* first handle attribute if any */
837  switch (*ptd->ptr)
838  {
839  case '@':
840  if (*++ptd->ptr == 's')
841  {
842  ptd->ptr++;
843  if (stabs_pts_read_number(ptd, &sz) == -1)
844  {
845  ERR("Not an attribute... NIY\n");
846  ptd->ptr -= 2;
847  return -1;
848  }
849  PTS_ABORTIF(ptd, *ptd->ptr++ != ';');
850  }
851  break;
852  }
853  /* then the real definitions */
854  switch (*ptd->ptr++)
855  {
856  case '*':
857  case '&':
858  PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, NULL, &ref_dt) == -1);
859  new_dt = &symt_new_pointer(ptd->module, ref_dt, sizeof(void*))->symt;
860  break;
861  case 'k': /* 'const' modifier */
862  case 'B': /* 'volatile' modifier */
863  /* just kinda ignore the modifier, I guess -gmt */
864  PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, typename, &new_dt) == -1);
865  break;
866  case '(':
867  ptd->ptr--;
868  PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, typename, &new_dt) == -1);
869  break;
870  case 'a':
871  PTS_ABORTIF(ptd, stabs_pts_read_array(ptd, &new_dt) == -1);
872  break;
873  case 'r':
874  PTS_ABORTIF(ptd, stabs_pts_read_range(ptd, typename, &new_dt) == -1);
875  assert(!*stabs_find_ref(filenr1, subnr1));
876  *stabs_find_ref(filenr1, subnr1) = new_dt;
877  break;
878  case 'f':
879  PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, NULL, &ref_dt) == -1);
880  new_dt = &symt_new_function_signature(ptd->module, ref_dt, -1)->symt;
881  break;
882  case 'e':
883  stabs_get_basic(ptd, 1 /* int */, &ref_dt);
884  new_dt = &symt_new_enum(ptd->module, typename, ref_dt)->symt;
885  PTS_ABORTIF(ptd, stabs_pts_read_enum(ptd, (struct symt_enum*)new_dt) == -1);
886  break;
887  case 's':
888  case 'u':
889  {
890  struct symt_udt* udt;
891  enum UdtKind kind = (ptd->ptr[-1] == 's') ? UdtStruct : UdtUnion;
892  /* udt can have been already defined in a forward definition */
893  udt = (struct symt_udt*)*stabs_find_ref(filenr1, subnr1);
894  if (!udt)
895  {
896  udt = symt_new_udt(ptd->module, typename, 0, kind);
897  /* we need to set it here, because a struct can hold a pointer
898  * to itself
899  */
900  new_dt = *stabs_find_ref(filenr1, subnr1) = &udt->symt;
901  }
902  else
903  {
904  unsigned l1, l2;
905  if (udt->symt.tag != SymTagUDT)
906  {
907  ERR("Forward declaration (%p/%s) is not an aggregate (%u)\n",
908  udt, symt_get_name(&udt->symt), udt->symt.tag);
909  return -1;
910  }
911  /* FIXME: we currently don't correctly construct nested C++
912  * classes names. Therefore, we could be here with either:
913  * - typename and udt->hash_elt.name being the same string
914  * (non embedded case)
915  * - typename being foo::bar while udt->hash_elt.name being
916  * just bar
917  * So, we twist the comparison to test both occurrences. When
918  * we have proper C++ types in this file, this twist has to be
919  * removed
920  */
921  l1 = strlen(udt->hash_elt.name);
922  l2 = strlen(typename);
923  if (l1 > l2 || strcmp(udt->hash_elt.name, typename + l2 - l1))
924  ERR("Forward declaration name mismatch %s <> %s\n",
925  udt->hash_elt.name, typename);
926  new_dt = &udt->symt;
927  }
928  PTS_ABORTIF(ptd, stabs_pts_read_aggregate(ptd, udt) == -1);
929  }
930  break;
931  case 'x':
932  idx = ptd->idx;
933  tmp = *ptd->ptr++;
934  PTS_ABORTIF(ptd, stabs_pts_read_id(ptd) == -1);
935  switch (tmp)
936  {
937  case 'e':
938  stabs_get_basic(ptd, 1 /* int */, &ref_dt);
939  new_dt = &symt_new_enum(ptd->module, ptd->buf + idx, ref_dt)->symt;
940  break;
941  case 's':
942  new_dt = &symt_new_udt(ptd->module, ptd->buf + idx, 0, UdtStruct)->symt;
943  break;
944  case 'u':
945  new_dt = &symt_new_udt(ptd->module, ptd->buf + idx, 0, UdtUnion)->symt;
946  break;
947  default:
948  return -1;
949  }
950  ptd->idx = idx;
951  break;
952  case '-':
953  {
954  PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, &tmp) == -1);
955  PTS_ABORTIF(ptd, stabs_get_basic(ptd, tmp, &new_dt) == -1);
956  PTS_ABORTIF(ptd, *ptd->ptr++ != ';');
957  }
958  break;
959  case '#':
960  if (*ptd->ptr == '#')
961  {
962  ptd->ptr++;
963  PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, NULL, &ref_dt) == -1);
964  new_dt = &symt_new_function_signature(ptd->module, ref_dt, -1)->symt;
965  }
966  else
967  {
968  struct symt* cls_dt;
969  struct symt* pmt_dt;
970 
971  PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, NULL, &cls_dt) == -1);
972  PTS_ABORTIF(ptd, *ptd->ptr++ != ',');
973  PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, NULL, &ref_dt) == -1);
974  new_dt = &symt_new_function_signature(ptd->module, ref_dt, -1)->symt;
975  while (*ptd->ptr == ',')
976  {
977  ptd->ptr++;
978  PTS_ABORTIF(ptd, stabs_pts_read_type_def(ptd, NULL, &pmt_dt) == -1);
979  }
980  }
981  break;
982  case 'R':
983  {
984  long type, len, unk;
985  int basic;
986 
987  PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, &type) == -1);
988  PTS_ABORTIF(ptd, *ptd->ptr++ != ';'); /* ';' */
989  PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, &len) == -1);
990  PTS_ABORTIF(ptd, *ptd->ptr++ != ';'); /* ';' */
991  PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, &unk) == -1);
992  PTS_ABORTIF(ptd, *ptd->ptr++ != ';'); /* ';' */
993 
994  switch (type) /* see stabs_get_basic for the details */
995  {
996  case 1: basic = 12; break;
997  case 2: basic = 13; break;
998  case 3: basic = 25; break;
999  case 4: basic = 26; break;
1000  case 5: basic = 35; break;
1001  case 6: basic = 14; break;
1002  default: PTS_ABORTIF(ptd, 1);
1003  }
1004  PTS_ABORTIF(ptd, stabs_get_basic(ptd, basic, &new_dt) == -1);
1005  }
1006  break;
1007  default:
1008  ERR("Unknown type '%c'\n", ptd->ptr[-1]);
1009  return -1;
1010  }
1011  }
1012 
1013  if (!new_dt)
1014  {
1015  /* is it a forward declaration that has been filled ? */
1016  new_dt = *stabs_find_ref(filenr1, subnr1);
1017  /* if not, this should be void (which is defined as a ref to itself, but we
1018  * don't correctly catch it)
1019  */
1020  if (!new_dt && typename)
1021  {
1022  new_dt = &symt_new_basic(ptd->module, btVoid, typename, 0)->symt;
1023  PTS_ABORTIF(ptd, strcmp(typename, "void"));
1024  }
1025  }
1026 
1027  *stabs_find_ref(filenr1, subnr1) = *ret_dt = new_dt;
1028 
1029  TRACE("Adding (%ld,%ld) %s\n", filenr1, subnr1, debugstr_a(typename));
1030 
1031  return 0;
1032 }
struct module * module
Definition: stabs.c:337
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define PTS_ABORTIF(ptd, t)
Definition: stabs.c:356
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define assert(x)
Definition: debug.h:53
struct symt symt
const char * symt_get_name(const struct symt *sym) DECLSPEC_HIDDEN
Definition: type.c:82
enum UdtKind kind
static int stabs_pts_read_enum(struct ParseTypedefData *ptd, struct symt_enum *edt)
Definition: stabs.c:773
static int stabs_get_basic(struct ParseTypedefData *ptd, unsigned basic, struct symt **symt)
Definition: stabs.c:361
static int stabs_pts_read_range(struct ParseTypedefData *ptd, const char *typename, struct symt **dt)
Definition: stabs.c:510
static int stabs_pts_read_aggregate(struct ParseTypedefData *ptd, struct symt_udt *sdt)
Definition: stabs.c:631
unsigned int idx
Definition: utils.c:41
const char * ptr
Definition: stabs.c:334
smooth NULL
Definition: ftsmooth.c:416
UdtKind
Definition: compat.h:1279
struct symt_basic * symt_new_basic(struct module *module, enum BasicType, const char *typename, unsigned size) DECLSPEC_HIDDEN
Definition: type.c:193
static struct symt ** stabs_find_ref(long filenr, long subnr)
Definition: stabs.c:262
#define TRACE(s)
Definition: solgame.cpp:4
static int stabs_pts_read_type_def(struct ParseTypedefData *ptd, const char *typename, struct symt **dt)
Definition: stabs.c:816
#define debugstr_a
Definition: kernel32.h:31
static int stabs_pts_read_array(struct ParseTypedefData *ptd, struct symt **adt)
Definition: stabs.c:792
struct symt_pointer * symt_new_pointer(struct module *module, struct symt *ref_type, unsigned long size) DECLSPEC_HIDDEN
Definition: type.c:415
static int stabs_pts_read_number(struct ParseTypedefData *ptd, long *v)
Definition: stabs.c:432
struct symt_enum * symt_new_enum(struct module *module, const char *typename, struct symt *basetype) DECLSPEC_HIDDEN
Definition: type.c:305
GLenum GLsizei len
Definition: glext.h:6722
#define ERR(fmt,...)
Definition: debug.h:109
struct symt_udt * symt_new_udt(struct module *module, const char *typename, unsigned size, enum UdtKind kind) DECLSPEC_HIDDEN
Definition: type.c:220
struct symt_function_signature * symt_new_function_signature(struct module *module, struct symt *ret_type, enum CV_call_e call_conv) DECLSPEC_HIDDEN
Definition: type.c:378
static int stabs_pts_read_type_reference(struct ParseTypedefData *ptd, long *filenr, long *subnr)
Definition: stabs.c:442
static int stabs_pts_read_id(struct ParseTypedefData *ptd)
Definition: stabs.c:404
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
char buf[1024]
Definition: stabs.c:335
struct hash_table_elt hash_elt

Referenced by stabs_parse_typedef(), stabs_pts_read_aggregate(), stabs_pts_read_array(), stabs_pts_read_method_info(), and stabs_pts_read_range().

◆ stabs_pts_read_type_reference()

static int stabs_pts_read_type_reference ( struct ParseTypedefData ptd,
long filenr,
long subnr 
)
static

Definition at line 442 of file stabs.c.

444 {
445  if (*ptd->ptr == '(')
446  {
447  /* '(' <int> ',' <int> ')' */
448  ptd->ptr++;
449  PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, filenr) == -1);
450  PTS_ABORTIF(ptd, *ptd->ptr++ != ',');
451  PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, subnr) == -1);
452  PTS_ABORTIF(ptd, *ptd->ptr++ != ')');
453  }
454  else
455  {
456  *filenr = 0;
457  PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, subnr) == -1);
458  }
459  return 0;
460 }
#define PTS_ABORTIF(ptd, t)
Definition: stabs.c:356
const char * ptr
Definition: stabs.c:334
static int stabs_pts_read_number(struct ParseTypedefData *ptd, long *v)
Definition: stabs.c:432

Referenced by stabs_pts_read_type_def().

◆ stabs_read_type_enum()

static struct symt** stabs_read_type_enum ( const char **  x)
static

Definition at line 306 of file stabs.c.

307 {
308  long filenr, subnr;
309  const char* iter;
310  char* end;
311 
312  iter = *x;
313  if (*iter == '(')
314  {
315  ++iter; /* '(' */
316  filenr = strtol(iter, &end, 10); /* <int> */
317  iter = ++end; /* ',' */
318  subnr = strtol(iter, &end, 10); /* <int> */
319  iter = ++end; /* ')' */
320  }
321  else
322  {
323  filenr = 0;
324  subnr = strtol(iter, &end, 10); /* <int> */
325  iter = end;
326  }
327  *x = iter;
328  return stabs_find_ref(filenr, subnr);
329 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint end
Definition: gl.h:1545
static struct symt ** stabs_find_ref(long filenr, long subnr)
Definition: stabs.c:262
_Check_return_ long __cdecl strtol(_In_z_ const char *_Str, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)

Referenced by stabs_parse_type(), and stabs_pts_read_aggregate().

◆ stabs_reset_includes()

static void stabs_reset_includes ( void  )
static

Definition at line 233 of file stabs.c.

234 {
235  /*
236  * The struct symt:s that we would need to use are reset when
237  * we start a new file. (at least the ones in filenr == 0)
238  */
239  cu_include_stk_idx = 0;/* keep 0 as index for the .c file itself */
240  memset(cu_vector, 0, sizeof(cu_vector[0]) * cu_nrofentries);
241 }
static int cu_nrofentries
Definition: stabs.c:180
static int cu_include_stk_idx
Definition: stabs.c:178
static struct symt ** cu_vector
Definition: stabs.c:179
#define memset(x, y, z)
Definition: compat.h:39

Referenced by stabs_free_includes(), and stabs_parse().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( dbghelp_stabs  )

Variable Documentation

◆ cu_include_stack

int cu_include_stack[MAX_INCLUDES]
static

Definition at line 177 of file stabs.c.

Referenced by stabs_add_include(), and stabs_find_ref().

◆ cu_include_stk_idx

int cu_include_stk_idx = 0
static

Definition at line 178 of file stabs.c.

Referenced by stabs_add_include(), stabs_find_ref(), and stabs_reset_includes().

◆ cu_nrofentries

int cu_nrofentries = 0
static

Definition at line 180 of file stabs.c.

Referenced by stabs_find_ref(), stabs_free_includes(), and stabs_reset_includes().

◆ cu_vector

struct symt** cu_vector = NULL
static

Definition at line 179 of file stabs.c.

Referenced by stabs_find_ref(), stabs_free_includes(), and stabs_reset_includes().

◆ include_defs

include_def* include_defs = NULL
static

◆ num_alloc_include_def

int num_alloc_include_def = 0
static

Definition at line 176 of file stabs.c.

Referenced by stabs_free_includes(), and stabs_new_include().

◆ num_include_def

int num_include_def = 0
static

Definition at line 175 of file stabs.c.

Referenced by stabs_find_include(), stabs_free_includes(), and stabs_new_include().

◆ stabs_basic

struct symt_basic* stabs_basic[36]
static

Definition at line 181 of file stabs.c.

Referenced by stabs_get_basic(), and stabs_parse().