ReactOS  0.4.14-dev-52-g6116262
msc.c File Reference
#include "config.h"
#include "wine/port.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winternl.h"
#include "wine/exception.h"
#include "wine/debug.h"
#include "dbghelp_private.h"
#include "wine/mscvpdb.h"
Include dependency graph for msc.c:

Go to the source code of this file.

Classes

struct  pdb_stream_name
 
struct  pdb_file_info
 
struct  pdb_module_info
 
struct  cv_defined_module
 
struct  codeview_type_parse
 
struct  pevaluator
 
struct  zvalue
 

Macros

#define NONAMELESSUNION
 
#define CV_MAX_MODULES   32
 
#define MAX_BUILTIN_TYPES   0x06FF
 
#define FIRST_DEFINABLE_TYPE   0x1000
 
#define CV_MAX_MODULES   32
 
#define PEV_MAX_LEN   32
 
#define PEV_ERROR(pev, msg)   snprintf((pev)->error, sizeof((pev)->error), "%s", (msg))
 
#define PEV_ERROR1(pev, msg, pmt)   snprintf((pev)->error, sizeof((pev)->error), (msg), (pmt))
 
#define MAKESIG(a, b, c, d)   ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
 
#define CODEVIEW_NB09_SIG   MAKESIG('N','B','0','9')
 
#define CODEVIEW_NB10_SIG   MAKESIG('N','B','1','0')
 
#define CODEVIEW_NB11_SIG   MAKESIG('N','B','1','1')
 
#define CODEVIEW_RSDS_SIG   MAKESIG('R','S','D','S')
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (dbghelp_msc)
 
static void dump (const void *ptr, unsigned len)
 
static void codeview_init_basic_types (struct module *module)
 
static int leaf_as_variant (VARIANT *v, const unsigned short int *leaf)
 
static int numeric_leaf (int *value, const unsigned short int *leaf)
 
static const charterminate_string (const struct p_string *p_name)
 
static struct symtcodeview_get_type (unsigned int typeno, BOOL quiet)
 
static const voidcodeview_jump_to_type (const struct codeview_type_parse *ctp, DWORD idx)
 
static int codeview_add_type (unsigned int typeno, struct symt *dt)
 
static void codeview_clear_type_table (void)
 
static struct symtcodeview_parse_one_type (struct codeview_type_parse *ctp, unsigned curr_type, const union codeview_type *type, BOOL details)
 
static voidcodeview_cast_symt (struct symt *symt, enum SymTagEnum tag)
 
static struct symtcodeview_fetch_type (struct codeview_type_parse *ctp, unsigned typeno, BOOL details)
 
static struct symtcodeview_add_type_pointer (struct codeview_type_parse *ctp, struct symt *existing, unsigned int pointee_type)
 
static struct symtcodeview_add_type_array (struct codeview_type_parse *ctp, const char *name, unsigned int elemtype, unsigned int indextype, unsigned int arr_len)
 
static BOOL codeview_add_type_enum_field_list (struct module *module, struct symt_enum *symt, const union codeview_reftype *ref_type)
 
static void codeview_add_udt_element (struct codeview_type_parse *ctp, struct symt_udt *symt, const char *name, int value, unsigned type)
 
static int codeview_add_type_struct_field_list (struct codeview_type_parse *ctp, struct symt_udt *symt, unsigned fieldlistno)
 
static struct symtcodeview_add_type_enum (struct codeview_type_parse *ctp, struct symt *existing, const char *name, unsigned fieldlistno, unsigned basetype)
 
static struct symtcodeview_add_type_struct (struct codeview_type_parse *ctp, struct symt *existing, const char *name, int structlen, enum UdtKind kind, unsigned property)
 
static struct symtcodeview_new_func_signature (struct codeview_type_parse *ctp, struct symt *existing, enum CV_call_e call_conv)
 
static void codeview_add_func_signature_args (struct codeview_type_parse *ctp, struct symt_function_signature *sym, unsigned ret_type, unsigned args_list)
 
static BOOL codeview_parse_type_table (struct codeview_type_parse *ctp)
 
static unsigned long codeview_get_address (const struct msc_debug_info *msc_dbg, unsigned seg, unsigned offset)
 
static void codeview_snarf_linetab (const struct msc_debug_info *msc_dbg, const BYTE *linetab, int size, BOOL pascal_str)
 
static void codeview_snarf_linetab2 (const struct msc_debug_info *msc_dbg, const BYTE *linetab, DWORD size, const char *strimage, DWORD strsize)
 
static unsigned int codeview_map_offset (const struct msc_debug_info *msc_dbg, unsigned int offset)
 
static void codeview_add_variable (const struct msc_debug_info *msc_dbg, struct symt_compiland *compiland, const char *name, unsigned segment, unsigned offset, unsigned symtype, BOOL is_local, BOOL in_tls, BOOL force)
 
static BOOL codeview_snarf (const struct msc_debug_info *msc_dbg, const BYTE *root, int offset, int size, BOOL do_globals)
 
static BOOL codeview_snarf_public (const struct msc_debug_info *msc_dbg, const BYTE *root, int offset, int size)
 
static voidpdb_jg_read (const struct PDB_JG_HEADER *pdb, const WORD *block_list, int size)
 
static voidpdb_ds_read (const struct PDB_DS_HEADER *pdb, const DWORD *block_list, int size)
 
static voidpdb_read_jg_file (const struct PDB_JG_HEADER *pdb, const struct PDB_JG_TOC *toc, DWORD file_nr)
 
static voidpdb_read_ds_file (const struct PDB_DS_HEADER *pdb, const struct PDB_DS_TOC *toc, DWORD file_nr)
 
static voidpdb_read_file (const struct pdb_file_info *pdb_file, DWORD file_nr)
 
static unsigned pdb_get_file_size (const struct pdb_file_info *pdb_file, DWORD file_nr)
 
static void pdb_free (void *buffer)
 
static void pdb_free_file (struct pdb_file_info *pdb_file)
 
static void pdb_load_stream_name_table (struct pdb_file_info *pdb_file, const char *str, unsigned cb)
 
static unsigned pdb_get_stream_by_name (const struct pdb_file_info *pdb_file, const char *name)
 
static voidpdb_read_strings (const struct pdb_file_info *pdb_file)
 
static void pdb_module_remove (struct process *pcsn, struct module_format *modfmt)
 
static void pdb_convert_types_header (PDB_TYPES *types, const BYTE *image)
 
static void pdb_convert_symbols_header (PDB_SYMBOLS *symbols, int *header_size, const BYTE *image)
 
static void pdb_convert_symbol_file (const PDB_SYMBOLS *symbols, PDB_SYMBOL_FILE_EX *sfile, unsigned *size, const void *image)
 
static HANDLE map_pdb_file (const struct process *pcs, const struct pdb_lookup *lookup, struct module *module)
 
static void pdb_process_types (const struct msc_debug_info *msc_dbg, const struct pdb_file_info *pdb_file)
 
static BOOL pdb_init (const struct pdb_lookup *pdb_lookup, struct pdb_file_info *pdb_file, const char *image, unsigned *matched)
 
static BOOL pdb_process_internal (const struct process *pcs, const struct msc_debug_info *msc_dbg, const struct pdb_lookup *pdb_lookup, struct pdb_module_info *pdb_module_info, unsigned module_index)
 
static void pdb_process_symbol_imports (const struct process *pcs, const struct msc_debug_info *msc_dbg, const PDB_SYMBOLS *symbols, const void *symbols_image, const char *image, const struct pdb_lookup *pdb_lookup, struct pdb_module_info *pdb_module_info, unsigned module_index)
 
static BOOL pdb_process_file (const struct process *pcs, const struct msc_debug_info *msc_dbg, struct pdb_lookup *pdb_lookup)
 
BOOL pdb_fetch_file_info (const struct pdb_lookup *pdb_lookup, unsigned *matched)
 
static BOOL pev_get_val (struct pevaluator *pev, const char *str, DWORD_PTR *val)
 
static BOOL pev_push (struct pevaluator *pev, const char *elt)
 
static BOOL pev_pop (struct pevaluator *pev, char *elt)
 
static BOOL pev_pop_val (struct pevaluator *pev, DWORD_PTR *val)
 
static BOOL pev_set_value (struct pevaluator *pev, const char *name, DWORD_PTR val)
 
static BOOL pev_binop (struct pevaluator *pev, char op)
 
static BOOL pev_deref (struct pevaluator *pev)
 
static BOOL pev_assign (struct pevaluator *pev)
 
static void pev_init (struct pevaluator *pev, struct cpu_stack_walk *csw, PDB_FPO_DATA *fpoext, struct pdb_cmd_pair *cpair)
 
static BOOL pev_free (struct pevaluator *pev, struct pdb_cmd_pair *cpair)
 
static BOOL pdb_parse_cmd_string (struct cpu_stack_walk *csw, PDB_FPO_DATA *fpoext, const char *cmd, struct pdb_cmd_pair *cpair)
 
BOOL pdb_virtual_unwind (struct cpu_stack_walk *csw, DWORD_PTR ip, CONTEXT *context, struct pdb_cmd_pair *cpair)
 
static BOOL codeview_process_info (const struct process *pcs, const struct msc_debug_info *msc_dbg)
 
BOOL pe_load_debug_directory (const struct process *pcs, struct module *module, const BYTE *mapping, const IMAGE_SECTION_HEADER *sectp, DWORD nsect, const IMAGE_DEBUG_DIRECTORY *dbg, int nDbg)
 

Variables

static struct symtcv_basic_types [MAX_BUILTIN_TYPES]
 
static struct cv_defined_module cv_zmodules [CV_MAX_MODULES]
 
static struct cv_defined_modulecv_current_module
 
static const char PDB_JG_IDENT [] = "Microsoft C/C++ program database 2.00\r\n\032JG\0"
 
static const char PDB_DS_IDENT [] = "Microsoft C/C++ MSF 7.00\r\n\032DS\0"
 

Macro Definition Documentation

◆ CODEVIEW_NB09_SIG

#define CODEVIEW_NB09_SIG   MAKESIG('N','B','0','9')

Definition at line 3259 of file msc.c.

◆ CODEVIEW_NB10_SIG

#define CODEVIEW_NB10_SIG   MAKESIG('N','B','1','0')

Definition at line 3260 of file msc.c.

◆ CODEVIEW_NB11_SIG

#define CODEVIEW_NB11_SIG   MAKESIG('N','B','1','1')

Definition at line 3261 of file msc.c.

◆ CODEVIEW_RSDS_SIG

#define CODEVIEW_RSDS_SIG   MAKESIG('R','S','D','S')

Definition at line 3262 of file msc.c.

◆ CV_MAX_MODULES [1/2]

#define CV_MAX_MODULES   32

Definition at line 143 of file msc.c.

◆ CV_MAX_MODULES [2/2]

#define CV_MAX_MODULES   32

Definition at line 143 of file msc.c.

◆ FIRST_DEFINABLE_TYPE

#define FIRST_DEFINABLE_TYPE   0x1000

Definition at line 132 of file msc.c.

◆ MAKESIG

#define MAKESIG (   a,
  b,
  c,
  d 
)    ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))

Definition at line 3258 of file msc.c.

◆ MAX_BUILTIN_TYPES

#define MAX_BUILTIN_TYPES   0x06FF

Definition at line 131 of file msc.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 35 of file msc.c.

◆ PEV_ERROR

#define PEV_ERROR (   pev,
  msg 
)    snprintf((pev)->error, sizeof((pev)->error), "%s", (msg))

Definition at line 2967 of file msc.c.

◆ PEV_ERROR1

#define PEV_ERROR1 (   pev,
  msg,
  pmt 
)    snprintf((pev)->error, sizeof((pev)->error), (msg), (pmt))

Definition at line 2968 of file msc.c.

◆ PEV_MAX_LEN

#define PEV_MAX_LEN   32

Definition at line 2950 of file msc.c.

Function Documentation

◆ codeview_add_func_signature_args()

static void codeview_add_func_signature_args ( struct codeview_type_parse ctp,
struct symt_function_signature sym,
unsigned  ret_type,
unsigned  args_list 
)
static

Definition at line 1081 of file msc.c.

1085 {
1086  const union codeview_reftype* reftype;
1087 
1088  sym->rettype = codeview_fetch_type(ctp, ret_type, FALSE);
1089  if (args_list && (reftype = codeview_jump_to_type(ctp, args_list)))
1090  {
1091  unsigned int i;
1092  switch (reftype->generic.id)
1093  {
1094  case LF_ARGLIST_V1:
1095  for (i = 0; i < reftype->arglist_v1.num; i++)
1097  codeview_fetch_type(ctp, reftype->arglist_v1.args[i], FALSE));
1098  break;
1099  case LF_ARGLIST_V2:
1100  for (i = 0; i < reftype->arglist_v2.num; i++)
1102  codeview_fetch_type(ctp, reftype->arglist_v2.args[i], FALSE));
1103  break;
1104  default:
1105  FIXME("Unexpected leaf %x for signature's pmt\n", reftype->generic.id);
1106  }
1107  }
1108 }
struct codeview_reftype::@3441 arglist_v1
struct codeview_reftype::@3442 arglist_v2
struct codeview_reftype::@3437 generic
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 struct symt * codeview_fetch_type(struct codeview_type_parse *ctp, unsigned typeno, BOOL details)
Definition: msc.c:638
#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
#define LF_ARGLIST_V2
Definition: mscvpdb.h:1157
static const void * codeview_jump_to_type(const struct codeview_type_parse *ctp, DWORD idx)
Definition: msc.c:562
struct module * module
Definition: msc.c:556
#define LF_ARGLIST_V1
Definition: mscvpdb.h:1143

Referenced by codeview_parse_one_type().

◆ codeview_add_type()

static int codeview_add_type ( unsigned int  typeno,
struct symt dt 
)
static

Definition at line 569 of file msc.c.

570 {
571  if (typeno < FIRST_DEFINABLE_TYPE)
572  FIXME("What the heck\n");
573  if (!cv_current_module)
574  {
575  FIXME("Adding %x to non allowed module\n", typeno);
576  return FALSE;
577  }
578  if ((typeno >> 24) != 0)
579  FIXME("No module index while inserting type-id assumption is wrong %x\n",
580  typeno);
581  if (typeno - FIRST_DEFINABLE_TYPE >= cv_current_module->num_defined_types)
582  {
583  if (cv_current_module->defined_types)
584  {
585  cv_current_module->num_defined_types = max( cv_current_module->num_defined_types * 2,
586  typeno - FIRST_DEFINABLE_TYPE + 1 );
587  cv_current_module->defined_types = HeapReAlloc(GetProcessHeap(),
588  HEAP_ZERO_MEMORY, cv_current_module->defined_types,
589  cv_current_module->num_defined_types * sizeof(struct symt*));
590  }
591  else
592  {
593  cv_current_module->num_defined_types = max( 256, typeno - FIRST_DEFINABLE_TYPE + 1 );
594  cv_current_module->defined_types = HeapAlloc(GetProcessHeap(),
596  cv_current_module->num_defined_types * sizeof(struct symt*));
597  }
598  if (cv_current_module->defined_types == NULL) return FALSE;
599  }
600  if (cv_current_module->defined_types[typeno - FIRST_DEFINABLE_TYPE])
601  {
602  if (cv_current_module->defined_types[typeno - FIRST_DEFINABLE_TYPE] != dt)
603  FIXME("Overwriting at %x\n", typeno);
604  }
605  cv_current_module->defined_types[typeno - FIRST_DEFINABLE_TYPE] = dt;
606  return TRUE;
607 }
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define HeapReAlloc
Definition: compat.h:393
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static struct cv_defined_module * cv_current_module
Definition: msc.c:145
#define FIRST_DEFINABLE_TYPE
Definition: msc.c:132

Referenced by codeview_parse_one_type().

◆ codeview_add_type_array()

static struct symt* codeview_add_type_array ( struct codeview_type_parse ctp,
const char name,
unsigned int  elemtype,
unsigned int  indextype,
unsigned int  arr_len 
)
static

Definition at line 673 of file msc.c.

678 {
679  struct symt* elem = codeview_fetch_type(ctp, elemtype, FALSE);
680  struct symt* index = codeview_fetch_type(ctp, indextype, FALSE);
681 
682  return &symt_new_array(ctp->module, 0, -arr_len, elem, index)->symt;
683 }
static struct symt * codeview_fetch_type(struct codeview_type_parse *ctp, unsigned typeno, BOOL details)
Definition: msc.c:638
static size_t elem
Definition: string.c:68
GLuint index
Definition: glext.h:6031
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
struct module * module
Definition: msc.c:556

Referenced by codeview_parse_one_type().

◆ codeview_add_type_enum()

static struct symt* codeview_add_type_enum ( struct codeview_type_parse ctp,
struct symt existing,
const char name,
unsigned  fieldlistno,
unsigned  basetype 
)
static

Definition at line 990 of file msc.c.

995 {
996  struct symt_enum* symt;
997 
998  if (existing)
999  {
1000  if (!(symt = codeview_cast_symt(existing, SymTagEnum))) return NULL;
1001  /* should also check that all fields are the same */
1002  }
1003  else
1004  {
1005  symt = symt_new_enum(ctp->module, name,
1006  codeview_fetch_type(ctp, basetype, FALSE));
1007  if (fieldlistno)
1008  {
1009  const union codeview_reftype* fieldlist;
1010  fieldlist = codeview_jump_to_type(ctp, fieldlistno);
1012  }
1013  }
1014  return &symt->symt;
1015 }
struct codeview_reftype::@3438 fieldlist
SymTagEnum
Definition: compat.h:1220
static struct symt * codeview_fetch_type(struct codeview_type_parse *ctp, unsigned typeno, BOOL details)
Definition: msc.c:638
static void * codeview_cast_symt(struct symt *symt, enum SymTagEnum tag)
Definition: msc.c:628
smooth NULL
Definition: ftsmooth.c:416
struct symt symt
struct symt_enum * symt_new_enum(struct module *module, const char *typename, struct symt *basetype) DECLSPEC_HIDDEN
Definition: type.c:305
static BOOL codeview_add_type_enum_field_list(struct module *module, struct symt_enum *symt, const union codeview_reftype *ref_type)
Definition: msc.c:685
static const void * codeview_jump_to_type(const struct codeview_type_parse *ctp, DWORD idx)
Definition: msc.c:562
struct module * module
Definition: msc.c:556
Definition: name.c:36

Referenced by codeview_parse_one_type().

◆ codeview_add_type_enum_field_list()

static BOOL codeview_add_type_enum_field_list ( struct module module,
struct symt_enum symt,
const union codeview_reftype ref_type 
)
static

Definition at line 685 of file msc.c.

688 {
689  const unsigned char* ptr = ref_type->fieldlist.list;
690  const unsigned char* last = (const BYTE*)ref_type + ref_type->generic.len + 2;
691  const union codeview_fieldtype* type;
692 
693  while (ptr < last)
694  {
695  if (*ptr >= 0xf0) /* LF_PAD... */
696  {
697  ptr += *ptr & 0x0f;
698  continue;
699  }
700 
701  type = (const union codeview_fieldtype*)ptr;
702 
703  switch (type->generic.id)
704  {
705  case LF_ENUMERATE_V1:
706  {
707  int value, vlen = numeric_leaf(&value, &type->enumerate_v1.value);
708  const struct p_string* p_name = (const struct p_string*)((const unsigned char*)&type->enumerate_v1.value + vlen);
709 
711  ptr += 2 + 2 + vlen + (1 + p_name->namelen);
712  break;
713  }
714  case LF_ENUMERATE_V3:
715  {
716  int value, vlen = numeric_leaf(&value, &type->enumerate_v3.value);
717  const char* name = (const char*)&type->enumerate_v3.value + vlen;
718 
720  ptr += 2 + 2 + vlen + (1 + strlen(name));
721  break;
722  }
723 
724  default:
725  FIXME("Unsupported type %04x in ENUM field list\n", type->generic.id);
726  return FALSE;
727  }
728  }
729  return TRUE;
730 }
#define TRUE
Definition: types.h:120
BOOL symt_add_enum_element(struct module *module, struct symt_enum *enum_type, const char *name, int value) DECLSPEC_HIDDEN
Definition: type.c:320
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
POINT last
Definition: font.c:46
#define LF_ENUMERATE_V3
Definition: mscvpdb.h:1201
struct codeview_reftype::@3438 fieldlist
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
struct codeview_reftype::@3437 generic
while(1)
Definition: macro.lex.yy.c:740
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
#define LF_ENUMERATE_V1
Definition: mscvpdb.h:1172
unsigned char BYTE
Definition: mem.h:68
GLsizei const GLfloat * value
Definition: glext.h:6069
static int numeric_leaf(int *value, const unsigned short int *leaf)
Definition: msc.c:392
static const char * terminate_string(const struct p_string *p_name)
Definition: msc.c:510
Definition: name.c:36
unsigned char namelen
Definition: mscvpdb.h:109

Referenced by codeview_add_type_enum().

◆ codeview_add_type_pointer()

static struct symt* codeview_add_type_pointer ( struct codeview_type_parse ctp,
struct symt existing,
unsigned int  pointee_type 
)
static

Definition at line 658 of file msc.c.

661 {
662  struct symt* pointee;
663 
664  if (existing)
665  {
666  existing = codeview_cast_symt(existing, SymTagPointerType);
667  return existing;
668  }
669  pointee = codeview_fetch_type(ctp, pointee_type, FALSE);
670  return &symt_new_pointer(ctp->module, pointee, sizeof(void *))->symt;
671 }
static struct symt * codeview_fetch_type(struct codeview_type_parse *ctp, unsigned typeno, BOOL details)
Definition: msc.c:638
static void * codeview_cast_symt(struct symt *symt, enum SymTagEnum tag)
Definition: msc.c:628
struct symt_pointer * symt_new_pointer(struct module *module, struct symt *ref_type, unsigned long size) DECLSPEC_HIDDEN
Definition: type.c:415
struct module * module
Definition: msc.c:556

Referenced by codeview_parse_one_type().

◆ codeview_add_type_struct()

static struct symt* codeview_add_type_struct ( struct codeview_type_parse ctp,
struct symt existing,
const char name,
int  structlen,
enum UdtKind  kind,
unsigned  property 
)
static

Definition at line 1017 of file msc.c.

1021 {
1022  struct symt_udt* symt;
1023 
1024  /* if we don't have an existing type, try to find one with same name
1025  * FIXME: what to do when several types in different CUs have same name ?
1026  */
1027  if (!existing)
1028  {
1029  void* ptr;
1030  struct symt_ht* type;
1031  struct hash_table_iter hti;
1032 
1033  hash_table_iter_init(&ctp->module->ht_types, &hti, name);
1034  while ((ptr = hash_table_iter_up(&hti)))
1035  {
1036  type = CONTAINING_RECORD(ptr, struct symt_ht, hash_elt);
1037 
1038  if (type->symt.tag == SymTagUDT &&
1039  type->hash_elt.name && !strcmp(type->hash_elt.name, name))
1040  {
1041  existing = &type->symt;
1042  break;
1043  }
1044  }
1045  }
1046  if (existing)
1047  {
1048  if (!(symt = codeview_cast_symt(existing, SymTagUDT))) return NULL;
1049  /* should also check that all fields are the same */
1050  if (!(property & 0x80)) /* 0x80 = forward declaration */
1051  {
1052  if (!symt->size) /* likely prior forward declaration, set UDT size */
1053  symt_set_udt_size(ctp->module, symt, structlen);
1054  else /* different UDT with same name, create a new type */
1055  existing = NULL;
1056  }
1057  }
1058  if (!existing) symt = symt_new_udt(ctp->module, name, structlen, kind);
1059 
1060  return &symt->symt;
1061 }
BOOL symt_set_udt_size(struct module *module, struct symt_udt *type, unsigned size) DECLSPEC_HIDDEN
Definition: type.c:243
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
struct symt symt
static void * codeview_cast_symt(struct symt *symt, enum SymTagEnum tag)
Definition: msc.c:628
static PVOID ptr
Definition: dispmode.c:27
void hash_table_iter_init(const struct hash_table *ht, struct hash_table_iter *hti, const char *name) DECLSPEC_HIDDEN
Definition: storage.c:406
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
void * hash_table_iter_up(struct hash_table_iter *hti) DECLSPEC_HIDDEN
Definition: storage.c:423
struct symt_udt * symt_new_udt(struct module *module, const char *typename, unsigned size, enum UdtKind kind) DECLSPEC_HIDDEN
Definition: type.c:220
struct module * module
Definition: msc.c:556
Definition: name.c:36
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by codeview_parse_one_type().

◆ codeview_add_type_struct_field_list()

static int codeview_add_type_struct_field_list ( struct codeview_type_parse ctp,
struct symt_udt symt,
unsigned  fieldlistno 
)
static

Definition at line 768 of file msc.c.

771 {
772  const unsigned char* ptr;
773  const unsigned char* last;
774  int value, leaf_len;
775  const struct p_string* p_name;
776  const char* c_name;
777  const union codeview_reftype*type_ref;
778  const union codeview_fieldtype* type;
779 
780  if (!fieldlistno) return TRUE;
781  type_ref = codeview_jump_to_type(ctp, fieldlistno);
782  ptr = type_ref->fieldlist.list;
783  last = (const BYTE*)type_ref + type_ref->generic.len + 2;
784 
785  while (ptr < last)
786  {
787  if (*ptr >= 0xf0) /* LF_PAD... */
788  {
789  ptr += *ptr & 0x0f;
790  continue;
791  }
792 
793  type = (const union codeview_fieldtype*)ptr;
794 
795  switch (type->generic.id)
796  {
797  case LF_BCLASS_V1:
798  leaf_len = numeric_leaf(&value, &type->bclass_v1.offset);
799 
800  /* FIXME: ignored for now */
801 
802  ptr += 2 + 2 + 2 + leaf_len;
803  break;
804 
805  case LF_BCLASS_V2:
806  leaf_len = numeric_leaf(&value, &type->bclass_v2.offset);
807 
808  /* FIXME: ignored for now */
809 
810  ptr += 2 + 2 + 4 + leaf_len;
811  break;
812 
813  case LF_VBCLASS_V1:
814  case LF_IVBCLASS_V1:
815  {
816  const unsigned short int* p_vboff;
817  int vpoff, vplen;
818  leaf_len = numeric_leaf(&value, &type->vbclass_v1.vbpoff);
819  p_vboff = (const unsigned short int*)((const char*)&type->vbclass_v1.vbpoff + leaf_len);
820  vplen = numeric_leaf(&vpoff, p_vboff);
821 
822  /* FIXME: ignored for now */
823 
824  ptr += 2 + 2 + 2 + 2 + leaf_len + vplen;
825  }
826  break;
827 
828  case LF_VBCLASS_V2:
829  case LF_IVBCLASS_V2:
830  {
831  const unsigned short int* p_vboff;
832  int vpoff, vplen;
833  leaf_len = numeric_leaf(&value, &type->vbclass_v2.vbpoff);
834  p_vboff = (const unsigned short int*)((const char*)&type->vbclass_v2.vbpoff + leaf_len);
835  vplen = numeric_leaf(&vpoff, p_vboff);
836 
837  /* FIXME: ignored for now */
838 
839  ptr += 2 + 2 + 4 + 4 + leaf_len + vplen;
840  }
841  break;
842 
843  case LF_MEMBER_V1:
844  leaf_len = numeric_leaf(&value, &type->member_v1.offset);
845  p_name = (const struct p_string*)((const char*)&type->member_v1.offset + leaf_len);
846 
848  type->member_v1.type);
849 
850  ptr += 2 + 2 + 2 + leaf_len + (1 + p_name->namelen);
851  break;
852 
853  case LF_MEMBER_V2:
854  leaf_len = numeric_leaf(&value, &type->member_v2.offset);
855  p_name = (const struct p_string*)((const unsigned char*)&type->member_v2.offset + leaf_len);
856 
858  type->member_v2.type);
859 
860  ptr += 2 + 2 + 4 + leaf_len + (1 + p_name->namelen);
861  break;
862 
863  case LF_MEMBER_V3:
864  leaf_len = numeric_leaf(&value, &type->member_v3.offset);
865  c_name = (const char*)&type->member_v3.offset + leaf_len;
866 
867  codeview_add_udt_element(ctp, symt, c_name, value, type->member_v3.type);
868 
869  ptr += 2 + 2 + 4 + leaf_len + (strlen(c_name) + 1);
870  break;
871 
872  case LF_STMEMBER_V1:
873  /* FIXME: ignored for now */
874  ptr += 2 + 2 + 2 + (1 + type->stmember_v1.p_name.namelen);
875  break;
876 
877  case LF_STMEMBER_V2:
878  /* FIXME: ignored for now */
879  ptr += 2 + 4 + 2 + (1 + type->stmember_v2.p_name.namelen);
880  break;
881 
882  case LF_STMEMBER_V3:
883  /* FIXME: ignored for now */
884  ptr += 2 + 4 + 2 + (strlen(type->stmember_v3.name) + 1);
885  break;
886 
887  case LF_METHOD_V1:
888  /* FIXME: ignored for now */
889  ptr += 2 + 2 + 2 + (1 + type->method_v1.p_name.namelen);
890  break;
891 
892  case LF_METHOD_V2:
893  /* FIXME: ignored for now */
894  ptr += 2 + 2 + 4 + (1 + type->method_v2.p_name.namelen);
895  break;
896 
897  case LF_METHOD_V3:
898  /* FIXME: ignored for now */
899  ptr += 2 + 2 + 4 + (strlen(type->method_v3.name) + 1);
900  break;
901 
902  case LF_NESTTYPE_V1:
903  /* FIXME: ignored for now */
904  ptr += 2 + 2 + (1 + type->nesttype_v1.p_name.namelen);
905  break;
906 
907  case LF_NESTTYPE_V2:
908  /* FIXME: ignored for now */
909  ptr += 2 + 2 + 4 + (1 + type->nesttype_v2.p_name.namelen);
910  break;
911 
912  case LF_NESTTYPE_V3:
913  /* FIXME: ignored for now */
914  ptr += 2 + 2 + 4 + (strlen(type->nesttype_v3.name) + 1);
915  break;
916 
917  case LF_VFUNCTAB_V1:
918  /* FIXME: ignored for now */
919  ptr += 2 + 2;
920  break;
921 
922  case LF_VFUNCTAB_V2:
923  /* FIXME: ignored for now */
924  ptr += 2 + 2 + 4;
925  break;
926 
927  case LF_ONEMETHOD_V1:
928  /* FIXME: ignored for now */
929  switch ((type->onemethod_v1.attribute >> 2) & 7)
930  {
931  case 4: case 6: /* (pure) introducing virtual method */
932  ptr += 2 + 2 + 2 + 4 + (1 + type->onemethod_virt_v1.p_name.namelen);
933  break;
934 
935  default:
936  ptr += 2 + 2 + 2 + (1 + type->onemethod_v1.p_name.namelen);
937  break;
938  }
939  break;
940 
941  case LF_ONEMETHOD_V2:
942  /* FIXME: ignored for now */
943  switch ((type->onemethod_v2.attribute >> 2) & 7)
944  {
945  case 4: case 6: /* (pure) introducing virtual method */
946  ptr += 2 + 2 + 4 + 4 + (1 + type->onemethod_virt_v2.p_name.namelen);
947  break;
948 
949  default:
950  ptr += 2 + 2 + 4 + (1 + type->onemethod_v2.p_name.namelen);
951  break;
952  }
953  break;
954 
955  case LF_ONEMETHOD_V3:
956  /* FIXME: ignored for now */
957  switch ((type->onemethod_v3.attribute >> 2) & 7)
958  {
959  case 4: case 6: /* (pure) introducing virtual method */
960  ptr += 2 + 2 + 4 + 4 + (strlen(type->onemethod_virt_v3.name) + 1);
961  break;
962 
963  default:
964  ptr += 2 + 2 + 4 + (strlen(type->onemethod_v3.name) + 1);
965  break;
966  }
967  break;
968 
969  case LF_INDEX_V1:
970  if (!codeview_add_type_struct_field_list(ctp, symt, type->index_v1.ref))
971  return FALSE;
972  ptr += 2 + 2;
973  break;
974 
975  case LF_INDEX_V2:
976  if (!codeview_add_type_struct_field_list(ctp, symt, type->index_v2.ref))
977  return FALSE;
978  ptr += 2 + 2 + 4;
979  break;
980 
981  default:
982  FIXME("Unsupported type %04x in STRUCT field list\n", type->generic.id);
983  return FALSE;
984  }
985  }
986 
987  return TRUE;
988 }
#define LF_IVBCLASS_V1
Definition: mscvpdb.h:1171
#define TRUE
Definition: types.h:120
#define LF_VFUNCTAB_V1
Definition: mscvpdb.h:1179
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
POINT last
Definition: font.c:46
struct codeview_reftype::@3438 fieldlist
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define LF_VFUNCTAB_V2
Definition: mscvpdb.h:1195
#define LF_MEMBER_V2
Definition: mscvpdb.h:1191
#define LF_BCLASS_V2
Definition: mscvpdb.h:1186
#define LF_ONEMETHOD_V1
Definition: mscvpdb.h:1181
struct codeview_reftype::@3437 generic
while(1)
Definition: macro.lex.yy.c:740
#define LF_ONEMETHOD_V3
Definition: mscvpdb.h:1211
static void codeview_add_udt_element(struct codeview_type_parse *ctp, struct symt_udt *symt, const char *name, int value, unsigned type)
Definition: msc.c:732
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
#define LF_NESTTYPE_V2
Definition: mscvpdb.h:1194
#define LF_METHOD_V1
Definition: mscvpdb.h:1177
static int codeview_add_type_struct_field_list(struct codeview_type_parse *ctp, struct symt_udt *symt, unsigned fieldlistno)
Definition: msc.c:768
#define LF_STMEMBER_V3
Definition: mscvpdb.h:1208
#define LF_METHOD_V3
Definition: mscvpdb.h:1209
enum value::value_type type
#define LF_NESTTYPE_V3
Definition: mscvpdb.h:1210
unsigned char BYTE
Definition: mem.h:68
GLsizei const GLfloat * value
Definition: glext.h:6069
#define LF_MEMBER_V1
Definition: mscvpdb.h:1175
#define LF_MEMBER_V3
Definition: mscvpdb.h:1207
struct p_string p_name
Definition: mscvpdb.h:496
#define LF_STMEMBER_V1
Definition: mscvpdb.h:1176
static const void * codeview_jump_to_type(const struct codeview_type_parse *ctp, DWORD idx)
Definition: msc.c:562
#define LF_STMEMBER_V2
Definition: mscvpdb.h:1192
static int numeric_leaf(int *value, const unsigned short int *leaf)
Definition: msc.c:392
#define LF_INDEX_V2
Definition: mscvpdb.h:1190
#define LF_NESTTYPE_V1
Definition: mscvpdb.h:1178
#define LF_METHOD_V2
Definition: mscvpdb.h:1193
static const char * terminate_string(const struct p_string *p_name)
Definition: msc.c:510
#define LF_VBCLASS_V1
Definition: mscvpdb.h:1170
#define LF_INDEX_V1
Definition: mscvpdb.h:1174
#define LF_VBCLASS_V2
Definition: mscvpdb.h:1187
#define LF_ONEMETHOD_V2
Definition: mscvpdb.h:1197
unsigned char namelen
Definition: mscvpdb.h:109
#define LF_IVBCLASS_V2
Definition: mscvpdb.h:1188
#define LF_BCLASS_V1
Definition: mscvpdb.h:1169

Referenced by codeview_parse_one_type().

◆ codeview_add_udt_element()

static void codeview_add_udt_element ( struct codeview_type_parse ctp,
struct symt_udt symt,
const char name,
int  value,
unsigned  type 
)
static

Definition at line 732 of file msc.c.

735 {
736  struct symt* subtype;
737  const union codeview_reftype*cv_type;
738 
739  if ((cv_type = codeview_jump_to_type(ctp, type)))
740  {
741  switch (cv_type->generic.id)
742  {
743  case LF_BITFIELD_V1:
745  codeview_fetch_type(ctp, cv_type->bitfield_v1.type, FALSE),
746  (value << 3) + cv_type->bitfield_v1.bitoff,
747  cv_type->bitfield_v1.nbits);
748  return;
749  case LF_BITFIELD_V2:
751  codeview_fetch_type(ctp, cv_type->bitfield_v2.type, FALSE),
752  (value << 3) + cv_type->bitfield_v2.bitoff,
753  cv_type->bitfield_v2.nbits);
754  return;
755  }
756  }
757  subtype = codeview_fetch_type(ctp, type, FALSE);
758 
759  if (subtype)
760  {
761  DWORD64 elem_size = 0;
762  symt_get_info(ctp->module, subtype, TI_GET_LENGTH, &elem_size);
763  symt_add_udt_element(ctp->module, symt, name, subtype,
764  value << 3, (DWORD)elem_size << 3);
765  }
766 }
struct codeview_reftype::@3440 bitfield_v2
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
struct codeview_reftype::@3437 generic
static struct symt * codeview_fetch_type(struct codeview_type_parse *ctp, unsigned typeno, BOOL details)
Definition: msc.c:638
#define LF_BITFIELD_V1
Definition: mscvpdb.h:1148
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
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
#define LF_BITFIELD_V2
Definition: mscvpdb.h:1161
static const void * codeview_jump_to_type(const struct codeview_type_parse *ctp, DWORD idx)
Definition: msc.c:562
struct codeview_reftype::@3439 bitfield_v1
struct module * module
Definition: msc.c:556
Definition: name.c:36

Referenced by codeview_add_type_struct_field_list().

◆ codeview_add_variable()

static void codeview_add_variable ( const struct msc_debug_info msc_dbg,
struct symt_compiland compiland,
const char name,
unsigned  segment,
unsigned  offset,
unsigned  symtype,
BOOL  is_local,
BOOL  in_tls,
BOOL  force 
)
inlinestatic

Definition at line 1569 of file msc.c.

1574 {
1575  if (name && *name)
1576  {
1577  struct location loc;
1578 
1579  loc.kind = in_tls ? loc_tlsrel : loc_absolute;
1580  loc.reg = 0;
1581  loc.offset = in_tls ? offset : codeview_get_address(msc_dbg, segment, offset);
1582  if (force || in_tls || !symt_find_nearest(msc_dbg->module, loc.offset))
1583  {
1584  symt_new_global_variable(msc_dbg->module, compiland,
1585  name, is_local, loc, 0,
1586  codeview_get_type(symtype, FALSE));
1587  }
1588  }
1589 }
int is_local(const attr_list_t *a)
Definition: header.c:938
GLintptr offset
Definition: glext.h:5920
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
static unsigned long codeview_get_address(const struct msc_debug_info *msc_dbg, unsigned seg, unsigned offset)
Definition: msc.c:1558
unsigned kind
static struct symt * codeview_get_type(unsigned int typeno, BOOL quiet)
Definition: msc.c:520
struct module * module
Definition: mscvpdb.h:2124
Definition: name.c:36
struct symt_ht * symt_find_nearest(struct module *module, DWORD_PTR addr) DECLSPEC_HIDDEN
Definition: symbol.c:905

Referenced by codeview_snarf(), and codeview_snarf_public().

◆ codeview_cast_symt()

static void* codeview_cast_symt ( struct symt symt,
enum SymTagEnum  tag 
)
static

Definition at line 628 of file msc.c.

629 {
630  if (symt->tag != tag)
631  {
632  FIXME("Bad tag. Expected %d, but got %d\n", tag, symt->tag);
633  return NULL;
634  }
635  return symt;
636 }
Definition: ecma_167.h:138
enum SymTagEnum tag
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416

Referenced by codeview_add_type_enum(), codeview_add_type_pointer(), codeview_add_type_struct(), codeview_new_func_signature(), and codeview_parse_one_type().

◆ codeview_clear_type_table()

static void codeview_clear_type_table ( void  )
static

Definition at line 609 of file msc.c.

610 {
611  int i;
612 
613  for (i = 0; i < CV_MAX_MODULES; i++)
614  {
615  if (cv_zmodules[i].allowed)
616  HeapFree(GetProcessHeap(), 0, cv_zmodules[i].defined_types);
617  cv_zmodules[i].allowed = FALSE;
618  cv_zmodules[i].defined_types = NULL;
619  cv_zmodules[i].num_defined_types = 0;
620  }
622 }
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
static struct cv_defined_module cv_zmodules[CV_MAX_MODULES]
Definition: msc.c:144
#define GetProcessHeap()
Definition: compat.h:395
#define CV_MAX_MODULES
Definition: msc.c:143
static struct cv_defined_module * cv_current_module
Definition: msc.c:145
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by codeview_process_info(), and pdb_process_file().

◆ codeview_fetch_type()

static struct symt* codeview_fetch_type ( struct codeview_type_parse ctp,
unsigned  typeno,
BOOL  details 
)
static

Definition at line 638 of file msc.c.

640 {
641  struct symt* symt;
642  const union codeview_type* p;
643 
644  if (!typeno) return NULL;
645  if ((symt = codeview_get_type(typeno, TRUE))) return symt;
646 
647  /* forward declaration */
648  if (!(p = codeview_jump_to_type(ctp, typeno)))
649  {
650  FIXME("Cannot locate type %x\n", typeno);
651  return NULL;
652  }
653  symt = codeview_parse_one_type(ctp, typeno, p, details);
654  if (!symt) FIXME("Couldn't load forward type %x\n", typeno);
655  return symt;
656 }
#define TRUE
Definition: types.h:120
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
static struct symt * codeview_parse_one_type(struct codeview_type_parse *ctp, unsigned curr_type, const union codeview_type *type, BOOL details)
Definition: msc.c:1110
static const void * codeview_jump_to_type(const struct codeview_type_parse *ctp, DWORD idx)
Definition: msc.c:562
static struct symt * codeview_get_type(unsigned int typeno, BOOL quiet)
Definition: msc.c:520
int details
Definition: msacm.c:1353
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by codeview_add_func_signature_args(), codeview_add_type_array(), codeview_add_type_enum(), codeview_add_type_pointer(), codeview_add_udt_element(), and codeview_parse_one_type().

◆ codeview_get_address()

static unsigned long codeview_get_address ( const struct msc_debug_info msc_dbg,
unsigned  seg,
unsigned  offset 
)
static

Definition at line 1558 of file msc.c.

1560 {
1561  int nsect = msc_dbg->nsect;
1562  const IMAGE_SECTION_HEADER* sectp = msc_dbg->sectp;
1563 
1564  if (!seg || seg > nsect) return 0;
1565  return msc_dbg->module->module.BaseOfImage +
1566  codeview_map_offset(msc_dbg, sectp[seg-1].VirtualAddress + offset);
1567 }
GLintptr offset
Definition: glext.h:5920
static unsigned int codeview_map_offset(const struct msc_debug_info *msc_dbg, unsigned int offset)
Definition: msc.c:1541
_In_ ULONG _In_ BOOLEAN _Must_inspect_result_ PVOID * VirtualAddress
Definition: ndis.h:3791
seg
Definition: i386-dis.c:3857
struct module * module
Definition: mscvpdb.h:2124
const IMAGE_SECTION_HEADER * sectp
Definition: mscvpdb.h:2126

Referenced by codeview_add_variable(), codeview_snarf(), codeview_snarf_linetab(), codeview_snarf_linetab2(), and codeview_snarf_public().

◆ codeview_get_type()

static struct symt* codeview_get_type ( unsigned int  typeno,
BOOL  quiet 
)
static

Definition at line 520 of file msc.c.

521 {
522  struct symt* symt = NULL;
523 
524  /*
525  * Convert Codeview type numbers into something we can grok internally.
526  * Numbers < FIRST_DEFINABLE_TYPE are all fixed builtin types.
527  * Numbers from FIRST_DEFINABLE_TYPE and up are all user defined (structs, etc).
528  */
529  if (typeno < FIRST_DEFINABLE_TYPE)
530  {
531  if (typeno < MAX_BUILTIN_TYPES)
532  symt = cv_basic_types[typeno];
533  }
534  else
535  {
536  unsigned mod_index = typeno >> 24;
537  unsigned mod_typeno = typeno & 0x00FFFFFF;
538  struct cv_defined_module* mod;
539 
540  mod = (mod_index == 0) ? cv_current_module : &cv_zmodules[mod_index];
541 
542  if (mod_index >= CV_MAX_MODULES || !mod->allowed)
543  FIXME("Module of index %d isn't loaded yet (%x)\n", mod_index, typeno);
544  else
545  {
546  if (mod_typeno - FIRST_DEFINABLE_TYPE < mod->num_defined_types)
547  symt = mod->defined_types[mod_typeno - FIRST_DEFINABLE_TYPE];
548  }
549  }
550  if (!quiet && !symt && typeno) FIXME("Returning NULL symt for type-id %x\n", typeno);
551  return symt;
552 }
static struct symt * cv_basic_types[MAX_BUILTIN_TYPES]
Definition: msc.c:134
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
static struct cv_defined_module cv_zmodules[CV_MAX_MODULES]
Definition: msc.c:144
#define CV_MAX_MODULES
Definition: msc.c:143
#define MAX_BUILTIN_TYPES
Definition: msc.c:131
static struct cv_defined_module * cv_current_module
Definition: msc.c:145
unsigned int num_defined_types
Definition: msc.c:139
#define FIRST_DEFINABLE_TYPE
Definition: msc.c:132
static int mod
Definition: i386-dis.c:1273

Referenced by codeview_add_variable(), codeview_fetch_type(), codeview_parse_one_type(), and codeview_snarf().

◆ codeview_init_basic_types()

static void codeview_init_basic_types ( struct module module)
static

Definition at line 147 of file msc.c.

148 {
149  /*
150  * These are the common builtin types that are used by VC++.
151  */
154  cv_basic_types[T_VOID] = &symt_new_basic(module, btVoid, "void", 0)->symt;
155  cv_basic_types[T_CHAR] = &symt_new_basic(module, btChar, "char", 1)->symt;
156  cv_basic_types[T_SHORT] = &symt_new_basic(module, btInt, "short int", 2)->symt;
157  cv_basic_types[T_LONG] = &symt_new_basic(module, btInt, "long int", 4)->symt;
158  cv_basic_types[T_QUAD] = &symt_new_basic(module, btInt, "long long int", 8)->symt;
159  cv_basic_types[T_UCHAR] = &symt_new_basic(module, btUInt, "unsigned char", 1)->symt;
160  cv_basic_types[T_USHORT] = &symt_new_basic(module, btUInt, "unsigned short", 2)->symt;
161  cv_basic_types[T_ULONG] = &symt_new_basic(module, btUInt, "unsigned long", 4)->symt;
162  cv_basic_types[T_UQUAD] = &symt_new_basic(module, btUInt, "unsigned long long", 8)->symt;
163  cv_basic_types[T_BOOL08] = &symt_new_basic(module, btBool, "BOOL08", 1)->symt;
164  cv_basic_types[T_BOOL16] = &symt_new_basic(module, btBool, "BOOL16", 2)->symt;
165  cv_basic_types[T_BOOL32] = &symt_new_basic(module, btBool, "BOOL32", 4)->symt;
166  cv_basic_types[T_BOOL64] = &symt_new_basic(module, btBool, "BOOL64", 8)->symt;
167  cv_basic_types[T_REAL32] = &symt_new_basic(module, btFloat, "float", 4)->symt;
168  cv_basic_types[T_REAL64] = &symt_new_basic(module, btFloat, "double", 8)->symt;
169  cv_basic_types[T_REAL80] = &symt_new_basic(module, btFloat, "long double", 10)->symt;
170  cv_basic_types[T_RCHAR] = &symt_new_basic(module, btInt, "signed char", 1)->symt;
171  cv_basic_types[T_WCHAR] = &symt_new_basic(module, btWChar, "wchar_t", 2)->symt;
172  cv_basic_types[T_CHAR16] = &symt_new_basic(module, btChar16,"char16_t", 2)->symt;
173  cv_basic_types[T_CHAR32] = &symt_new_basic(module, btChar32,"char32_t", 4)->symt;
174  cv_basic_types[T_INT2] = &symt_new_basic(module, btInt, "INT2", 2)->symt;
175  cv_basic_types[T_UINT2] = &symt_new_basic(module, btUInt, "UINT2", 2)->symt;
176  cv_basic_types[T_INT4] = &symt_new_basic(module, btInt, "INT4", 4)->symt;
177  cv_basic_types[T_UINT4] = &symt_new_basic(module, btUInt, "UINT4", 4)->symt;
178  cv_basic_types[T_INT8] = &symt_new_basic(module, btInt, "INT8", 8)->symt;
179  cv_basic_types[T_UINT8] = &symt_new_basic(module, btUInt, "UINT8", 8)->symt;
180  cv_basic_types[T_HRESULT]= &symt_new_basic(module, btUInt, "HRESULT", 4)->symt;
181 
209 
237 
264 }
#define T_REAL80
Definition: mscvpdb.h:859
#define T_WCHAR
Definition: mscvpdb.h:869
#define T_PINT4
Definition: mscvpdb.h:906
#define T_UCHAR
Definition: mscvpdb.h:849
#define T_PCHAR32
Definition: mscvpdb.h:911
#define T_32PUINT4
Definition: mscvpdb.h:1010
#define T_PREAL32
Definition: mscvpdb.h:893
#define T_UQUAD
Definition: mscvpdb.h:852
#define T_64PSHORT
Definition: mscvpdb.h:1055
#define T_BOOL32
Definition: mscvpdb.h:855
#define T_PBOOL64
Definition: mscvpdb.h:892
#define T_PVOID
Definition: mscvpdb.h:880
#define T_64PVOID
Definition: mscvpdb.h:1052
#define T_PUSHORT
Definition: mscvpdb.h:886
#define T_32PLONG
Definition: mscvpdb.h:986
#define T_64PREAL32
Definition: mscvpdb.h:1066
#define T_32PBOOL16
Definition: mscvpdb.h:993
static struct symt * cv_basic_types[MAX_BUILTIN_TYPES]
Definition: msc.c:134
#define T_32PINT4
Definition: mscvpdb.h:1009
#define T_PUINT4
Definition: mscvpdb.h:907
#define T_UINT2
Definition: mscvpdb.h:871
#define T_PBOOL32
Definition: mscvpdb.h:891
#define T_CHAR32
Definition: mscvpdb.h:877
#define T_32PREAL80
Definition: mscvpdb.h:998
#define T_32PBOOL32
Definition: mscvpdb.h:994
#define T_64PBOOL16
Definition: mscvpdb.h:1063
#define T_64PBOOL08
Definition: mscvpdb.h:1062
#define T_BOOL16
Definition: mscvpdb.h:854
#define T_PUCHAR
Definition: mscvpdb.h:885
#define T_BOOL08
Definition: mscvpdb.h:853
#define T_PUINT8
Definition: mscvpdb.h:909
#define T_32PUINT8
Definition: mscvpdb.h:1012
#define T_LONG
Definition: mscvpdb.h:847
#define T_SHORT
Definition: mscvpdb.h:846
#define T_PINT8
Definition: mscvpdb.h:908
#define T_32PREAL64
Definition: mscvpdb.h:997
#define T_UINT4
Definition: mscvpdb.h:873
#define T_INT8
Definition: mscvpdb.h:874
#define T_64PINT4
Definition: mscvpdb.h:1079
#define T_64PUINT4
Definition: mscvpdb.h:1080
#define T_INT4
Definition: mscvpdb.h:872
#define T_32PUCHAR
Definition: mscvpdb.h:988
#define T_32PSHORT
Definition: mscvpdb.h:985
#define T_32PREAL32
Definition: mscvpdb.h:996
#define T_32PRCHAR
Definition: mscvpdb.h:1005
#define T_64PCHAR
Definition: mscvpdb.h:1054
#define T_32PCHAR
Definition: mscvpdb.h:984
#define T_USHORT
Definition: mscvpdb.h:850
#define T_64PWCHAR
Definition: mscvpdb.h:1076
smooth NULL
Definition: ftsmooth.c:416
#define T_32PBOOL64
Definition: mscvpdb.h:995
#define T_PCHAR16
Definition: mscvpdb.h:910
#define T_PQUAD
Definition: mscvpdb.h:884
#define T_PLONG
Definition: mscvpdb.h:883
#define T_REAL32
Definition: mscvpdb.h:857
struct symt_basic * symt_new_basic(struct module *module, enum BasicType, const char *typename, unsigned size) DECLSPEC_HIDDEN
Definition: type.c:193
#define T_64PUCHAR
Definition: mscvpdb.h:1058
#define T_64PCHAR16
Definition: mscvpdb.h:1083
#define T_32PBOOL08
Definition: mscvpdb.h:992
#define T_PBOOL16
Definition: mscvpdb.h:890
#define T_32PUINT2
Definition: mscvpdb.h:1008
#define T_32PCHAR32
Definition: mscvpdb.h:1014
struct symt_pointer * symt_new_pointer(struct module *module, struct symt *ref_type, unsigned long size) DECLSPEC_HIDDEN
Definition: type.c:415
#define T_32PUSHORT
Definition: mscvpdb.h:989
#define T_64PUQUAD
Definition: mscvpdb.h:1061
#define T_INT2
Definition: mscvpdb.h:870
#define T_64PBOOL64
Definition: mscvpdb.h:1065
#define T_PULONG
Definition: mscvpdb.h:887
#define T_PREAL80
Definition: mscvpdb.h:895
#define T_BOOL64
Definition: mscvpdb.h:856
#define T_PRCHAR
Definition: mscvpdb.h:902
#define T_REAL64
Definition: mscvpdb.h:858
#define T_PINT2
Definition: mscvpdb.h:904
#define T_32PQUAD
Definition: mscvpdb.h:987
#define T_32PWCHAR
Definition: mscvpdb.h:1006
#define T_PUINT2
Definition: mscvpdb.h:905
#define T_32PCHAR16
Definition: mscvpdb.h:1013
#define T_ABS
Definition: mscvpdb.h:837
#define T_32PULONG
Definition: mscvpdb.h:990
#define T_64PINT2
Definition: mscvpdb.h:1077
#define T_PUQUAD
Definition: mscvpdb.h:888
#define T_64PUINT8
Definition: mscvpdb.h:1082
#define T_NOTYPE
Definition: mscvpdb.h:836
#define T_64PQUAD
Definition: mscvpdb.h:1057
#define T_32PUQUAD
Definition: mscvpdb.h:991
#define T_PWCHAR
Definition: mscvpdb.h:903
#define T_UINT8
Definition: mscvpdb.h:875
#define T_64PREAL64
Definition: mscvpdb.h:1067
#define T_64PHRESULT
Definition: mscvpdb.h:1053
#define T_PBOOL08
Definition: mscvpdb.h:889
#define T_64PUINT2
Definition: mscvpdb.h:1078
#define T_PCHAR
Definition: mscvpdb.h:881
#define T_32PVOID
Definition: mscvpdb.h:982
#define T_64PINT8
Definition: mscvpdb.h:1081
#define T_CHAR
Definition: mscvpdb.h:845
#define T_32PINT8
Definition: mscvpdb.h:1011
Definition: compat.h:1262
#define T_ULONG
Definition: mscvpdb.h:851
#define T_PREAL64
Definition: mscvpdb.h:894
#define T_RCHAR
Definition: mscvpdb.h:868
#define T_64PCHAR32
Definition: mscvpdb.h:1084
#define T_64PLONG
Definition: mscvpdb.h:1056
#define T_32PINT2
Definition: mscvpdb.h:1007
#define T_64PBOOL32
Definition: mscvpdb.h:1064
#define T_64PREAL80
Definition: mscvpdb.h:1068
#define T_CHAR16
Definition: mscvpdb.h:876
#define T_VOID
Definition: mscvpdb.h:839
#define T_32PHRESULT
Definition: mscvpdb.h:983
#define T_64PUSHORT
Definition: mscvpdb.h:1059
#define T_HRESULT
Definition: mscvpdb.h:844
#define T_64PRCHAR
Definition: mscvpdb.h:1075
#define T_64PULONG
Definition: mscvpdb.h:1060
#define T_QUAD
Definition: mscvpdb.h:848
#define T_PSHORT
Definition: mscvpdb.h:882

Referenced by codeview_process_info(), and pdb_process_file().

◆ codeview_jump_to_type()

static const void* codeview_jump_to_type ( const struct codeview_type_parse ctp,
DWORD  idx 
)
inlinestatic

Definition at line 562 of file msc.c.

563 {
564  if (idx < FIRST_DEFINABLE_TYPE) return NULL;
566  return (idx >= ctp->num) ? NULL : (ctp->table + ctp->offset[idx]);
567 }
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
const DWORD * offset
Definition: msc.c:558
const BYTE * table
Definition: msc.c:557
#define FIRST_DEFINABLE_TYPE
Definition: msc.c:132

Referenced by codeview_add_func_signature_args(), codeview_add_type_enum(), codeview_add_type_struct_field_list(), codeview_add_udt_element(), codeview_fetch_type(), and codeview_parse_type_table().

◆ codeview_map_offset()

static unsigned int codeview_map_offset ( const struct msc_debug_info msc_dbg,
unsigned int  offset 
)
static

Definition at line 1541 of file msc.c.

1543 {
1544  int nomap = msc_dbg->nomap;
1545  const OMAP_DATA* omapp = msc_dbg->omapp;
1546  int i;
1547 
1548  if (!nomap || !omapp) return offset;
1549 
1550  /* FIXME: use binary search */
1551  for (i = 0; i < nomap - 1; i++)
1552  if (omapp[i].from <= offset && omapp[i+1].from > offset)
1553  return !omapp[i].to ? 0 : omapp[i].to + (offset - omapp[i].from);
1554 
1555  return 0;
1556 }
GLintptr offset
Definition: glext.h:5920
DWORD to
Definition: mscvpdb.h:2119
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
DWORD from
Definition: mscvpdb.h:2118
CardRegion * from
Definition: spigame.cpp:19
const OMAP_DATA * omapp
Definition: mscvpdb.h:2128

Referenced by codeview_get_address().

◆ codeview_new_func_signature()

static struct symt* codeview_new_func_signature ( struct codeview_type_parse ctp,
struct symt existing,
enum CV_call_e  call_conv 
)
static

Definition at line 1063 of file msc.c.

1066 {
1067  struct symt_function_signature* sym;
1068 
1069  if (existing)
1070  {
1071  sym = codeview_cast_symt(existing, SymTagFunctionType);
1072  if (!sym) return NULL;
1073  }
1074  else
1075  {
1077  }
1078  return &sym->symt;
1079 }
static void * codeview_cast_symt(struct symt *symt, enum SymTagEnum tag)
Definition: msc.c:628
smooth NULL
Definition: ftsmooth.c:416
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
struct module * module
Definition: msc.c:556

Referenced by codeview_parse_one_type().

◆ codeview_parse_one_type()

static struct symt * codeview_parse_one_type ( struct codeview_type_parse ctp,
unsigned  curr_type,
const union codeview_type type,
BOOL  details 
)
static

Definition at line 1110 of file msc.c.

1113 {
1114  struct symt* symt;
1115  int value, leaf_len;
1116  const struct p_string* p_name;
1117  const char* c_name;
1118  struct symt* existing;
1119 
1120  existing = codeview_get_type(curr_type, TRUE);
1121 
1122  switch (type->generic.id)
1123  {
1124  case LF_MODIFIER_V1:
1125  /* FIXME: we don't handle modifiers,
1126  * but read previous type on the curr_type
1127  */
1128  WARN("Modifier on %x: %s%s%s%s\n",
1129  type->modifier_v1.type,
1130  type->modifier_v1.attribute & 0x01 ? "const " : "",
1131  type->modifier_v1.attribute & 0x02 ? "volatile " : "",
1132  type->modifier_v1.attribute & 0x04 ? "unaligned " : "",
1133  type->modifier_v1.attribute & ~0x07 ? "unknown " : "");
1134  symt = codeview_fetch_type(ctp, type->modifier_v1.type, details);
1135  break;
1136  case LF_MODIFIER_V2:
1137  /* FIXME: we don't handle modifiers, but readd previous type on the curr_type */
1138  WARN("Modifier on %x: %s%s%s%s\n",
1139  type->modifier_v2.type,
1140  type->modifier_v2.attribute & 0x01 ? "const " : "",
1141  type->modifier_v2.attribute & 0x02 ? "volatile " : "",
1142  type->modifier_v2.attribute & 0x04 ? "unaligned " : "",
1143  type->modifier_v2.attribute & ~0x07 ? "unknown " : "");
1144  symt = codeview_fetch_type(ctp, type->modifier_v2.type, details);
1145  break;
1146 
1147  case LF_POINTER_V1:
1148  symt = codeview_add_type_pointer(ctp, existing, type->pointer_v1.datatype);
1149  break;
1150  case LF_POINTER_V2:
1151  symt = codeview_add_type_pointer(ctp, existing, type->pointer_v2.datatype);
1152  break;
1153 
1154  case LF_ARRAY_V1:
1155  if (existing) symt = codeview_cast_symt(existing, SymTagArrayType);
1156  else
1157  {
1158  leaf_len = numeric_leaf(&value, &type->array_v1.arrlen);
1159  p_name = (const struct p_string*)((const unsigned char*)&type->array_v1.arrlen + leaf_len);
1161  type->array_v1.elemtype,
1162  type->array_v1.idxtype, value);
1163  }
1164  break;
1165  case LF_ARRAY_V2:
1166  if (existing) symt = codeview_cast_symt(existing, SymTagArrayType);
1167  else
1168  {
1169  leaf_len = numeric_leaf(&value, &type->array_v2.arrlen);
1170  p_name = (const struct p_string*)((const unsigned char*)&type->array_v2.arrlen + leaf_len);
1171 
1173  type->array_v2.elemtype,
1174  type->array_v2.idxtype, value);
1175  }
1176  break;
1177  case LF_ARRAY_V3:
1178  if (existing) symt = codeview_cast_symt(existing, SymTagArrayType);
1179  else
1180  {
1181  leaf_len = numeric_leaf(&value, &type->array_v3.arrlen);
1182  c_name = (const char*)&type->array_v3.arrlen + leaf_len;
1183 
1184  symt = codeview_add_type_array(ctp, c_name,
1185  type->array_v3.elemtype,
1186  type->array_v3.idxtype, value);
1187  }
1188  break;
1189 
1190  case LF_STRUCTURE_V1:
1191  case LF_CLASS_V1:
1192  leaf_len = numeric_leaf(&value, &type->struct_v1.structlen);
1193  p_name = (const struct p_string*)((const unsigned char*)&type->struct_v1.structlen + leaf_len);
1194  symt = codeview_add_type_struct(ctp, existing, terminate_string(p_name), value,
1195  type->generic.id == LF_CLASS_V1 ? UdtClass : UdtStruct,
1196  type->struct_v1.property);
1197  if (details)
1198  {
1199  codeview_add_type(curr_type, symt);
1200  if (!(type->struct_v1.property & 0x80)) /* 0x80 = forward declaration */
1202  type->struct_v1.fieldlist);
1203  }
1204  break;
1205 
1206  case LF_STRUCTURE_V2:
1207  case LF_CLASS_V2:
1208  leaf_len = numeric_leaf(&value, &type->struct_v2.structlen);
1209  p_name = (const struct p_string*)((const unsigned char*)&type->struct_v2.structlen + leaf_len);
1210  symt = codeview_add_type_struct(ctp, existing, terminate_string(p_name), value,
1211  type->generic.id == LF_CLASS_V2 ? UdtClass : UdtStruct,
1212  type->struct_v2.property);
1213  if (details)
1214  {
1215  codeview_add_type(curr_type, symt);
1216  if (!(type->struct_v2.property & 0x80)) /* 0x80 = forward declaration */
1218  type->struct_v2.fieldlist);
1219  }
1220  break;
1221 
1222  case LF_STRUCTURE_V3:
1223  case LF_CLASS_V3:
1224  leaf_len = numeric_leaf(&value, &type->struct_v3.structlen);
1225  c_name = (const char*)&type->struct_v3.structlen + leaf_len;
1226  symt = codeview_add_type_struct(ctp, existing, c_name, value,
1227  type->generic.id == LF_CLASS_V3 ? UdtClass : UdtStruct,
1228  type->struct_v3.property);
1229  if (details)
1230  {
1231  codeview_add_type(curr_type, symt);
1232  if (!(type->struct_v3.property & 0x80)) /* 0x80 = forward declaration */
1234  type->struct_v3.fieldlist);
1235  }
1236  break;
1237 
1238  case LF_UNION_V1:
1239  leaf_len = numeric_leaf(&value, &type->union_v1.un_len);
1240  p_name = (const struct p_string*)((const unsigned char*)&type->union_v1.un_len + leaf_len);
1241  symt = codeview_add_type_struct(ctp, existing, terminate_string(p_name),
1242  value, UdtUnion, type->union_v1.property);
1243  if (details)
1244  {
1245  codeview_add_type(curr_type, symt);
1247  type->union_v1.fieldlist);
1248  }
1249  break;
1250 
1251  case LF_UNION_V2:
1252  leaf_len = numeric_leaf(&value, &type->union_v2.un_len);
1253  p_name = (const struct p_string*)((const unsigned char*)&type->union_v2.un_len + leaf_len);
1254  symt = codeview_add_type_struct(ctp, existing, terminate_string(p_name),
1255  value, UdtUnion, type->union_v2.property);
1256  if (details)
1257  {
1258  codeview_add_type(curr_type, symt);
1260  type->union_v2.fieldlist);
1261  }
1262  break;
1263 
1264  case LF_UNION_V3:
1265  leaf_len = numeric_leaf(&value, &type->union_v3.un_len);
1266  c_name = (const char*)&type->union_v3.un_len + leaf_len;
1267  symt = codeview_add_type_struct(ctp, existing, c_name,
1268  value, UdtUnion, type->union_v3.property);
1269  if (details)
1270  {
1271  codeview_add_type(curr_type, symt);
1273  type->union_v3.fieldlist);
1274  }
1275  break;
1276 
1277  case LF_ENUM_V1:
1278  symt = codeview_add_type_enum(ctp, existing,
1279  terminate_string(&type->enumeration_v1.p_name),
1280  type->enumeration_v1.fieldlist,
1281  type->enumeration_v1.type);
1282  break;
1283 
1284  case LF_ENUM_V2:
1285  symt = codeview_add_type_enum(ctp, existing,
1286  terminate_string(&type->enumeration_v2.p_name),
1287  type->enumeration_v2.fieldlist,
1288  type->enumeration_v2.type);
1289  break;
1290 
1291  case LF_ENUM_V3:
1292  symt = codeview_add_type_enum(ctp, existing, type->enumeration_v3.name,
1293  type->enumeration_v3.fieldlist,
1294  type->enumeration_v3.type);
1295  break;
1296 
1297  case LF_PROCEDURE_V1:
1298  symt = codeview_new_func_signature(ctp, existing, type->procedure_v1.call);
1299  if (details)
1300  {
1301  codeview_add_type(curr_type, symt);
1303  (struct symt_function_signature*)symt,
1304  type->procedure_v1.rvtype,
1305  type->procedure_v1.arglist);
1306  }
1307  break;
1308  case LF_PROCEDURE_V2:
1309  symt = codeview_new_func_signature(ctp, existing,type->procedure_v2.call);
1310  if (details)
1311  {
1312  codeview_add_type(curr_type, symt);
1314  (struct symt_function_signature*)symt,
1315  type->procedure_v2.rvtype,
1316  type->procedure_v2.arglist);
1317  }
1318  break;
1319 
1320  case LF_MFUNCTION_V1:
1321  /* FIXME: for C++, this is plain wrong, but as we don't use arg types
1322  * nor class information, this would just do for now
1323  */
1324  symt = codeview_new_func_signature(ctp, existing, type->mfunction_v1.call);
1325  if (details)
1326  {
1327  codeview_add_type(curr_type, symt);
1329  (struct symt_function_signature*)symt,
1330  type->mfunction_v1.rvtype,
1331  type->mfunction_v1.arglist);
1332  }
1333  break;
1334  case LF_MFUNCTION_V2:
1335  /* FIXME: for C++, this is plain wrong, but as we don't use arg types
1336  * nor class information, this would just do for now
1337  */
1338  symt = codeview_new_func_signature(ctp, existing, type->mfunction_v2.call);
1339  if (details)
1340  {
1341  codeview_add_type(curr_type, symt);
1343  (struct symt_function_signature*)symt,
1344  type->mfunction_v2.rvtype,
1345  type->mfunction_v2.arglist);
1346  }
1347  break;
1348 
1349  case LF_VTSHAPE_V1:
1350  /* this is an ugly hack... FIXME when we have C++ support */
1351  if (!(symt = existing))
1352  {
1353  char buf[128];
1354  snprintf(buf, sizeof(buf), "__internal_vt_shape_%x\n", curr_type);
1355  symt = &symt_new_udt(ctp->module, buf, 0, UdtStruct)->symt;
1356  }
1357  break;
1358  default:
1359  FIXME("Unsupported type-id leaf %x\n", type->generic.id);
1360  dump(type, 2 + type->generic.len);
1361  return NULL;
1362  }
1363  return codeview_add_type(curr_type, symt) ? symt : NULL;
1364 }
#define LF_MODIFIER_V2
Definition: mscvpdb.h:1126
#define TRUE
Definition: types.h:120
static struct symt * codeview_add_type_struct(struct codeview_type_parse *ctp, struct symt *existing, const char *name, int structlen, enum UdtKind kind, unsigned property)
Definition: msc.c:1017
#define LF_MODIFIER_V1
Definition: mscvpdb.h:1103
static struct symt * codeview_add_type_array(struct codeview_type_parse *ctp, const char *name, unsigned int elemtype, unsigned int indextype, unsigned int arr_len)
Definition: msc.c:673
#define LF_UNION_V1
Definition: mscvpdb.h:1108
#define LF_CLASS_V2
Definition: mscvpdb.h:1129
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define LF_UNION_V2
Definition: mscvpdb.h:1131
#define WARN(fmt,...)
Definition: debug.h:111
#define LF_PROCEDURE_V1
Definition: mscvpdb.h:1110
#define snprintf
Definition: wintirpc.h:48
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define LF_ARRAY_V3
Definition: mscvpdb.h:1202
static int codeview_add_type(unsigned int typeno, struct symt *dt)
Definition: msc.c:569
#define LF_ENUM_V2
Definition: mscvpdb.h:1132
#define LF_MFUNCTION_V2
Definition: mscvpdb.h:1134
#define LF_ARRAY_V2
Definition: mscvpdb.h:1128
static struct symt * codeview_fetch_type(struct codeview_type_parse *ctp, unsigned typeno, BOOL details)
Definition: msc.c:638
#define FIXME(fmt,...)
Definition: debug.h:110
static void * codeview_cast_symt(struct symt *symt, enum SymTagEnum tag)
Definition: msc.c:628
smooth NULL
Definition: ftsmooth.c:416
static struct symt * codeview_new_func_signature(struct codeview_type_parse *ctp, struct symt *existing, enum CV_call_e call_conv)
Definition: msc.c:1063
#define LF_UNION_V3
Definition: mscvpdb.h:1205
#define LF_ARRAY_V1
Definition: mscvpdb.h:1105
static int codeview_add_type_struct_field_list(struct codeview_type_parse *ctp, struct symt_udt *symt, unsigned fieldlistno)
Definition: msc.c:768
static struct symt * codeview_add_type_pointer(struct codeview_type_parse *ctp, struct symt *existing, unsigned int pointee_type)
Definition: msc.c:658
GLsizei const GLfloat * value
Definition: glext.h:6069
#define LF_CLASS_V1
Definition: mscvpdb.h:1106
#define LF_STRUCTURE_V2
Definition: mscvpdb.h:1130
#define LF_STRUCTURE_V3
Definition: mscvpdb.h:1204
#define LF_MFUNCTION_V1
Definition: mscvpdb.h:1111
struct symt_udt * symt_new_udt(struct module *module, const char *typename, unsigned size, enum UdtKind kind) DECLSPEC_HIDDEN
Definition: type.c:220
static struct symt * codeview_get_type(unsigned int typeno, BOOL quiet)
Definition: msc.c:520
static int numeric_leaf(int *value, const unsigned short int *leaf)
Definition: msc.c:392
#define LF_POINTER_V1
Definition: mscvpdb.h:1104
static void codeview_add_func_signature_args(struct codeview_type_parse *ctp, struct symt_function_signature *sym, unsigned ret_type, unsigned args_list)
Definition: msc.c:1081
static const char * terminate_string(const struct p_string *p_name)
Definition: msc.c:510
struct module * module
Definition: msc.c:556
static struct symt * codeview_add_type_enum(struct codeview_type_parse *ctp, struct symt *existing, const char *name, unsigned fieldlistno, unsigned basetype)
Definition: msc.c:990
int details
Definition: msacm.c:1353
#define LF_POINTER_V2
Definition: mscvpdb.h:1127
#define LF_PROCEDURE_V2
Definition: mscvpdb.h:1133
#define LF_STRUCTURE_V1
Definition: mscvpdb.h:1107
static void dump(const void *ptr, unsigned len)
Definition: msc.c:102
#define LF_VTSHAPE_V1
Definition: mscvpdb.h:1112
#define LF_ENUM_V1
Definition: mscvpdb.h:1109
#define LF_CLASS_V3
Definition: mscvpdb.h:1203
#define LF_ENUM_V3
Definition: mscvpdb.h:1206

Referenced by codeview_fetch_type(), and codeview_parse_type_table().

◆ codeview_parse_type_table()

static BOOL codeview_parse_type_table ( struct codeview_type_parse ctp)
static

Definition at line 1366 of file msc.c.

1367 {
1368  unsigned int curr_type = FIRST_DEFINABLE_TYPE;
1369  const union codeview_type* type;
1370 
1371  for (curr_type = FIRST_DEFINABLE_TYPE; curr_type < FIRST_DEFINABLE_TYPE + ctp->num; curr_type++)
1372  {
1373  type = codeview_jump_to_type(ctp, curr_type);
1374 
1375  /* type records we're interested in are the ones referenced by symbols
1376  * The known ranges are (X mark the ones we want):
1377  * X 0000-0016 for V1 types
1378  * 0200-020c for V1 types referenced by other types
1379  * 0400-040f for V1 types (complex lists & sets)
1380  * X 1000-100f for V2 types
1381  * 1200-120c for V2 types referenced by other types
1382  * 1400-140f for V1 types (complex lists & sets)
1383  * X 1500-150d for V3 types
1384  * 8000-8010 for numeric leafes
1385  */
1386  if (!(type->generic.id & 0x8600) || (type->generic.id & 0x0100))
1387  codeview_parse_one_type(ctp, curr_type, type, TRUE);
1388  }
1389 
1390  return TRUE;
1391 }
#define TRUE
Definition: types.h:120
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static struct symt * codeview_parse_one_type(struct codeview_type_parse *ctp, unsigned curr_type, const union codeview_type *type, BOOL details)
Definition: msc.c:1110
static const void * codeview_jump_to_type(const struct codeview_type_parse *ctp, DWORD idx)
Definition: msc.c:562
#define FIRST_DEFINABLE_TYPE
Definition: msc.c:132

Referenced by codeview_process_info(), and pdb_process_types().

◆ codeview_process_info()

static BOOL codeview_process_info ( const struct process pcs,
const struct msc_debug_info msc_dbg 
)
static

Definition at line 3264 of file msc.c.

3266 {
3267  const DWORD* signature = (const DWORD*)msc_dbg->root;
3268  BOOL ret = FALSE;
3269  struct pdb_lookup pdb_lookup;
3270 
3271  TRACE("Processing signature %.4s\n", (const char*)signature);
3272 
3273  switch (*signature)
3274  {
3275  case CODEVIEW_NB09_SIG:
3276  case CODEVIEW_NB11_SIG:
3277  {
3278  const OMFSignature* cv = (const OMFSignature*)msc_dbg->root;
3279  const OMFDirHeader* hdr = (const OMFDirHeader*)(msc_dbg->root + cv->filepos);
3280  const OMFDirEntry* ent;
3281  const OMFDirEntry* prev;
3282  const OMFDirEntry* next;
3283  unsigned int i;
3284 
3286 
3287  for (i = 0; i < hdr->cDir; i++)
3288  {
3289  ent = (const OMFDirEntry*)((const BYTE*)hdr + hdr->cbDirHeader + i * hdr->cbDirEntry);
3290  if (ent->SubSection == sstGlobalTypes)
3291  {
3292  const OMFGlobalTypes* types;
3293  struct codeview_type_parse ctp;
3294 
3295  types = (const OMFGlobalTypes*)(msc_dbg->root + ent->lfo);
3296  ctp.module = msc_dbg->module;
3297  ctp.offset = (const DWORD*)(types + 1);
3298  ctp.num = types->cTypes;
3299  ctp.table = (const BYTE*)(ctp.offset + types->cTypes);
3300 
3302  if (cv_current_module->allowed) FIXME("Already allowed??\n");
3303  cv_current_module->allowed = TRUE;
3304 
3306  break;
3307  }
3308  }
3309 
3310  ent = (const OMFDirEntry*)((const BYTE*)hdr + hdr->cbDirHeader);
3311  for (i = 0; i < hdr->cDir; i++, ent = next)
3312  {
3313  next = (i == hdr->cDir-1) ? NULL :
3314  (const OMFDirEntry*)((const BYTE*)ent + hdr->cbDirEntry);
3315  prev = (i == 0) ? NULL :
3316  (const OMFDirEntry*)((const BYTE*)ent - hdr->cbDirEntry);
3317 
3318  if (ent->SubSection == sstAlignSym)
3319  {
3320  codeview_snarf(msc_dbg, msc_dbg->root + ent->lfo, sizeof(DWORD),
3321  ent->cb, TRUE);
3322 
3323  /*
3324  * Check the next and previous entry. If either is a
3325  * sstSrcModule, it contains the line number info for
3326  * this file.
3327  *
3328  * FIXME: This is not a general solution!
3329  */
3330  if (next && next->iMod == ent->iMod && next->SubSection == sstSrcModule)
3331  codeview_snarf_linetab(msc_dbg, msc_dbg->root + next->lfo,
3332  next->cb, TRUE);
3333 
3334  if (prev && prev->iMod == ent->iMod && prev->SubSection == sstSrcModule)
3335  codeview_snarf_linetab(msc_dbg, msc_dbg->root + prev->lfo,
3336  prev->cb, TRUE);
3337 
3338  }
3339  }
3340 
3341  msc_dbg->module->module.SymType = SymCv;
3342  /* FIXME: we could have a finer grain here */
3343  msc_dbg->module->module.LineNumbers = TRUE;
3344  msc_dbg->module->module.GlobalSymbols = TRUE;
3345  msc_dbg->module->module.TypeInfo = TRUE;
3346  msc_dbg->module->module.SourceIndexed = TRUE;
3347  msc_dbg->module->module.Publics = TRUE;
3349  ret = TRUE;
3350  break;
3351  }
3352 
3353  case CODEVIEW_NB10_SIG:
3354  {
3355  const CODEVIEW_PDB_DATA* pdb = (const CODEVIEW_PDB_DATA*)msc_dbg->root;
3356  pdb_lookup.filename = pdb->name;
3358  pdb_lookup.timestamp = pdb->timestamp;
3359  pdb_lookup.age = pdb->age;
3360  ret = pdb_process_file(pcs, msc_dbg, &pdb_lookup);
3361  break;
3362  }
3363  case CODEVIEW_RSDS_SIG:
3364  {
3365  const OMFSignatureRSDS* rsds = (const OMFSignatureRSDS*)msc_dbg->root;
3366 
3367  TRACE("Got RSDS type of PDB file: guid=%s age=%08x name=%s\n",
3368  wine_dbgstr_guid(&rsds->guid), rsds->age, rsds->name);
3369  pdb_lookup.filename = rsds->name;
3371  pdb_lookup.guid = rsds->guid;
3372  pdb_lookup.age = rsds->age;
3373  ret = pdb_process_file(pcs, msc_dbg, &pdb_lookup);
3374  break;
3375  }
3376  default:
3377  ERR("Unknown CODEVIEW signature %08x in module %s\n",
3378  *signature, debugstr_w(msc_dbg->module->module.ModuleName));
3379  break;
3380  }
3381  if (ret)
3382  {
3383  msc_dbg->module->module.CVSig = *signature;
3384  memcpy(msc_dbg->module->module.CVData, msc_dbg->root,
3385  sizeof(msc_dbg->module->module.CVData));
3386  }
3387  return ret;
3388 }
#define CODEVIEW_RSDS_SIG
Definition: msc.c:3262
#define TRUE
Definition: types.h:120
char hdr[14]
Definition: iptest.cpp:33
static PDB pdb
Definition: db.cpp:170
#define sstAlignSym
Definition: mscvpdb.h:2144
long filepos
Definition: mscvpdb.h:2162
Definition: compat.h:707
#define sstSrcModule
Definition: mscvpdb.h:2146
GLsizei GLenum GLenum * types
Definition: glext.h:7753
#define CODEVIEW_NB09_SIG
Definition: msc.c:3259
const char * wine_dbgstr_guid(const GUID *guid)
static BOOL pdb_process_file(const struct process *pcs, const struct msc_debug_info *msc_dbg, struct pdb_lookup *pdb_lookup)
Definition: msc.c:2864
CHAR name[1]
Definition: mscvpdb.h:2170
static void codeview_snarf_linetab(const struct msc_debug_info *msc_dbg, const BYTE *linetab, int size, BOOL pascal_str)
Definition: msc.c:1399
enum pdb_kind kind
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
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define CODEVIEW_NB10_SIG
Definition: msc.c:3260
smooth NULL
Definition: ftsmooth.c:416
static struct cv_defined_module cv_zmodules[CV_MAX_MODULES]
Definition: msc.c:144
#define TRACE(s)
Definition: solgame.cpp:4
Definition: cmds.c:130
#define CODEVIEW_NB11_SIG
Definition: msc.c:3261
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
DWORD cb
Definition: mscvpdb.h:2196
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
const BYTE * root
Definition: mscvpdb.h:2129
#define ERR(fmt,...)
Definition: debug.h:109
#define sstGlobalTypes
Definition: mscvpdb.h:2150
static void codeview_clear_type_table(void)
Definition: msc.c:609
static unsigned __int64 next
Definition: rand_nt.c:6
static BOOL codeview_snarf(const struct msc_debug_info *msc_dbg, const BYTE *root, int offset, int size, BOOL do_globals)
Definition: msc.c:1591
struct module * module
Definition: mscvpdb.h:2124
static void codeview_init_basic_types(struct module *module)
Definition: msc.c:147
static struct cv_defined_module * cv_current_module
Definition: msc.c:145
WORD SubSection
Definition: mscvpdb.h:2193
static BOOL codeview_parse_type_table(struct codeview_type_parse *ctp)
Definition: msc.c:1366
WORD iMod
Definition: mscvpdb.h:2194
const char * filename
DWORD lfo
Definition: mscvpdb.h:2195

Referenced by pe_load_debug_directory().

◆ codeview_snarf()

static BOOL codeview_snarf ( const struct msc_debug_info msc_dbg,
const BYTE root,
int  offset,
int  size,
BOOL  do_globals 
)
static

Definition at line 1591 of file msc.c.

1593 {
1594  struct symt_function* curr_func = NULL;
1595  int i, length;
1596  struct symt_block* block = NULL;
1597  struct symt* symt;
1598  struct symt_compiland* compiland = NULL;
1599  struct location loc;
1600 
1601  /*
1602  * Loop over the different types of records and whenever we
1603  * find something we are interested in, record it and move on.
1604  */
1605  for (i = offset; i < size; i += length)
1606  {
1607  const union codeview_symbol* sym = (const union codeview_symbol*)(root + i);
1608  length = sym->generic.len + 2;
1609  if (i + length > size) break;
1610  if (!sym->generic.id || length < 4) break;
1611  if (length & 3) FIXME("unpadded len %u\n", length);
1612 
1613  switch (sym->generic.id)
1614  {
1615  /*
1616  * Global and local data symbols. We don't associate these
1617  * with any given source file.
1618  */
1619  case S_GDATA_V1:
1620  case S_LDATA_V1:
1621  if (do_globals)
1622  codeview_add_variable(msc_dbg, compiland, terminate_string(&sym->data_v1.p_name),
1623  sym->data_v1.segment, sym->data_v1.offset, sym->data_v1.symtype,
1624  sym->generic.id == S_LDATA_V1, FALSE, TRUE);
1625  break;
1626  case S_GDATA_V2:
1627  case S_LDATA_V2:
1628  if (do_globals)
1629  codeview_add_variable(msc_dbg, compiland, terminate_string(&sym->data_v2.p_name),
1630  sym->data_v2.segment, sym->data_v2.offset, sym->data_v2.symtype,
1631  sym->generic.id == S_LDATA_V2, FALSE, TRUE);
1632  break;
1633  case S_GDATA_V3:
1634  case S_LDATA_V3:
1635  if (do_globals)
1636  codeview_add_variable(msc_dbg, compiland, sym->data_v3.name,
1637  sym->data_v3.segment, sym->data_v3.offset, sym->data_v3.symtype,
1638  sym->generic.id == S_LDATA_V3, FALSE, TRUE);
1639  break;
1640 
1641  /* variables with thread storage */
1642  case S_GTHREAD_V1:
1643  case S_LTHREAD_V1:
1644  if (do_globals)
1645  codeview_add_variable(msc_dbg, compiland, terminate_string(&sym->thread_v1.p_name),
1646  sym->thread_v1.segment, sym->thread_v1.offset, sym->thread_v1.symtype,
1647  sym->generic.id == S_LTHREAD_V1, TRUE, TRUE);
1648  break;
1649  case S_GTHREAD_V2:
1650  case S_LTHREAD_V2:
1651  if (do_globals)
1652  codeview_add_variable(msc_dbg, compiland, terminate_string(&sym->thread_v2.p_name),
1653  sym->thread_v2.segment, sym->thread_v2.offset, sym->thread_v2.symtype,
1654  sym->generic.id == S_LTHREAD_V2, TRUE, TRUE);
1655  break;
1656  case S_GTHREAD_V3:
1657  case S_LTHREAD_V3:
1658  if (do_globals)
1659  codeview_add_variable(msc_dbg, compiland, sym->thread_v3.name,
1660  sym->thread_v3.segment, sym->thread_v3.offset, sym->thread_v3.symtype,
1661  sym->generic.id == S_LTHREAD_V3, TRUE, TRUE);
1662  break;
1663 
1664  /* Public symbols */
1665  case S_PUB_V1:
1666  case S_PUB_V2:
1667  case S_PUB_V3:
1668  case S_PUB_FUNC1_V3:
1669  case S_PUB_FUNC2_V3:
1670  /* will be handled later on in codeview_snarf_public */
1671  break;
1672 
1673  /*
1674  * Sort of like a global function, but it just points
1675  * to a thunk, which is a stupid name for what amounts to
1676  * a PLT slot in the normal jargon that everyone else uses.
1677  */
1678  case S_THUNK_V1:
1679  symt_new_thunk(msc_dbg->module, compiland,
1680  terminate_string(&sym->thunk_v1.p_name), sym->thunk_v1.thtype,
1681  codeview_get_address(msc_dbg, sym->thunk_v1.segment, sym->thunk_v1.offset),
1682  sym->thunk_v1.thunk_len);
1683  break;
1684  case S_THUNK_V3:
1685  symt_new_thunk(msc_dbg->module, compiland,
1686  sym->thunk_v3.name, sym->thunk_v3.thtype,
1687  codeview_get_address(msc_dbg, sym->thunk_v3.segment, sym->thunk_v3.offset),
1688  sym->thunk_v3.thunk_len);
1689  break;
1690 
1691  /*
1692  * Global and static functions.
1693  */
1694  case S_GPROC_V1:
1695  case S_LPROC_V1:
1696  if (curr_func) FIXME("nested function\n");
1697  curr_func = symt_new_function(msc_dbg->module, compiland,
1698  terminate_string(&sym->proc_v1.p_name),
1699  codeview_get_address(msc_dbg, sym->proc_v1.segment, sym->proc_v1.offset),
1700  sym->proc_v1.proc_len,
1701  codeview_get_type(sym->proc_v1.proctype, FALSE));
1702  loc.kind = loc_absolute;
1703  loc.offset = sym->proc_v1.debug_start;
1704  symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugStart, &loc, NULL);
1705  loc.offset = sym->proc_v1.debug_end;
1706  symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugEnd, &loc, NULL);
1707  break;
1708  case S_GPROC_V2:
1709  case S_LPROC_V2:
1710  if (curr_func) FIXME("nested function\n");
1711  curr_func = symt_new_function(msc_dbg->module, compiland,
1712  terminate_string(&sym->proc_v2.p_name),
1713  codeview_get_address(msc_dbg, sym->proc_v2.segment, sym->proc_v2.offset),
1714  sym->proc_v2.proc_len,
1715  codeview_get_type(sym->proc_v2.proctype, FALSE));
1716  loc.kind = loc_absolute;
1717  loc.offset = sym->proc_v2.debug_start;
1718  symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugStart, &loc, NULL);
1719  loc.offset = sym->proc_v2.debug_end;
1720  symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugEnd, &loc, NULL);
1721  break;
1722  case S_GPROC_V3:
1723  case S_LPROC_V3:
1724  if (curr_func) FIXME("nested function\n");
1725  curr_func = symt_new_function(msc_dbg->module, compiland,
1726  sym->proc_v3.name,
1727  codeview_get_address(msc_dbg, sym->proc_v3.segment, sym->proc_v3.offset),
1728  sym->proc_v3.proc_len,
1729  codeview_get_type(sym->proc_v3.proctype, FALSE));
1730  loc.kind = loc_absolute;
1731  loc.offset = sym->proc_v3.debug_start;
1732  symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugStart, &loc, NULL);
1733  loc.offset = sym->proc_v3.debug_end;
1734  symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugEnd, &loc, NULL);
1735  break;
1736  /*
1737  * Function parameters and stack variables.
1738  */
1739  case S_BPREL_V1:
1740  loc.kind = loc_regrel;
1741  /* Yes, it's i386 dependent, but that's the symbol purpose. S_REGREL is used on other CPUs */
1742  loc.reg = CV_REG_EBP;
1743  loc.offset = sym->stack_v1.offset;
1744  symt_add_func_local(msc_dbg->module, curr_func,
1745  sym->stack_v1.offset > 0 ? DataIsParam : DataIsLocal,
1746  &loc, block,
1747  codeview_get_type(sym->stack_v1.symtype, FALSE),
1748  terminate_string(&sym->stack_v1.p_name));
1749  break;
1750  case S_BPREL_V2:
1751  loc.kind = loc_regrel;
1752  /* Yes, it's i386 dependent, but that's the symbol purpose. S_REGREL is used on other CPUs */
1753  loc.reg = CV_REG_EBP;
1754  loc.offset = sym->stack_v2.offset;
1755  symt_add_func_local(msc_dbg->module, curr_func,
1756  sym->stack_v2.offset > 0 ? DataIsParam : DataIsLocal,
1757  &loc, block,
1758  codeview_get_type(sym->stack_v2.symtype, FALSE),
1759  terminate_string(&sym->stack_v2.p_name));
1760  break;
1761  case S_BPREL_V3:
1762  loc.kind = loc_regrel;
1763  /* Yes, it's i386 dependent, but that's the symbol purpose. S_REGREL is used on other CPUs */
1764  loc.reg = CV_REG_EBP;
1765  loc.offset = sym->stack_v3.offset;
1766  symt_add_func_local(msc_dbg->module, curr_func,
1767  sym->stack_v3.offset > 0 ? DataIsParam : DataIsLocal,
1768  &loc, block,
1769  codeview_get_type(sym->stack_v3.symtype, FALSE),
1770  sym->stack_v3.name);
1771  break;
1772  case S_REGREL_V3:
1773  loc.kind = loc_regrel;
1774  loc.reg = sym->regrel_v3.reg;
1775  loc.offset = sym->regrel_v3.offset;
1776  symt_add_func_local(msc_dbg->module, curr_func,
1777  /* FIXME this is wrong !!! */
1778  sym->regrel_v3.offset > 0 ? DataIsParam : DataIsLocal,
1779  &loc, block,
1780  codeview_get_type(sym->regrel_v3.symtype, FALSE),
1781  sym->regrel_v3.name);
1782  break;
1783 
1784  case S_REGISTER_V1:
1785  loc.kind = loc_register;
1786  loc.reg = sym->register_v1.reg;
1787  loc.offset = 0;
1788  symt_add_func_local(msc_dbg->module, curr_func,
1789  DataIsLocal, &loc,
1791  terminate_string(&sym->register_v1.p_name));
1792  break;
1793  case S_REGISTER_V2:
1794  loc.kind = loc_register;
1795  loc.reg = sym->register_v2.reg;
1796  loc.offset = 0;
1797  symt_add_func_local(msc_dbg->module, curr_func,
1798  DataIsLocal, &loc,
1800  terminate_string(&sym->register_v2.p_name));
1801  break;
1802  case S_REGISTER_V3:
1803  loc.kind = loc_register;
1804  loc.reg = sym->register_v3.reg;
1805  loc.offset = 0;
1806  symt_add_func_local(msc_dbg->module, curr_func,
1807  DataIsLocal, &loc,
1809  sym->register_v3.name);
1810  break;
1811 
1812  case S_BLOCK_V1:
1813  block = symt_open_func_block(msc_dbg->module, curr_func, block,
1814  codeview_get_address(msc_dbg, sym->block_v1.segment, sym->block_v1.offset),
1815  sym->block_v1.length);
1816  break;
1817  case S_BLOCK_V3:
1818  block = symt_open_func_block(msc_dbg->module, curr_func, block,
1819  codeview_get_address(msc_dbg, sym->block_v3.segment, sym->block_v3.offset),
1820  sym->block_v3.length);
1821  break;
1822 
1823  case S_END_V1:
1824  if (block)
1825  {
1826  block = symt_close_func_block(msc_dbg->module, curr_func, block, 0);
1827  }
1828  else if (curr_func)
1829  {
1830  symt_normalize_function(msc_dbg->module, curr_func);
1831  curr_func = NULL;
1832  }
1833  break;
1834 
1835  case S_COMPILAND_V1:
1836  TRACE("S-Compiland-V1 %x %s\n",
1837  sym->compiland_v1.unknown, terminate_string(&sym->compiland_v1.p_name));
1838  break;
1839 
1840  case S_COMPILAND_V2:
1841  TRACE("S-Compiland-V2 %s\n", terminate_string(&sym->compiland_v2.p_name));
1842  if (TRACE_ON(dbghelp_msc))
1843  {
1844  const char* ptr1 = sym->compiland_v2.p_name.name + sym->compiland_v2.p_name.namelen;
1845  const char* ptr2;
1846  while (*ptr1)
1847  {
1848  ptr2 = ptr1 + strlen(ptr1) + 1;
1849  TRACE("\t%s => %s\n", ptr1, debugstr_a(ptr2));
1850  ptr1 = ptr2 + strlen(ptr2) + 1;
1851  }
1852  }
1853  break;
1854  case S_COMPILAND_V3:
1855  TRACE("S-Compiland-V3 %s\n", sym->compiland_v3.name);
1856  if (TRACE_ON(dbghelp_msc))
1857  {
1858  const char* ptr1 = sym->compiland_v3.name + strlen(sym->compiland_v3.name);
1859  const char* ptr2;
1860  while (*ptr1)
1861  {
1862  ptr2 = ptr1 + strlen(ptr1) + 1;
1863  TRACE("\t%s => %s\n", ptr1, debugstr_a(ptr2));
1864  ptr1 = ptr2 + strlen(ptr2) + 1;
1865  }
1866  }
1867  break;
1868 
1869  case S_OBJNAME_V1:
1870  TRACE("S-ObjName %s\n", terminate_string(&sym->objname_v1.p_name));
1871  compiland = symt_new_compiland(msc_dbg->module, 0 /* FIXME */,
1872  source_new(msc_dbg->module, NULL,
1873  terminate_string(&sym->objname_v1.p_name)));
1874  break;
1875 
1876  case S_LABEL_V1:
1877  if (curr_func)
1878  {
1879  loc.kind = loc_absolute;
1880  loc.offset = codeview_get_address(msc_dbg, sym->label_v1.segment, sym->label_v1.offset) - curr_func->address;
1881  symt_add_function_point(msc_dbg->module, curr_func, SymTagLabel, &loc,
1882  terminate_string(&sym->label_v1.p_name));
1883  }
1884  else symt_new_label(msc_dbg->module, compiland,
1885  terminate_string(&sym->label_v1.p_name),
1886  codeview_get_address(msc_dbg, sym->label_v1.segment, sym->label_v1.offset));
1887  break;
1888  case S_LABEL_V3:
1889  if (curr_func)
1890  {
1891  loc.kind = loc_absolute;
1892  loc.offset = codeview_get_address(msc_dbg, sym->label_v3.segment, sym->label_v3.offset) - curr_func->address;
1893  symt_add_function_point(msc_dbg->module, curr_func, SymTagLabel,
1894  &loc, sym->label_v3.name);
1895  }
1896  else symt_new_label(msc_dbg->module, compiland, sym->label_v3.name,
1897  codeview_get_address(msc_dbg, sym->label_v3.segment, sym->label_v3.offset));
1898  break;
1899 
1900  case S_CONSTANT_V1:
1901  {
1902  int vlen;
1903  const struct p_string* name;
1904  struct symt* se;
1905  VARIANT v;
1906 
1907  vlen = leaf_as_variant(&v, &sym->constant_v1.cvalue);
1908  name = (const struct p_string*)((const char*)&sym->constant_v1.cvalue + vlen);
1909  se = codeview_get_type(sym->constant_v1.type, FALSE);
1910 
1911  TRACE("S-Constant-V1 %u %s %x\n",
1912  v.n1.n2.n3.intVal, terminate_string(name), sym->constant_v1.type);
1913  symt_new_constant(msc_dbg->module, compiland, terminate_string(name),
1914  se, &v);
1915  }
1916  break;
1917  case S_CONSTANT_V2:
1918  {
1919  int vlen;
1920  const struct p_string* name;
1921  struct symt* se;
1922  VARIANT v;
1923 
1924  vlen = leaf_as_variant(&v, &sym->constant_v2.cvalue);
1925  name = (const struct p_string*)((const char*)&sym->constant_v2.cvalue + vlen);
1926  se = codeview_get_type(sym->constant_v2.type, FALSE);
1927 
1928  TRACE("S-Constant-V2 %u %s %x\n",
1929  v.n1.n2.n3.intVal, terminate_string(name), sym->constant_v2.type);
1930  symt_new_constant(msc_dbg->module, compiland, terminate_string(name),
1931  se, &v);
1932  }
1933  break;
1934  case S_CONSTANT_V3:
1935  {
1936  int vlen;
1937  const char* name;
1938  struct symt* se;
1939  VARIANT v;
1940 
1941  vlen = leaf_as_variant(&v, &sym->constant_v3.cvalue);
1942  name = (const char*)&sym->constant_v3.cvalue + vlen;
1943  se = codeview_get_type(sym->constant_v3.type, FALSE);
1944 
1945  TRACE("S-Constant-V3 %u %s %x\n",
1946  v.n1.n2.n3.intVal, name, sym->constant_v3.type);
1947  /* FIXME: we should add this as a constant value */
1948  symt_new_constant(msc_dbg->module, compiland, name, se, &v);
1949  }
1950  break;
1951 
1952  case S_UDT_V1:
1953  if (sym->udt_v1.type)
1954  {
1955  if ((symt = codeview_get_type(sym->udt_v1.type, FALSE)))
1956  symt_new_typedef(msc_dbg->module, symt,
1957  terminate_string(&sym->udt_v1.p_name));
1958  else
1959  FIXME("S-Udt %s: couldn't find type 0x%x\n",
1960  terminate_string(&sym->udt_v1.p_name), sym->udt_v1.type);
1961  }
1962  break;
1963  case S_UDT_V2:
1964  if (sym->udt_v2.type)
1965  {
1966  if ((symt = codeview_get_type(sym->udt_v2.type, FALSE)))
1967  symt_new_typedef(msc_dbg->module, symt,
1968  terminate_string(&sym->udt_v2.p_name));
1969  else
1970  FIXME("S-Udt %s: couldn't find type 0x%x\n",
1971  terminate_string(&sym->udt_v2.p_name), sym->udt_v2.type);
1972  }
1973  break;
1974  case S_UDT_V3:
1975  if (sym->udt_v3.type)
1976  {
1977  if ((symt = codeview_get_type(sym->udt_v3.type, FALSE)))
1978  symt_new_typedef(msc_dbg->module, symt, sym->udt_v3.name);
1979  else
1980  FIXME("S-Udt %s: couldn't find type 0x%x\n",
1981  sym->udt_v3.name, sym->udt_v3.type);
1982  }
1983  break;
1984 
1985  /*
1986  * These are special, in that they are always followed by an
1987  * additional length-prefixed string which is *not* included
1988  * into the symbol length count. We need to skip it.
1989  */
1990  case S_PROCREF_V1:
1991  case S_DATAREF_V1:
1992  case S_LPROCREF_V1:
1993  {
1994  const char* name;
1995 
1996  name = (const char*)sym + length;
1997  length += (*name + 1 + 3) & ~3;
1998  break;
1999  }
2000 
2001  case S_MSTOOL_V3: /* just to silence a few warnings */
2002  case S_MSTOOLINFO_V3:
2003  case S_MSTOOLENV_V3:
2004  break;
2005 
2006  case S_SSEARCH_V1:
2007  TRACE("Start search: seg=0x%x at offset 0x%08x\n",
2008  sym->ssearch_v1.segment, sym->ssearch_v1.offset);
2009  break;
2010 
2011  case S_ALIGN_V1:
2012  TRACE("S-Align V1\n");
2013  break;
2014 
2015  /* the symbols we can safely ignore for now */
2016  case S_TRAMPOLINE:
2017  case S_FRAMEINFO_V2:
2018  case S_SECUCOOKIE_V3:
2019  case S_SECTINFO_V3:
2020  case S_SUBSECTINFO_V3:
2021  case S_ENTRYPOINT_V3:
2022  case S_LOCAL_VS2013:
2023  case S_CALLSITEINFO:
2024  case S_DEFRANGE_REGISTER:
2027  case S_FPOFF_VS2013:
2029  case S_BUILDINFO:
2030  case S_INLINESITE:
2031  case S_INLINESITE_END:
2032  case S_FILESTATIC:
2033  case S_CALLEES:
2034  TRACE("Unsupported symbol id %x\n", sym->generic.id);
2035  break;
2036 
2037  default:
2038  FIXME("Unsupported symbol id %x\n", sym->generic.id);
2039  dump(sym, 2 + sym->generic.len);
2040  break;
2041  }
2042  }
2043 
2044  if (curr_func) symt_normalize_function(msc_dbg->module, curr_func);
2045 
2046  return TRUE;
2047 }
#define S_LDATA_V3
Definition: mscvpdb.h:1716
static unsigned int block
Definition: xmlmemory.c:118
struct codeview_symbol::@3508 constant_v3
#define S_BUILDINFO
Definition: mscvpdb.h:1781
struct codeview_symbol::@3513 compiland_v1
#define S_PUB_FUNC2_V3
Definition: mscvpdb.h:1743
#define S_DEFRANGE_REGISTER
Definition: mscvpdb.h:1770
#define S_REGISTER_V2
Definition: mscvpdb.h:1687
#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
struct codeview_symbol::@3496 stack_v2
struct codeview_symbol::@3499 register_v1
#define S_CONSTANT_V2
Definition: mscvpdb.h:1688
#define S_COMPILAND_V1
Definition: mscvpdb.h:1651
#define S_UDT_V3
Definition: mscvpdb.h:1712
#define S_INLINESITE
Definition: mscvpdb.h:1782
#define S_DATAREF_V1
Definition: mscvpdb.h:1683
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
struct codeview_symbol::@3507 constant_v2
#define S_DEFRANGE_SUBFIELD_REGISTER
Definition: mscvpdb.h:1772
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define S_REGREL_V3
Definition: mscvpdb.h:1721
#define S_GTHREAD_V1
Definition: mscvpdb.h:1680
#define S_MSTOOLINFO_V3
Definition: mscvpdb.h:1764
struct codeview_symbol::@3515 compiland_v3
#define S_UDT_V1
Definition: mscvpdb.h:1654
#define S_CALLSITEINFO
Definition: mscvpdb.h:1761
#define S_THUNK_V3
Definition: mscvpdb.h:1706
GLintptr offset
Definition: glext.h:5920
#define S_LTHREAD_V3
Definition: mscvpdb.h:1722
#define S_MSTOOL_V3
Definition: mscvpdb.h:1726
#define S_LPROC_V1
Definition: mscvpdb.h:1670
struct codeview_symbol::@3483 generic
struct codeview_symbol::@3497 stack_v3
#define S_GPROC_V2
Definition: mscvpdb.h:1697
struct symt_typedef * symt_new_typedef(struct module *module, struct symt *ref, const char *name) DECLSPEC_HIDDEN
Definition: type.c:429
#define S_THUNK_V1
Definition: mscvpdb.h:1672
struct codeview_symbol::@3487 thunk_v1
#define S_BPREL_V3
Definition: mscvpdb.h:1715
struct codeview_symbol::@3517 thread_v2
struct codeview_symbol::@3491 proc_v3
struct symt_compiland * symt_new_compiland(struct module *module, unsigned long address, unsigned src_idx) DECLSPEC_HIDDEN
Definition: symbol.c:209
static void codeview_add_variable(const struct msc_debug_info *msc_dbg, struct symt_compiland *compiland, const char *name, unsigned segment, unsigned offset, unsigned symtype, BOOL is_local, BOOL in_tls, BOOL force)
Definition: msc.c:1569
#define S_BPREL_V1
Definition: mscvpdb.h:1666
#define S_LDATA_V2
Definition: mscvpdb.h:1693
#define S_COMPILAND_V3
Definition: mscvpdb.h:1705
struct codeview_symbol::@3502 block_v1
#define S_COMPILAND_V2
Definition: mscvpdb.h:1703
#define S_LPROC_V2
Definition: mscvpdb.h:1696
struct codeview_symbol::@3503 block_v3
#define S_UDT_V2
Definition: mscvpdb.h:1689
#define S_SECTINFO_V3
Definition: mscvpdb.h:1758
#define S_CONSTANT_V3
Definition: mscvpdb.h:1711
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
#define S_DEFRANGE_FRAMEPOINTER_REL
Definition: mscvpdb.h:1771
#define S_ENTRYPOINT_V3
Definition: mscvpdb.h:1760
struct codeview_symbol::@3495 stack_v1
#define S_LTHREAD_V1
Definition: mscvpdb.h:1679
#define S_GDATA_V3
Definition: mscvpdb.h:1717
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_INLINESITE_END
Definition: mscvpdb.h:1783
struct symt_data * symt_new_constant(struct module *module, struct symt_compiland *parent, const char *name, struct symt *type, const VARIANT *v) DECLSPEC_HIDDEN
Definition: symbol.c:527
smooth NULL
Definition: ftsmooth.c:416
struct codeview_symbol::@3500 register_v2
struct codeview_symbol::@3514 compiland_v2
struct codeview_symbol::@3516 thread_v1
#define S_LABEL_V1
Definition: mscvpdb.h:1675
#define S_SECUCOOKIE_V3
Definition: mscvpdb.h:1762
struct codeview_symbol::@3485 data_v2
struct codeview_symbol::@3512 objname_v1
#define S_GDATA_V1
Definition: mscvpdb.h:1668
#define S_END_V1
Definition: mscvpdb.h:1656
#define S_TRAMPOLINE
Definition: mscvpdb.h:1748
#define S_BLOCK_V3
Definition: mscvpdb.h:1707
static int leaf_as_variant(VARIANT *v, const unsigned short int *leaf)
Definition: msc.c:266
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
struct codeview_symbol::@3488 thunk_v3
struct codeview_symbol::@3504 label_v1
#define debugstr_a
Definition: kernel32.h:31
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define S_PUB_V2
Definition: mscvpdb.h:1695
#define S_LDATA_V1
Definition: mscvpdb.h:1667
#define S_CONSTANT_V1
Definition: mscvpdb.h:1653
#define S_PUB_FUNC1_V3
Definition: mscvpdb.h:1741
#define S_OBJNAME_V1
Definition: mscvpdb.h:1659
static unsigned long codeview_get_address(const struct msc_debug_info *msc_dbg, unsigned seg, unsigned offset)
Definition: msc.c:1558
#define S_LABEL_V3
Definition: mscvpdb.h:1709
struct codeview_symbol::@3509 udt_v1
#define S_LTHREAD_V2
Definition: mscvpdb.h:1700
#define S_GPROC_V1
Definition: mscvpdb.h:1671
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
#define S_MSTOOLENV_V3
Definition: mscvpdb.h:1765
struct codeview_symbol::@3501 register_v3
#define S_LOCAL_VS2013
Definition: mscvpdb.h:1767
#define S_FRAMEINFO_V2
Definition: mscvpdb.h:1702
struct codeview_symbol::@3486 data_v3
BOOL symt_normalize_function(struct module *module, const struct symt_function *func) DECLSPEC_HIDDEN
Definition: symbol.c:475
#define S_ALIGN_V1
Definition: mscvpdb.h:1684
struct codeview_symbol::@3511 udt_v3
static struct symt * codeview_get_type(unsigned int typeno, BOOL quiet)
Definition: msc.c:520
const GLdouble * v
Definition: gl.h:2040
struct module * module
Definition: mscvpdb.h:2124
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 S_REGISTER_V1
Definition: mscvpdb.h:1652
struct codeview_symbol::@3484 data_v1
#define S_CALLEES
Definition: mscvpdb.h:1791
#define S_DEFRANGE_REGISTER_REL
Definition: mscvpdb.h:1774
static const char * terminate_string(const struct p_string *p_name)
Definition: msc.c:510
struct codeview_symbol::@3506 constant_v1
#define S_SUBSECTINFO_V3
Definition: mscvpdb.h:1759
#define S_BLOCK_V1
Definition: mscvpdb.h:1673
unsigned long address
#define S_GPROC_V3
Definition: mscvpdb.h:1720
#define S_LPROCREF_V1
Definition: mscvpdb.h:1685
unsigned source_new(struct module *module, const char *basedir, const char *source) DECLSPEC_HIDDEN
Definition: source.c:67
#define S_SSEARCH_V1
Definition: mscvpdb.h:1655
struct codeview_symbol::@3498 regrel_v3
#define S_PUB_V3
Definition: mscvpdb.h:1718
Definition: name.c:36
#define S_LPROC_V3
Definition: mscvpdb.h:1719
struct codeview_symbol::@3489 proc_v1
#define S_FPOFF_VS2013
Definition: mscvpdb.h:1773
struct codeview_symbol::@3519 ssearch_v1
#define S_GDATA_V2
Definition: mscvpdb.h:1694
#define S_GTHREAD_V2
Definition: mscvpdb.h:1701
#define S_REGISTER_V3
Definition: mscvpdb.h:1710
struct symt_thunk * symt_new_thunk(struct module *module, struct symt_compiland *parent, const char *name, THUNK_ORDINAL ord, unsigned long addr, unsigned long size) DECLSPEC_HIDDEN
Definition: symbol.c:498
#define S_GTHREAD_V3
Definition: mscvpdb.h:1723
struct symt_hierarchy_point * symt_new_label(struct module *module, struct symt_compiland *compiland, const char *name, unsigned long address) DECLSPEC_HIDDEN
Definition: symbol.c:556
#define S_PROCREF_V1
Definition: mscvpdb.h:1682
#define S_FILESTATIC
Definition: mscvpdb.h:1789
struct codeview_symbol::@3505 label_v3
#define S_BPREL_V2
Definition: mscvpdb.h:1692
#define TRACE_ON(x)
Definition: compat.h:65
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
static void dump(const void *ptr, unsigned len)
Definition: msc.c:102
struct codeview_symbol::@3490 proc_v2
struct codeview_symbol::@3518 thread_v3
#define S_PUB_V1
Definition: mscvpdb.h:1669
struct codeview_symbol::@3510 udt_v2
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by codeview_process_info(), and pdb_process_internal().

◆ codeview_snarf_linetab()

static void codeview_snarf_linetab ( const struct msc_debug_info msc_dbg,
const BYTE linetab,
int  size,
BOOL  pascal_str 
)
static

Definition at line 1399 of file msc.c.

1401 {
1402  const BYTE* ptr = linetab;
1403  int nfile, nseg;
1404  int i, j;
1405  unsigned int k;
1406  const unsigned int* filetab;
1407  const unsigned int* lt_ptr;
1408  const unsigned short* linenos;
1409  const struct startend* start;
1410  unsigned source;
1411  unsigned long addr, func_addr0;
1412  struct symt_function* func;
1413  const struct codeview_linetab_block* ltb;
1414 
1415  nfile = *(const short*)linetab;
1416  filetab = (const unsigned int*)(linetab + 2 * sizeof(short));
1417 
1418  for (i = 0; i < nfile; i++)
1419  {
1420  ptr = linetab + filetab[i];
1421  nseg = *(const short*)ptr;
1422  lt_ptr = (const unsigned int*)(ptr + 2 * sizeof(short));
1423  start = (const struct startend*)(lt_ptr + nseg);
1424 
1425  /*
1426  * Now snarf the filename for all of the segments for this file.
1427  */
1428  if (pascal_str)
1429  source = source_new(msc_dbg->module, NULL, terminate_string((const struct p_string*)(start + nseg)));
1430  else
1431  source = source_new(msc_dbg->module, NULL, (const char*)(start + nseg));
1432 
1433  for (j = 0; j < nseg; j++)
1434  {
1435  ltb = (const struct codeview_linetab_block*)(linetab + *lt_ptr++);
1436  linenos = (const unsigned short*)&ltb->offsets[ltb->num_lines];
1437  func_addr0 = codeview_get_address(msc_dbg, ltb->seg, start[j].start);
1438  if (!func_addr0) continue;
1439  for (func = NULL, k = 0; k < ltb->num_lines; k++)
1440  {
1441  /* now locate function (if any) */
1442  addr = func_addr0 + ltb->offsets[k] - start[j].start;
1443  /* unfortunately, we can have several functions in the same block, if there's no
1444  * gap between them... find the new function if needed
1445  */
1446  if (!func || addr >= func->address + func->size)
1447  {
1448  func = (struct symt_function*)symt_find_nearest(msc_dbg->module, addr);
1449  /* FIXME: at least labels support line numbers */
1450  if (!func || func->symt.tag != SymTagFunction)
1451  {
1452  WARN("--not a func at %04x:%08x %lx tag=%d\n",
1453  ltb->seg, ltb->offsets[k], addr, func ? func->symt.tag : -1);
1454  func = NULL;
1455  break;
1456  }
1457  }
1458  symt_add_func_line(msc_dbg->module, func, source,
1459  linenos[k], addr - func->address);
1460  }
1461  }
1462  }
1463 }
GLenum func
Definition: glext.h:6028
unsigned int offsets[1]
Definition: mscvpdb.h:1812
#define WARN(fmt,...)
Definition: debug.h:111
unsigned short seg
Definition: mscvpdb.h:1810
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
unsigned short num_lines
Definition: mscvpdb.h:1811
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
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 GLint GLint j
Definition: glfuncs.h:250
static unsigned long codeview_get_address(const struct msc_debug_info *msc_dbg, unsigned seg, unsigned offset)
Definition: msc.c:1558
GLenum const GLvoid * addr
Definition: glext.h:9621
unsigned char BYTE
Definition: mem.h:68
struct module * module
Definition: mscvpdb.h:2124
GLuint start
Definition: gl.h:1545
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
static const char * terminate_string(const struct p_string *p_name)
Definition: msc.c:510
unsigned source_new(struct module *module, const char *basedir, const char *source) DECLSPEC_HIDDEN
Definition: source.c:67
int k
Definition: mpi.c:3369
struct symt_ht * symt_find_nearest(struct module *module, DWORD_PTR addr) DECLSPEC_HIDDEN
Definition: symbol.c:905

Referenced by codeview_process_info(), and pdb_process_internal().

◆ codeview_snarf_linetab2()

static void codeview_snarf_linetab2 ( const struct msc_debug_info msc_dbg,
const BYTE linetab,
DWORD  size,
const char strimage,
DWORD  strsize 
)
static

Definition at line 1465 of file msc.c.

1467 {
1468  unsigned i;
1469  DWORD_PTR addr;
1470  const struct codeview_linetab2* lt2;
1471  const struct codeview_linetab2* lt2_files = NULL;
1472  const struct codeview_lt2blk_lines* lines_blk;
1473  const struct codeview_linetab2_file*fd;
1474  unsigned source;
1475  struct symt_function* func;
1476 
1477  /* locate LT2_FILES_BLOCK (if any) */
1478  lt2 = (const struct codeview_linetab2*)linetab;
1479  while ((const BYTE*)(lt2 + 1) < linetab + size)
1480  {
1481  if (lt2->header == LT2_FILES_BLOCK)
1482  {
1483  lt2_files = lt2;
1484  break;
1485  }
1486  lt2 = codeview_linetab2_next_block(lt2);
1487  }
1488  if (!lt2_files)
1489  {
1490  TRACE("No LT2_FILES_BLOCK found\n");
1491  return;
1492  }
1493 
1494  lt2 = (const struct codeview_linetab2*)linetab;
1495  while ((const BYTE*)(lt2 + 1) < linetab + size)
1496  {
1497  /* FIXME: should also check that whole lines_blk fits in linetab + size */
1498  switch (lt2->header)
1499  {
1500  case LT2_LINES_BLOCK:
1501  /* Skip blocks that are too small - Intel C Compiler generates these. */
1502  if (lt2->size_of_block < sizeof (struct codeview_lt2blk_lines)) break;
1503  lines_blk = (const struct codeview_lt2blk_lines*)lt2;
1504  /* FIXME: should check that file_offset is within the LT2_FILES_BLOCK we've seen */
1505  addr = codeview_get_address(msc_dbg, lines_blk->seg, lines_blk->start);
1506  TRACE("block from %04x:%08x #%x (%x lines)\n",
1507  lines_blk->seg, lines_blk->start, lines_blk->size, lines_blk->nlines);
1508  fd = (const struct codeview_linetab2_file*)((const char*)lt2_files + 8 + lines_blk->file_offset);
1509  /* FIXME: should check that string is within strimage + strsize */
1510  source = source_new(msc_dbg->module, NULL, strimage + fd->offset);
1511  func = (struct symt_function*)symt_find_nearest(msc_dbg->module, addr);
1512  /* FIXME: at least labels support line numbers */
1513  if (!func || func->symt.tag != SymTagFunction)
1514  {
1515  WARN("--not a func at %04x:%08x %lx tag=%d\n",
1516  lines_blk->seg, lines_blk->start, addr, func ? func->symt.tag : -1);
1517  break;
1518  }
1519  for (i = 0; i < lines_blk->nlines; i++)
1520  {
1521  symt_add_func_line(msc_dbg->module, func, source,
1522  lines_blk->l[i].lineno ^ 0x80000000,
1523  lines_blk->l[i].offset);
1524  }
1525  break;
1526  case LT2_FILES_BLOCK: /* skip */
1527  break;
1528  default:
1529  TRACE("Block end %x\n", lt2->header);
1530  lt2 = (const struct codeview_linetab2*)((const char*)linetab + size);
1531  continue;
1532  }
1533  lt2 = codeview_linetab2_next_block(lt2);
1534  }
1535 }
GLenum func
Definition: glext.h:6028
DWORD size_of_block
Definition: mscvpdb.h:1836
struct codeview_linetab2 lt2
Definition: mscvpdb.h:1860
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
#define WARN(fmt,...)
Definition: debug.h:111
static int fd
Definition: io.c:51
#define LT2_LINES_BLOCK
Definition: mscvpdb.h:1822
static const struct codeview_linetab2 * codeview_linetab2_next_block(const struct codeview_linetab2 *lt2)
Definition: mscvpdb.h:1839
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
smooth NULL
Definition: ftsmooth.c:416
#define LT2_FILES_BLOCK
Definition: mscvpdb.h:1823
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
struct codeview_lt2blk_lines::@3522 l[1]
static unsigned long codeview_get_address(const struct msc_debug_info *msc_dbg, unsigned seg, unsigned offset)
Definition: msc.c:1558
GLenum const GLvoid * addr
Definition: glext.h:9621
unsigned char BYTE
Definition: mem.h:68
uint32_t DWORD_PTR
Definition: typedefs.h:63
struct module * module
Definition: mscvpdb.h:2124
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
unsigned source_new(struct module *module, const char *basedir, const char *source) DECLSPEC_HIDDEN
Definition: source.c:67
struct symt_ht * symt_find_nearest(struct module *module, DWORD_PTR addr) DECLSPEC_HIDDEN
Definition: symbol.c:905

Referenced by pdb_process_internal().

◆ codeview_snarf_public()

static BOOL codeview_snarf_public ( const struct msc_debug_info msc_dbg,
const BYTE root,
int  offset,
int  size 
)
static

Definition at line 2049 of file msc.c.

2052 {
2053  int i, length;
2054  struct symt_compiland* compiland = NULL;
2055 
2056  /*
2057  * Loop over the different types of records and whenever we
2058  * find something we are interested in, record it and move on.
2059  */
2060  for (i = offset; i < size; i += length)
2061  {
2062  const union codeview_symbol* sym = (const union codeview_symbol*)(root + i);
2063  length = sym->generic.len + 2;
2064  if (i + length > size) break;
2065  if (!sym->generic.id || length < 4) break;
2066  if (length & 3) FIXME("unpadded len %u\n", length);
2067 
2068  switch (sym->generic.id)
2069  {
2070  case S_PUB_V1:
2072  {
2073  symt_new_public(msc_dbg->module, compiland,
2074  terminate_string(&sym->public_v1.p_name),
2075  sym->public_v1.symtype == SYMTYPE_FUNCTION,
2076  codeview_get_address(msc_dbg, sym->public_v1.segment, sym->public_v1.offset), 1);
2077  }
2078  break;
2079  case S_PUB_V2:
2081  {
2082  symt_new_public(msc_dbg->module, compiland,
2083  terminate_string(&sym->public_v2.p_name),
2084  sym->public_v3.symtype == SYMTYPE_FUNCTION,
2085  codeview_get_address(msc_dbg, sym->public_v2.segment, sym->public_v2.offset), 1);
2086  }
2087  break;
2088 
2089  case S_PUB_V3:
2091  {
2092  symt_new_public(msc_dbg->module, compiland,
2093  sym->public_v3.name,
2094  sym->public_v3.symtype == SYMTYPE_FUNCTION,
2095  codeview_get_address(msc_dbg, sym->public_v3.segment, sym->public_v3.offset), 1);
2096  }
2097  break;
2098  case S_PUB_FUNC1_V3:
2099  case S_PUB_FUNC2_V3: /* using a data_v3 isn't what we'd expect */
2100 #if 0
2101  /* FIXME: this is plain wrong (from a simple test) */
2103  {
2104  symt_new_public(msc_dbg->module, compiland,
2105  sym->data_v3.name,
2106  codeview_get_address(msc_dbg, sym->data_v3.segment, sym->data_v3.offset), 1);
2107  }
2108 #endif
2109  break;
2110  /*
2111  * Global and local data symbols. We don't associate these
2112  * with any given source file.
2113  */
2114  case S_GDATA_V1:
2115  case S_LDATA_V1:
2116  codeview_add_variable(msc_dbg, compiland, terminate_string(&sym->data_v1.p_name),
2117  sym->data_v1.segment, sym->data_v1.offset, sym->data_v1.symtype,
2118  sym->generic.id == S_LDATA_V1, FALSE, FALSE);
2119  break;
2120  case S_GDATA_V2:
2121  case S_LDATA_V2:
2122  codeview_add_variable(msc_dbg, compiland, terminate_string(&sym->data_v2.p_name),
2123  sym->data_v2.segment, sym->data_v2.offset, sym->data_v2.symtype,
2124  sym->generic.id == S_LDATA_V2, FALSE, FALSE);
2125  break;
2126  case S_GDATA_V3:
2127  case S_LDATA_V3:
2128  codeview_add_variable(msc_dbg, compiland, sym->data_v3.name,
2129  sym->data_v3.segment, sym->data_v3.offset, sym->data_v3.symtype,
2130  sym->generic.id == S_LDATA_V3, FALSE, FALSE);
2131  break;
2132 
2133  /* variables with thread storage */
2134  case S_GTHREAD_V1:
2135  case S_LTHREAD_V1:
2136  codeview_add_variable(msc_dbg, compiland, terminate_string(&sym->thread_v1.p_name),
2137  sym->thread_v1.segment, sym->thread_v1.offset, sym->thread_v1.symtype,
2138  sym->generic.id == S_LTHREAD_V1, TRUE, FALSE);
2139  break;
2140  case S_GTHREAD_V2:
2141  case S_LTHREAD_V2:
2142  codeview_add_variable(msc_dbg, compiland, terminate_string(&sym->thread_v2.p_name),
2143  sym->thread_v2.segment, sym->thread_v2.offset, sym->thread_v2.symtype,
2144  sym->generic.id == S_LTHREAD_V2, TRUE, FALSE);
2145  break;
2146  case S_GTHREAD_V3:
2147  case S_LTHREAD_V3:
2148  codeview_add_variable(msc_dbg, compiland, sym->thread_v3.name,
2149  sym->thread_v3.segment, sym->thread_v3.offset, sym->thread_v3.symtype,
2150  sym->generic.id == S_LTHREAD_V3, TRUE, FALSE);
2151  break;
2152 
2153  /*
2154  * These are special, in that they are always followed by an
2155  * additional length-prefixed string which is *not* included
2156  * into the symbol length count. We need to skip it.
2157  */
2158  case S_PROCREF_V1:
2159  case S_DATAREF_V1:
2160  case S_LPROCREF_V1:
2161  length += (((const char*)sym)[length] + 1 + 3) & ~3;
2162  break;
2163  }
2164  msc_dbg->module->sortlist_valid = TRUE;
2165  }
2166  msc_dbg->module->sortlist_valid = FALSE;
2167  return TRUE;
2168 }
#define S_LDATA_V3
Definition: mscvpdb.h:1716
#define S_PUB_FUNC2_V3
Definition: mscvpdb.h:1743
#define TRUE
Definition: types.h:120
#define S_DATAREF_V1
Definition: mscvpdb.h:1683
struct codeview_symbol::@3494 public_v3
#define S_GTHREAD_V1
Definition: mscvpdb.h:1680
GLintptr offset
Definition: glext.h:5920
#define S_LTHREAD_V3
Definition: mscvpdb.h:1722
struct codeview_symbol::@3483 generic
struct codeview_symbol::@3517 thread_v2
static void codeview_add_variable(const struct msc_debug_info *msc_dbg, struct symt_compiland *compiland, const char *name, unsigned segment, unsigned offset, unsigned symtype, BOOL is_local, BOOL in_tls, BOOL force)
Definition: msc.c:1569
#define S_LDATA_V2
Definition: mscvpdb.h:1693
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
#define S_LTHREAD_V1
Definition: mscvpdb.h:1679
#define S_GDATA_V3
Definition: mscvpdb.h:1717
struct symt_public * symt_new_public(struct module *module, struct symt_compiland *parent, const char *typename, BOOL is_function, unsigned long address, unsigned size) DECLSPEC_HIDDEN
Definition: symbol.c:226
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
struct codeview_symbol::@3516 thread_v1
#define SYMTYPE_FUNCTION
Definition: mscvpdb.h:1235
struct codeview_symbol::@3485 data_v2
#define S_GDATA_V1
Definition: mscvpdb.h:1668
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define S_PUB_V2
Definition: mscvpdb.h:1695
#define S_LDATA_V1
Definition: mscvpdb.h:1667
struct codeview_symbol::@3493 public_v2
#define S_PUB_FUNC1_V3
Definition: mscvpdb.h:1741
static unsigned long codeview_get_address(const struct msc_debug_info *msc_dbg, unsigned seg, unsigned offset)
Definition: msc.c:1558
unsigned dbghelp_options
Definition: dbghelp.c:72
#define S_LTHREAD_V2
Definition: mscvpdb.h:1700
struct codeview_symbol::@3486 data_v3
struct module * module
Definition: mscvpdb.h:2124
struct codeview_symbol::@3484 data_v1
static const char * terminate_string(const struct p_string *p_name)
Definition: msc.c:510
#define S_LPROCREF_V1
Definition: mscvpdb.h:1685
#define S_PUB_V3
Definition: mscvpdb.h:1718
#define S_GDATA_V2
Definition: mscvpdb.h:1694
#define S_GTHREAD_V2
Definition: mscvpdb.h:1701
#define SYMOPT_NO_PUBLICS
Definition: compat.h:642
#define S_GTHREAD_V3
Definition: mscvpdb.h:1723
#define S_PROCREF_V1
Definition: mscvpdb.h:1682
struct codeview_symbol::@3518 thread_v3
#define S_PUB_V1
Definition: mscvpdb.h:1669
struct codeview_symbol::@3492 public_v1

Referenced by pdb_process_internal().

◆ dump()

static void dump ( const void ptr,
unsigned  len 
)
static

Definition at line 102 of file msc.c.

103 {
104  unsigned int i, j;
105  char msg[128];
106  const char* hexof = "0123456789abcdef";
107  const BYTE* x = ptr;
108 
109  for (i = 0; i < len; i += 16)
110  {
111  sprintf(msg, "%08x: ", i);
112  memset(msg + 10, ' ', 3 * 16 + 1 + 16);
113  for (j = 0; j < min(16, len - i); j++)
114  {
115  msg[10 + 3 * j + 0] = hexof[x[i + j] >> 4];
116  msg[10 + 3 * j + 1] = hexof[x[i + j] & 15];
117  msg[10 + 3 * j + 2] = ' ';
118  msg[10 + 3 * 16 + 1 + j] = (x[i + j] >= 0x20 && x[i + j] < 0x7f) ?
119  x[i + j] : '.';
120  }
121  msg[10 + 3 * 16] = ' ';
122  msg[10 + 3 * 16 + 1 + 16] = '\0';
123  FIXME("%s\n", msg);
124  }
125 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define sprintf(buf, format,...)
Definition: sprintf.c:55
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
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
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 GLint GLint j
Definition: glfuncs.h:250
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
#define min(a, b)
Definition: monoChain.cc:55
#define msg(x)
Definition: auth_time.c:54
#define memset(x, y, z)
Definition: compat.h:39

Referenced by codeview_parse_one_type(), codeview_snarf(), ok_sequence_(), pdb_init(), and xmlMemoryDump().

◆ leaf_as_variant()

static int leaf_as_variant ( VARIANT v,
const unsigned short int leaf 
)
static

Definition at line 266 of file msc.c.

267 {
268  unsigned short int type = *leaf++;
269  int length = 2;
270 
271  if (type < LF_NUMERIC)
272  {
273  v->n1.n2.vt = VT_UINT;
274  v->n1.n2.n3.uintVal = type;
275  }
276  else
277  {
278  switch (type)
279  {
280  case LF_CHAR:
281  length += 1;
282  v->n1.n2.vt = VT_I1;
283  v->n1.n2.n3.cVal = *(const char*)leaf;
284  break;
285 
286  case LF_SHORT:
287  length += 2;
288  v->n1.n2.vt = VT_I2;
289  v->n1.n2.n3.iVal = *(const short*)leaf;
290  break;
291 
292  case LF_USHORT:
293  length += 2;
294  v->n1.n2.vt = VT_UI2;
295  v->n1.n2.n3.uiVal = *leaf;
296  break;
297 
298  case LF_LONG:
299  length += 4;
300  v->n1.n2.vt = VT_I4;
301  v->n1.n2.n3.lVal = *(const int*)leaf;
302  break;
303 
304  case LF_ULONG:
305  length += 4;
306  v->n1.n2.vt = VT_UI4;
307  v->n1.n2.n3.uiVal = *(const unsigned int*)leaf;
308  break;
309 
310  case LF_QUADWORD:
311  length += 8;
312  v->n1.n2.vt = VT_I8;
313  v->n1.n2.n3.llVal = *(const long long int*)leaf;
314  break;
315 
316  case LF_UQUADWORD:
317  length += 8;
318  v->n1.n2.vt = VT_UI8;
319  v->n1.n2.n3.ullVal = *(const long long unsigned int*)leaf;
320  break;
321 
322  case LF_REAL32:
323  length += 4;
324  v->n1.n2.vt = VT_R4;
325  v->n1.n2.n3.fltVal = *(const float*)leaf;
326  break;
327 
328  case LF_REAL48:
329  FIXME("Unsupported numeric leaf type %04x\n", type);
330  length += 6;
331  v->n1.n2.vt = VT_EMPTY; /* FIXME */
332  break;
333 
334  case LF_REAL64:
335  length += 8;
336  v->n1.n2.vt = VT_R8;
337  v->n1.n2.n3.fltVal = *(const double*)leaf;
338  break;
339 
340  case LF_REAL80:
341  FIXME("Unsupported numeric leaf type %04x\n", type);
342  length += 10;
343  v->n1.n2.vt = VT_EMPTY; /* FIXME */
344  break;
345 
346  case LF_REAL128:
347  FIXME("Unsupported numeric leaf type %04x\n", type);
348  length += 16;
349  v->n1.n2.vt = VT_EMPTY; /* FIXME */
350  break;
351 
352  case LF_COMPLEX32:
353  FIXME("Unsupported numeric leaf type %04x\n", type);
354  length += 4;
355  v->n1.n2.vt = VT_EMPTY; /* FIXME */
356  break;
357 
358  case LF_COMPLEX64:
359  FIXME("Unsupported numeric leaf type %04x\n", type);
360  length += 8;
361  v->n1.n2.vt = VT_EMPTY; /* FIXME */
362  break;
363 
364  case LF_COMPLEX80:
365  FIXME("Unsupported numeric leaf type %04x\n", type);
366  length += 10;
367  v->n1.n2.vt = VT_EMPTY; /* FIXME */
368  break;
369 
370  case LF_COMPLEX128:
371  FIXME("Unsupported numeric leaf type %04x\n", type);
372  length += 16;
373  v->n1.n2.vt = VT_EMPTY; /* FIXME */
374  break;
375 
376  case LF_VARSTRING:
377  FIXME("Unsupported numeric leaf type %04x\n", type);
378  length += 2 + *leaf;
379  v->n1.n2.vt = VT_EMPTY; /* FIXME */
380  break;
381 
382  default:
383  FIXME("Unknown numeric leaf type %04x\n", type);
384  v->n1.n2.vt = VT_EMPTY; /* FIXME */
385  break;
386  }
387  }
388 
389  return length;
390 }
#define LF_COMPLEX32
Definition: mscvpdb.h:1226
#define LF_NUMERIC
Definition: mscvpdb.h:1213
Definition: compat.h:1939
Definition: compat.h:1955
Definition: compat.h:1951
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define LF_UQUADWORD
Definition: mscvpdb.h:1224
#define LF_COMPLEX64
Definition: mscvpdb.h:1227
#define LF_COMPLEX80
Definition: mscvpdb.h:1228
#define LF_QUADWORD
Definition: mscvpdb.h:1223
#define LF_REAL48
Definition: mscvpdb.h:1225
#define FIXME(fmt,...)
Definition: debug.h:110
#define LF_REAL32
Definition: mscvpdb.h:1219
#define LF_LONG
Definition: mscvpdb.h:1217
#define LF_COMPLEX128
Definition: mscvpdb.h:1229
#define LF_REAL128
Definition: mscvpdb.h:1222
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define LF_USHORT
Definition: mscvpdb.h:1216
#define LF_VARSTRING
Definition: mscvpdb.h:1230
Definition: compat.h:1940
const GLdouble * v
Definition: gl.h:2040
#define LF_REAL80
Definition: mscvpdb.h:1221
#define LF_CHAR
Definition: mscvpdb.h:1214
#define LF_REAL64
Definition: mscvpdb.h:1220
#define LF_SHORT
Definition: mscvpdb.h:1215
#define LF_ULONG
Definition: mscvpdb.h:1218
Definition: compat.h:1941
Definition: compat.h:1938

Referenced by codeview_snarf().

◆ map_pdb_file()

static HANDLE map_pdb_file ( const struct process pcs,
const struct pdb_lookup lookup,
struct module module 
)
static

Definition at line 2445 of file msc.c.

2448 {
2449  HANDLE hFile, hMap = NULL;
2450  char dbg_file_path[MAX_PATH];
2451  BOOL ret = FALSE;
2452 
2453  switch (lookup->kind)
2454  {
2455  case PDB_JG:
2456  ret = path_find_symbol_file(pcs, module, lookup->filename, NULL, lookup->timestamp,
2457  lookup->age, dbg_file_path, &module->module.PdbUnmatched);
2458  break;
2459  case PDB_DS:
2460  ret = path_find_symbol_file(pcs, module, lookup->filename, &lookup->guid, 0,
2461  lookup->age, dbg_file_path, &module->module.PdbUnmatched);
2462  break;
2463  }
2464  if (!ret)
2465  {
2466  WARN("\tCouldn't find %s\n", lookup->filename);
2467  return NULL;
2468  }
2469  if ((hFile = CreateFileA(dbg_file_path, GENERIC_READ, FILE_SHARE_READ, NULL,
2471  {
2472  hMap = CreateFileMappingW(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
2473  CloseHandle(hFile);
2474  }
2475  return hMap;
2476 }
#define CloseHandle
Definition: compat.h:398
#define WARN(fmt,...)
Definition: debug.h:111
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
static ULONG lookup[16]
Definition: vga.c:46
#define FILE_SHARE_READ
Definition: compat.h:125
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:401
#define MAX_PATH
Definition: compat.h:26
int ret