ReactOS 0.4.15-dev-7897-g78dc504
msc.c File Reference
#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 ULONG_PTR 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, union ctx *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 3257 of file msc.c.

◆ CODEVIEW_NB10_SIG

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

Definition at line 3258 of file msc.c.

◆ CODEVIEW_NB11_SIG

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

Definition at line 3259 of file msc.c.

◆ CODEVIEW_RSDS_SIG

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

Definition at line 3260 of file msc.c.

◆ CV_MAX_MODULES [1/2]

#define CV_MAX_MODULES   32

Definition at line 136 of file msc.c.

◆ CV_MAX_MODULES [2/2]

#define CV_MAX_MODULES   32

Definition at line 136 of file msc.c.

◆ FIRST_DEFINABLE_TYPE

#define FIRST_DEFINABLE_TYPE   0x1000

Definition at line 125 of file msc.c.

◆ MAKESIG

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

Definition at line 3256 of file msc.c.

◆ MAX_BUILTIN_TYPES

#define MAX_BUILTIN_TYPES   0x06FF

Definition at line 124 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 2965 of file msc.c.

◆ PEV_ERROR1

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

Definition at line 2966 of file msc.c.

◆ PEV_MAX_LEN

#define PEV_MAX_LEN   32

Definition at line 2948 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 1074 of file msc.c.

1078{
1079 const union codeview_reftype* reftype;
1080
1081 sym->rettype = codeview_fetch_type(ctp, ret_type, FALSE);
1082 if (args_list && (reftype = codeview_jump_to_type(ctp, args_list)))
1083 {
1084 unsigned int i;
1085 switch (reftype->generic.id)
1086 {
1087 case LF_ARGLIST_V1:
1088 for (i = 0; i < reftype->arglist_v1.num; i++)
1090 codeview_fetch_type(ctp, reftype->arglist_v1.args[i], FALSE));
1091 break;
1092 case LF_ARGLIST_V2:
1093 for (i = 0; i < reftype->arglist_v2.num; i++)
1095 codeview_fetch_type(ctp, reftype->arglist_v2.args[i], FALSE));
1096 break;
1097 default:
1098 FIXME("Unexpected leaf %x for signature's pmt\n", reftype->generic.id);
1099 }
1100 }
1101}
#define FIXME(fmt,...)
Definition: debug.h:111
BOOL symt_add_function_signature_parameter(struct module *module, struct symt_function_signature *sig, struct symt *param) DECLSPEC_HIDDEN
Definition: type.c:394
#define FALSE
Definition: types.h:117
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 const void * codeview_jump_to_type(const struct codeview_type_parse *ctp, DWORD idx)
Definition: msc.c:555
static struct symt * codeview_fetch_type(struct codeview_type_parse *ctp, unsigned typeno, BOOL details)
Definition: msc.c:631
#define LF_ARGLIST_V2
Definition: mscvpdb.h:1157
#define LF_ARGLIST_V1
Definition: mscvpdb.h:1143
struct module * module
Definition: msc.c:549
struct codeview_reftype::@3590 arglist_v1
struct codeview_reftype::@3586 generic
struct codeview_reftype::@3591 arglist_v2

Referenced by codeview_parse_one_type().

◆ codeview_add_type()

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

Definition at line 562 of file msc.c.

563{
564 if (typeno < FIRST_DEFINABLE_TYPE)
565 FIXME("What the heck\n");
567 {
568 FIXME("Adding %x to non allowed module\n", typeno);
569 return FALSE;
570 }
571 if ((typeno >> 24) != 0)
572 FIXME("No module index while inserting type-id assumption is wrong %x\n",
573 typeno);
574 if (typeno - FIRST_DEFINABLE_TYPE >= cv_current_module->num_defined_types)
575 {
576 if (cv_current_module->defined_types)
577 {
578 cv_current_module->num_defined_types = max( cv_current_module->num_defined_types * 2,
579 typeno - FIRST_DEFINABLE_TYPE + 1 );
581 HEAP_ZERO_MEMORY, cv_current_module->defined_types,
582 cv_current_module->num_defined_types * sizeof(struct symt*));
583 }
584 else
585 {
586 cv_current_module->num_defined_types = max( 256, typeno - FIRST_DEFINABLE_TYPE + 1 );
587 cv_current_module->defined_types = HeapAlloc(GetProcessHeap(),
589 cv_current_module->num_defined_types * sizeof(struct symt*));
590 }
591 if (cv_current_module->defined_types == NULL) return FALSE;
592 }
593 if (cv_current_module->defined_types[typeno - FIRST_DEFINABLE_TYPE])
594 {
595 if (cv_current_module->defined_types[typeno - FIRST_DEFINABLE_TYPE] != dt)
596 FIXME("Overwriting at %x\n", typeno);
597 }
598 cv_current_module->defined_types[typeno - FIRST_DEFINABLE_TYPE] = dt;
599 return TRUE;
600}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define FIRST_DEFINABLE_TYPE
Definition: msc.c:125
static struct cv_defined_module * cv_current_module
Definition: msc.c:138
#define max(a, b)
Definition: svc.c:63

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 666 of file msc.c.

671{
672 struct symt* elem = codeview_fetch_type(ctp, elemtype, FALSE);
673 struct symt* index = codeview_fetch_type(ctp, indextype, FALSE);
674
675 return &symt_new_array(ctp->module, 0, -arr_len, elem, index)->symt;
676}
struct symt_array * symt_new_array(struct module *module, int min, int max, struct symt *base, struct symt *index) DECLSPEC_HIDDEN
Definition: type.c:345
GLuint index
Definition: glext.h:6031
static size_t elem
Definition: string.c:68

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 983 of file msc.c.

988{
989 struct symt_enum* symt;
990
991 if (existing)
992 {
993 if (!(symt = codeview_cast_symt(existing, SymTagEnum))) return NULL;
994 /* should also check that all fields are the same */
995 }
996 else
997 {
999 codeview_fetch_type(ctp, basetype, FALSE));
1000 if (fieldlistno)
1001 {
1002 const union codeview_reftype* fieldlist;
1003 fieldlist = codeview_jump_to_type(ctp, fieldlistno);
1005 }
1006 }
1007 return &symt->symt;
1008}
struct symt_enum * symt_new_enum(struct module *module, const char *typename, struct symt *basetype) DECLSPEC_HIDDEN
Definition: type.c:304
SymTagEnum
Definition: compat.h:1580
static BOOL codeview_add_type_enum_field_list(struct module *module, struct symt_enum *symt, const union codeview_reftype *ref_type)
Definition: msc.c:678
static void * codeview_cast_symt(struct symt *symt, enum SymTagEnum tag)
Definition: msc.c:621
Definition: name.c:39
struct symt symt
struct codeview_reftype::@3587 fieldlist

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 678 of file msc.c.

681{
682 const unsigned char* ptr = ref_type->fieldlist.list;
683 const unsigned char* last = (const BYTE*)ref_type + ref_type->generic.len + 2;
684 const union codeview_fieldtype* type;
685
686 while (ptr < last)
687 {
688 if (*ptr >= 0xf0) /* LF_PAD... */
689 {
690 ptr += *ptr & 0x0f;
691 continue;
692 }
693
694 type = (const union codeview_fieldtype*)ptr;
695
696 switch (type->generic.id)
697 {
698 case LF_ENUMERATE_V1:
699 {
700 int value, vlen = numeric_leaf(&value, &type->enumerate_v1.value);
701 const struct p_string* p_name = (const struct p_string*)((const unsigned char*)&type->enumerate_v1.value + vlen);
702
704 ptr += 2 + 2 + vlen + (1 + p_name->namelen);
705 break;
706 }
707 case LF_ENUMERATE_V3:
708 {
709 int value, vlen = numeric_leaf(&value, &type->enumerate_v3.value);
710 const char* name = (const char*)&type->enumerate_v3.value + vlen;
711
713 ptr += 2 + 2 + vlen + (1 + strlen(name));
714 break;
715 }
716
717 default:
718 FIXME("Unsupported type %04x in ENUM field list\n", type->generic.id);
719 return FALSE;
720 }
721 }
722 return TRUE;
723}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
BOOL symt_add_enum_element(struct module *module, struct symt_enum *enum_type, const char *name, int value) DECLSPEC_HIDDEN
Definition: type.c:319
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static PVOID ptr
Definition: dispmode.c:27
static UINT UINT last
Definition: font.c:45
static const char * terminate_string(const struct p_string *p_name)
Definition: msc.c:503
static int numeric_leaf(int *value, const unsigned short int *leaf)
Definition: msc.c:385
#define LF_ENUMERATE_V1
Definition: mscvpdb.h:1172
#define LF_ENUMERATE_V3
Definition: mscvpdb.h:1201
unsigned char namelen
Definition: mscvpdb.h:109
unsigned short int value
Definition: mscvpdb.h:476
Definition: pdh_main.c:94
unsigned char BYTE
Definition: xxhash.c:193

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 651 of file msc.c.

654{
655 struct symt* pointee;
656
657 if (existing)
658 {
659 existing = codeview_cast_symt(existing, SymTagPointerType);
660 return existing;
661 }
662 pointee = codeview_fetch_type(ctp, pointee_type, FALSE);
663 return &symt_new_pointer(ctp->module, pointee, sizeof(void *))->symt;
664}
struct symt_pointer * symt_new_pointer(struct module *module, struct symt *ref_type, ULONG_PTR size) DECLSPEC_HIDDEN
Definition: type.c:414
@ SymTagPointerType
Definition: compat.h:1595

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 1010 of file msc.c.

1014{
1015 struct symt_udt* symt;
1016
1017 /* if we don't have an existing type, try to find one with same name
1018 * FIXME: what to do when several types in different CUs have same name ?
1019 */
1020 if (!existing)
1021 {
1022 void* ptr;
1023 struct symt_ht* type;
1024 struct hash_table_iter hti;
1025
1026 hash_table_iter_init(&ctp->module->ht_types, &hti, name);
1027 while ((ptr = hash_table_iter_up(&hti)))
1028 {
1029 type = CONTAINING_RECORD(ptr, struct symt_ht, hash_elt);
1030
1031 if (type->symt.tag == SymTagUDT &&
1032 type->hash_elt.name && !strcmp(type->hash_elt.name, name))
1033 {
1034 existing = &type->symt;
1035 break;
1036 }
1037 }
1038 }
1039 if (existing)
1040 {
1041 if (!(symt = codeview_cast_symt(existing, SymTagUDT))) return NULL;
1042 /* should also check that all fields are the same */
1043 if (!(property & 0x80)) /* 0x80 = forward declaration */
1044 {
1045 if (!symt->size) /* likely prior forward declaration, set UDT size */
1046 symt_set_udt_size(ctp->module, symt, structlen);
1047 else /* different UDT with same name, create a new type */
1048 existing = NULL;
1049 }
1050 }
1051 if (!existing) symt = symt_new_udt(ctp->module, name, structlen, kind);
1052
1053 return &symt->symt;
1054}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
struct symt_udt * symt_new_udt(struct module *module, const char *typename, unsigned size, enum UdtKind kind) DECLSPEC_HIDDEN
Definition: type.c:219
void hash_table_iter_init(const struct hash_table *ht, struct hash_table_iter *hti, const char *name) DECLSPEC_HIDDEN
Definition: storage.c:405
BOOL symt_set_udt_size(struct module *module, struct symt_udt *type, unsigned size) DECLSPEC_HIDDEN
Definition: type.c:242
void * hash_table_iter_up(struct hash_table_iter *hti) DECLSPEC_HIDDEN
Definition: storage.c:422
@ SymTagUDT
Definition: compat.h:1592
struct symt symt
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

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 761 of file msc.c.

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

Referenced by codeview_add_type_struct_field_list(), and 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 725 of file msc.c.

728{
729 struct symt* subtype;
730 const union codeview_reftype*cv_type;
731
732 if ((cv_type = codeview_jump_to_type(ctp, type)))
733 {
734 switch (cv_type->generic.id)
735 {
736 case LF_BITFIELD_V1:
738 codeview_fetch_type(ctp, cv_type->bitfield_v1.type, FALSE),
739 (value << 3) + cv_type->bitfield_v1.bitoff,
740 cv_type->bitfield_v1.nbits);
741 return;
742 case LF_BITFIELD_V2:
744 codeview_fetch_type(ctp, cv_type->bitfield_v2.type, FALSE),
745 (value << 3) + cv_type->bitfield_v2.bitoff,
746 cv_type->bitfield_v2.nbits);
747 return;
748 }
749 }
750 subtype = codeview_fetch_type(ctp, type, FALSE);
751
752 if (subtype)
753 {
754 DWORD64 elem_size = 0;
755 symt_get_info(ctp->module, subtype, TI_GET_LENGTH, &elem_size);
756 symt_add_udt_element(ctp->module, symt, name, subtype,
757 value << 3, (DWORD)elem_size << 3);
758 }
759}
BOOL symt_get_info(struct module *module, const struct symt *type, IMAGEHLP_SYMBOL_TYPE_INFO req, void *pInfo) DECLSPEC_HIDDEN
Definition: type.c:536
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:264
@ TI_GET_LENGTH
Definition: compat.h:1417
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LF_BITFIELD_V1
Definition: mscvpdb.h:1148
#define LF_BITFIELD_V2
Definition: mscvpdb.h:1161
uint64_t DWORD64
Definition: typedefs.h:67
struct codeview_reftype::@3589 bitfield_v2
struct codeview_reftype::@3588 bitfield_v1

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 1562 of file msc.c.

1567{
1568 if (name && *name)
1569 {
1570 struct location loc;
1571
1572 loc.kind = in_tls ? loc_tlsrel : loc_absolute;
1573 loc.reg = 0;
1574 loc.offset = in_tls ? offset : codeview_get_address(msc_dbg, segment, offset);
1575 if (force || in_tls || !symt_find_nearest(msc_dbg->module, loc.offset))
1576 {
1577 symt_new_global_variable(msc_dbg->module, compiland,
1578 name, is_local, loc, 0,
1579 codeview_get_type(symtype, FALSE));
1580 }
1581 }
1582}
struct symt_data * symt_new_global_variable(struct module *module, struct symt_compiland *parent, const char *name, unsigned is_static, struct location loc, ULONG_PTR size, struct symt *type) DECLSPEC_HIDDEN
Definition: symbol.c:256
@ loc_absolute
@ loc_tlsrel
struct symt_ht * symt_find_nearest(struct module *module, DWORD_PTR addr) DECLSPEC_HIDDEN
Definition: symbol.c:903
GLintptr offset
Definition: glext.h:5920
static struct symt * codeview_get_type(unsigned int typeno, BOOL quiet)
Definition: msc.c:513
static ULONG_PTR codeview_get_address(const struct msc_debug_info *msc_dbg, unsigned seg, unsigned offset)
Definition: msc.c:1551
int is_local(const attr_list_t *a)
Definition: header.c:938
unsigned kind
struct module * module
Definition: mscvpdb.h:2134

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 621 of file msc.c.

622{
623 if (symt->tag != tag)
624 {
625 FIXME("Bad tag. Expected %d, but got %d\n", tag, symt->tag);
626 return NULL;
627 }
628 return symt;
629}
enum SymTagEnum tag
Definition: ecma_167.h:138

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 602 of file msc.c.

603{
604 int i;
605
606 for (i = 0; i < CV_MAX_MODULES; i++)
607 {
608 if (cv_zmodules[i].allowed)
609 HeapFree(GetProcessHeap(), 0, cv_zmodules[i].defined_types);
610 cv_zmodules[i].allowed = FALSE;
611 cv_zmodules[i].defined_types = NULL;
612 cv_zmodules[i].num_defined_types = 0;
613 }
615}
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CV_MAX_MODULES
Definition: msc.c:136
static struct cv_defined_module cv_zmodules[CV_MAX_MODULES]
Definition: msc.c:137

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 631 of file msc.c.

633{
634 struct symt* symt;
635 const union codeview_type* p;
636
637 if (!typeno) return NULL;
638 if ((symt = codeview_get_type(typeno, TRUE))) return symt;
639
640 /* forward declaration */
641 if (!(p = codeview_jump_to_type(ctp, typeno)))
642 {
643 FIXME("Cannot locate type %x\n", typeno);
644 return NULL;
645 }
646 symt = codeview_parse_one_type(ctp, typeno, p, details);
647 if (!symt) FIXME("Couldn't load forward type %x\n", typeno);
648 return symt;
649}
GLfloat GLfloat p
Definition: glext.h:8902
int details
Definition: msacm.c:1366
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:1103

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 ULONG_PTR codeview_get_address ( const struct msc_debug_info msc_dbg,
unsigned  seg,
unsigned  offset 
)
static

Definition at line 1551 of file msc.c.

1553{
1554 int nsect = msc_dbg->nsect;
1555 const IMAGE_SECTION_HEADER* sectp = msc_dbg->sectp;
1556
1557 if (!seg || seg > nsect) return 0;
1558 return msc_dbg->module->module.BaseOfImage +
1559 codeview_map_offset(msc_dbg, sectp[seg-1].VirtualAddress + offset);
1560}
static unsigned int codeview_map_offset(const struct msc_debug_info *msc_dbg, unsigned int offset)
Definition: msc.c:1534
const IMAGE_SECTION_HEADER * sectp
Definition: mscvpdb.h:2136
_Must_inspect_result_ _In_ WDFDMATRANSACTION _In_ PFN_WDF_PROGRAM_DMA _In_ WDF_DMA_DIRECTION _In_ PMDL _In_ PVOID VirtualAddress

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 513 of file msc.c.

514{
515 struct symt* symt = NULL;
516
517 /*
518 * Convert Codeview type numbers into something we can grok internally.
519 * Numbers < FIRST_DEFINABLE_TYPE are all fixed builtin types.
520 * Numbers from FIRST_DEFINABLE_TYPE and up are all user defined (structs, etc).
521 */
522 if (typeno < FIRST_DEFINABLE_TYPE)
523 {
524 if (typeno < MAX_BUILTIN_TYPES)
525 symt = cv_basic_types[typeno];
526 }
527 else
528 {
529 unsigned mod_index = typeno >> 24;
530 unsigned mod_typeno = typeno & 0x00FFFFFF;
531 struct cv_defined_module* mod;
532
533 mod = (mod_index == 0) ? cv_current_module : &cv_zmodules[mod_index];
534
535 if (mod_index >= CV_MAX_MODULES || !mod->allowed)
536 FIXME("Module of index %d isn't loaded yet (%x)\n", mod_index, typeno);
537 else
538 {
539 if (mod_typeno - FIRST_DEFINABLE_TYPE < mod->num_defined_types)
540 symt = mod->defined_types[mod_typeno - FIRST_DEFINABLE_TYPE];
541 }
542 }
543 if (!quiet && !symt && typeno) FIXME("Returning NULL symt for type-id %x\n", typeno);
544 return symt;
545}
static int mod
Definition: i386-dis.c:1288
#define MAX_BUILTIN_TYPES
Definition: msc.c:124
static struct symt * cv_basic_types[MAX_BUILTIN_TYPES]
Definition: msc.c:127
unsigned int num_defined_types
Definition: msc.c:132
static int quiet
Definition: xmllint.c:162

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 140 of file msc.c.

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

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 555 of file msc.c.

556{
557 if (idx < FIRST_DEFINABLE_TYPE) return NULL;
559 return (idx >= ctp->num) ? NULL : (ctp->table + ctp->offset[idx]);
560}
unsigned int idx
Definition: utils.c:41
const BYTE * table
Definition: msc.c:550
const DWORD * offset
Definition: msc.c:551

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 1534 of file msc.c.

1536{
1537 int nomap = msc_dbg->nomap;
1538 const OMAP_DATA* omapp = msc_dbg->omapp;
1539 int i;
1540
1541 if (!nomap || !omapp) return offset;
1542
1543 /* FIXME: use binary search */
1544 for (i = 0; i < nomap - 1; i++)
1545 if (omapp[i].from <= offset && omapp[i+1].from > offset)
1546 return !omapp[i].to ? 0 : omapp[i].to + (offset - omapp[i].from);
1547
1548 return 0;
1549}
CardRegion * from
Definition: spigame.cpp:19
DWORD from
Definition: mscvpdb.h:2128
DWORD to
Definition: mscvpdb.h:2129
const OMAP_DATA * omapp
Definition: mscvpdb.h:2138

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 1056 of file msc.c.

1059{
1060 struct symt_function_signature* sym;
1061
1062 if (existing)
1063 {
1064 sym = codeview_cast_symt(existing, SymTagFunctionType);
1065 if (!sym) return NULL;
1066 }
1067 else
1068 {
1070 }
1071 return &sym->symt;
1072}
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:377
@ SymTagFunctionType
Definition: compat.h:1594

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 1103 of file msc.c.

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

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 1359 of file msc.c.

1360{
1361 unsigned int curr_type = FIRST_DEFINABLE_TYPE;
1362 const union codeview_type* type;
1363
1364 for (curr_type = FIRST_DEFINABLE_TYPE; curr_type < FIRST_DEFINABLE_TYPE + ctp->num; curr_type++)
1365 {
1366 type = codeview_jump_to_type(ctp, curr_type);
1367
1368 /* type records we're interested in are the ones referenced by symbols
1369 * The known ranges are (X mark the ones we want):
1370 * X 0000-0016 for V1 types
1371 * 0200-020c for V1 types referenced by other types
1372 * 0400-040f for V1 types (complex lists & sets)
1373 * X 1000-100f for V2 types
1374 * 1200-120c for V2 types referenced by other types
1375 * 1400-140f for V1 types (complex lists & sets)
1376 * X 1500-150d for V3 types
1377 * 8000-8010 for numeric leafes
1378 */
1379 if (!(type->generic.id & 0x8600) || (type->generic.id & 0x0100))
1380 codeview_parse_one_type(ctp, curr_type, type, TRUE);
1381 }
1382
1383 return TRUE;
1384}

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 3262 of file msc.c.

3264{
3265 const DWORD* signature = (const DWORD*)msc_dbg->root;
3266 BOOL ret = FALSE;
3267 struct pdb_lookup pdb_lookup;
3268
3269 TRACE("Processing signature %.4s\n", (const char*)signature);
3270
3271 switch (*signature)
3272 {
3273 case CODEVIEW_NB09_SIG:
3274 case CODEVIEW_NB11_SIG:
3275 {
3276 const OMFSignature* cv = (const OMFSignature*)msc_dbg->root;
3277 const OMFDirHeader* hdr = (const OMFDirHeader*)(msc_dbg->root + cv->filepos);
3278 const OMFDirEntry* ent;
3279 const OMFDirEntry* prev;
3280 const OMFDirEntry* next;
3281 unsigned int i;
3282
3284
3285 for (i = 0; i < hdr->cDir; i++)
3286 {
3287 ent = (const OMFDirEntry*)((const BYTE*)hdr + hdr->cbDirHeader + i * hdr->cbDirEntry);
3288 if (ent->SubSection == sstGlobalTypes)
3289 {
3290 const OMFGlobalTypes* types;
3291 struct codeview_type_parse ctp;
3292
3293 types = (const OMFGlobalTypes*)(msc_dbg->root + ent->lfo);
3294 ctp.module = msc_dbg->module;
3295 ctp.offset = (const DWORD*)(types + 1);
3296 ctp.num = types->cTypes;
3297 ctp.table = (const BYTE*)(ctp.offset + types->cTypes);
3298
3300 if (cv_current_module->allowed) FIXME("Already allowed??\n");
3301 cv_current_module->allowed = TRUE;
3302
3304 break;
3305 }
3306 }
3307
3308 ent = (const OMFDirEntry*)((const BYTE*)hdr + hdr->cbDirHeader);
3309 for (i = 0; i < hdr->cDir; i++, ent = next)
3310 {
3311 next = (i == hdr->cDir-1) ? NULL :
3312 (const OMFDirEntry*)((const BYTE*)ent + hdr->cbDirEntry);
3313 prev = (i == 0) ? NULL :
3314 (const OMFDirEntry*)((const BYTE*)ent - hdr->cbDirEntry);
3315
3316 if (ent->SubSection == sstAlignSym)
3317 {
3318 codeview_snarf(msc_dbg, msc_dbg->root + ent->lfo, sizeof(DWORD),
3319 ent->cb, TRUE);
3320
3321 /*
3322 * Check the next and previous entry. If either is a
3323 * sstSrcModule, it contains the line number info for
3324 * this file.
3325 *
3326 * FIXME: This is not a general solution!
3327 */
3328 if (next && next->iMod == ent->iMod && next->SubSection == sstSrcModule)
3329 codeview_snarf_linetab(msc_dbg, msc_dbg->root + next->lfo,
3330 next->cb, TRUE);
3331
3332 if (prev && prev->iMod == ent->iMod && prev->SubSection == sstSrcModule)
3333 codeview_snarf_linetab(msc_dbg, msc_dbg->root + prev->lfo,
3334 prev->cb, TRUE);
3335
3336 }
3337 }
3338
3339 msc_dbg->module->module.SymType = SymCv;
3340 /* FIXME: we could have a finer grain here */
3341 msc_dbg->module->module.LineNumbers = TRUE;
3342 msc_dbg->module->module.GlobalSymbols = TRUE;
3343 msc_dbg->module->module.TypeInfo = TRUE;
3344 msc_dbg->module->module.SourceIndexed = TRUE;
3345 msc_dbg->module->module.Publics = TRUE;
3347 ret = TRUE;
3348 break;
3349 }
3350
3351 case CODEVIEW_NB10_SIG:
3352 {
3353 const CODEVIEW_PDB_DATA* pdb = (const CODEVIEW_PDB_DATA*)msc_dbg->root;
3354 pdb_lookup.filename = pdb->name;
3356 pdb_lookup.timestamp = pdb->timestamp;
3357 pdb_lookup.age = pdb->age;
3358 ret = pdb_process_file(pcs, msc_dbg, &pdb_lookup);
3359 break;
3360 }
3361 case CODEVIEW_RSDS_SIG:
3362 {
3363 const OMFSignatureRSDS* rsds = (const OMFSignatureRSDS*)msc_dbg->root;
3364
3365 TRACE("Got RSDS type of PDB file: guid=%s age=%08x name=%s\n",
3366 wine_dbgstr_guid(&rsds->guid), rsds->age, rsds->name);
3367 pdb_lookup.filename = rsds->name;
3369 pdb_lookup.guid = rsds->guid;
3370 pdb_lookup.age = rsds->age;
3371 ret = pdb_process_file(pcs, msc_dbg, &pdb_lookup);
3372 break;
3373 }
3374 default:
3375 ERR("Unknown CODEVIEW signature %08x in module %s\n",
3376 *signature, debugstr_w(msc_dbg->module->module.ModuleName));
3377 break;
3378 }
3379 if (ret)
3380 {
3381 msc_dbg->module->module.CVSig = *signature;
3382 memcpy(msc_dbg->module->module.CVData, msc_dbg->root,
3383 sizeof(msc_dbg->module->module.CVData));
3384 }
3385 return ret;
3386}
#define ERR(fmt,...)
Definition: debug.h:110
static PDB pdb
Definition: db.cpp:172
@ PDB_DS
@ PDB_JG
@ SymCv
Definition: compat.h:1058
unsigned int BOOL
Definition: ntddk_ex.h:94
char hdr[14]
Definition: iptest.cpp:33
#define debugstr_w
Definition: kernel32.h:32
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define CODEVIEW_NB09_SIG
Definition: msc.c:3257
static void codeview_init_basic_types(struct module *module)
Definition: msc.c:140
#define CODEVIEW_NB10_SIG
Definition: msc.c:3258
#define CODEVIEW_NB11_SIG
Definition: msc.c:3259
#define CODEVIEW_RSDS_SIG
Definition: msc.c:3260
static BOOL pdb_process_file(const struct process *pcs, const struct msc_debug_info *msc_dbg, struct pdb_lookup *pdb_lookup)
Definition: msc.c:2862
static BOOL codeview_snarf(const struct msc_debug_info *msc_dbg, const BYTE *root, int offset, int size, BOOL do_globals)
Definition: msc.c:1584
static void codeview_clear_type_table(void)
Definition: msc.c:602
static BOOL codeview_parse_type_table(struct codeview_type_parse *ctp)
Definition: msc.c:1359
static void codeview_snarf_linetab(const struct msc_debug_info *msc_dbg, const BYTE *linetab, int size, BOOL pascal_str)
Definition: msc.c:1392
static unsigned __int64 next
Definition: rand_nt.c:6
#define sstGlobalTypes
Definition: mscvpdb.h:2160
#define sstSrcModule
Definition: mscvpdb.h:2156
#define sstAlignSym
Definition: mscvpdb.h:2154
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
#define TRACE(s)
Definition: solgame.cpp:4
WORD SubSection
Definition: mscvpdb.h:2203
DWORD lfo
Definition: mscvpdb.h:2205
DWORD cb
Definition: mscvpdb.h:2206
WORD iMod
Definition: mscvpdb.h:2204
CHAR name[1]
Definition: mscvpdb.h:2180
long filepos
Definition: mscvpdb.h:2172
const BYTE * root
Definition: mscvpdb.h:2139
const char * filename
enum pdb_kind kind
Definition: cmds.c:130
int ret

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 1584 of file msc.c.

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

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 1392 of file msc.c.

1394{
1395 const BYTE* ptr = linetab;
1396 int nfile, nseg;
1397 int i, j;
1398 unsigned int k;
1399 const unsigned int* filetab;
1400 const unsigned int* lt_ptr;
1401 const unsigned short* linenos;
1402 const struct startend* start;
1403 unsigned source;
1404 ULONG_PTR addr, func_addr0;
1405 struct symt_function* func;
1406 const struct codeview_linetab_block* ltb;
1407
1408 nfile = *(const short*)linetab;
1409 filetab = (const unsigned int*)(linetab + 2 * sizeof(short));
1410
1411 for (i = 0; i < nfile; i++)
1412 {
1413 ptr = linetab + filetab[i];
1414 nseg = *(const short*)ptr;
1415 lt_ptr = (const unsigned int*)(ptr + 2 * sizeof(short));
1416 start = (const struct startend*)(lt_ptr + nseg);
1417
1418 /*
1419 * Now snarf the filename for all of the segments for this file.
1420 */
1421 if (pascal_str)
1422 source = source_new(msc_dbg->module, NULL, terminate_string((const struct p_string*)(start + nseg)));
1423 else
1424 source = source_new(msc_dbg->module, NULL, (const char*)(start + nseg));
1425
1426 for (j = 0; j < nseg; j++)
1427 {
1428 ltb = (const struct codeview_linetab_block*)(linetab + *lt_ptr++);
1429 linenos = (const unsigned short*)&ltb->offsets[ltb->num_lines];
1430 func_addr0 = codeview_get_address(msc_dbg, ltb->seg, start[j].start);
1431 if (!func_addr0) continue;
1432 for (func = NULL, k = 0; k < ltb->num_lines; k++)
1433 {
1434 /* now locate function (if any) */
1435 addr = func_addr0 + ltb->offsets[k] - start[j].start;
1436 /* unfortunately, we can have several functions in the same block, if there's no
1437 * gap between them... find the new function if needed
1438 */
1439 if (!func || addr >= func->address + func->size)
1440 {
1441 func = (struct symt_function*)symt_find_nearest(msc_dbg->module, addr);
1442 /* FIXME: at least labels support line numbers */
1443 if (!func || func->symt.tag != SymTagFunction)
1444 {
1445 WARN("--not a func at %04x:%08x %lx tag=%d\n",
1446 ltb->seg, ltb->offsets[k], addr, func ? func->symt.tag : -1);
1447 func = NULL;
1448 break;
1449 }
1450 }
1452 linenos[k], addr - func->address);
1453 }
1454 }
1455 }
1456}
void symt_add_func_line(struct module *module, struct symt_function *func, unsigned source_idx, int line_num, ULONG_PTR offset) DECLSPEC_HIDDEN
Definition: symbol.c:326
@ SymTagFunction
Definition: compat.h:1586
GLuint start
Definition: gl.h:1545
GLenum func
Definition: glext.h:6028
GLenum const GLvoid * addr
Definition: glext.h:9621
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
int k
Definition: mpi.c:3369
unsigned short seg
Definition: mscvpdb.h:1820
unsigned int offsets[1]
Definition: mscvpdb.h:1822
unsigned short num_lines
Definition: mscvpdb.h:1821
uint32_t ULONG_PTR
Definition: typedefs.h:65

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 1458 of file msc.c.

1460{
1461 unsigned i;
1463 const struct codeview_linetab2* lt2;
1464 const struct codeview_linetab2* lt2_files = NULL;
1465 const struct codeview_lt2blk_lines* lines_blk;
1466 const struct codeview_linetab2_file*fd;
1467 unsigned source;
1468 struct symt_function* func;
1469
1470 /* locate LT2_FILES_BLOCK (if any) */
1471 lt2 = (const struct codeview_linetab2*)linetab;
1472 while ((const BYTE*)(lt2 + 1) < linetab + size)
1473 {
1474 if (lt2->header == LT2_FILES_BLOCK)
1475 {
1476 lt2_files = lt2;
1477 break;
1478 }
1480 }
1481 if (!lt2_files)
1482 {
1483 TRACE("No LT2_FILES_BLOCK found\n");
1484 return;
1485 }
1486
1487 lt2 = (const struct codeview_linetab2*)linetab;
1488 while ((const BYTE*)(lt2 + 1) < linetab + size)
1489 {
1490 /* FIXME: should also check that whole lines_blk fits in linetab + size */
1491 switch (lt2->header)
1492 {
1493 case LT2_LINES_BLOCK:
1494 /* Skip blocks that are too small - Intel C Compiler generates these. */
1495 if (lt2->size_of_block < sizeof (struct codeview_lt2blk_lines)) break;
1496 lines_blk = (const struct codeview_lt2blk_lines*)lt2;
1497 /* FIXME: should check that file_offset is within the LT2_FILES_BLOCK we've seen */
1498 addr = codeview_get_address(msc_dbg, lines_blk->seg, lines_blk->start);
1499 TRACE("block from %04x:%08x #%x (%x lines)\n",
1500 lines_blk->seg, lines_blk->start, lines_blk->size, lines_blk->nlines);
1501 fd = (const struct codeview_linetab2_file*)((const char*)lt2_files + 8 + lines_blk->file_offset);
1502 /* FIXME: should check that string is within strimage + strsize */
1503 source = source_new(msc_dbg->module, NULL, strimage + fd->offset);
1504 func = (struct symt_function*)symt_find_nearest(msc_dbg->module, addr);
1505 /* FIXME: at least labels support line numbers */
1506 if (!func || func->symt.tag != SymTagFunction)
1507 {
1508 WARN("--not a func at %04x:%08x %lx tag=%d\n",
1509 lines_blk->seg, lines_blk->start, addr, func ? func->symt.tag : -1);
1510 break;
1511 }
1512 for (i = 0; i < lines_blk->nlines; i++)
1513 {
1515 lines_blk->l[i].lineno ^ 0x80000000,
1516 lines_blk->l[i].offset);
1517 }
1518 break;
1519 case LT2_FILES_BLOCK: /* skip */
1520 break;
1521 default:
1522 TRACE("Block end %x\n", lt2->header);
1523 lt2 = (const struct codeview_linetab2*)((const char*)linetab + size);
1524 continue;
1525 }
1527 }
1528}
static const struct codeview_linetab2 * codeview_linetab2_next_block(const struct codeview_linetab2 *lt2)
Definition: mscvpdb.h:1849
#define LT2_LINES_BLOCK
Definition: mscvpdb.h:1832
#define LT2_FILES_BLOCK
Definition: mscvpdb.h:1833
static int fd
Definition: io.c:51
DWORD size_of_block
Definition: mscvpdb.h:1846
struct codeview_linetab2 lt2
Definition: mscvpdb.h:1870
struct codeview_lt2blk_lines::@3672 l[1]
uint32_t DWORD_PTR
Definition: typedefs.h:65
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

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 2047 of file msc.c.

2050{
2051 int i, length;
2052 struct symt_compiland* compiland = NULL;
2053
2054 /*
2055 * Loop over the different types of records and whenever we
2056 * find something we are interested in, record it and move on.
2057 */
2058 for (i = offset; i < size; i += length)
2059 {
2060 const union codeview_symbol* sym = (const union codeview_symbol*)(root + i);
2061 length = sym->generic.len + 2;
2062 if (i + length > size) break;
2063 if (!sym->generic.id || length < 4) break;
2064 if (length & 3) FIXME("unpadded len %u\n", length);
2065
2066 switch (sym->generic.id)
2067 {
2068 case S_PUB_V1:
2070 {
2071 symt_new_public(msc_dbg->module, compiland,
2072 terminate_string(&sym->public_v1.p_name),
2073 sym->public_v1.symtype == SYMTYPE_FUNCTION,
2074 codeview_get_address(msc_dbg, sym->public_v1.segment, sym->public_v1.offset), 1);
2075 }
2076 break;
2077 case S_PUB_V2:
2079 {
2080 symt_new_public(msc_dbg->module, compiland,
2081 terminate_string(&sym->public_v2.p_name),
2082 sym->public_v2.symtype == SYMTYPE_FUNCTION,
2083 codeview_get_address(msc_dbg, sym->public_v2.segment, sym->public_v2.offset), 1);
2084 }
2085 break;
2086
2087 case S_PUB_V3:
2089 {
2090 symt_new_public(msc_dbg->module, compiland,
2091 sym->public_v3.name,
2092 sym->public_v3.symtype == SYMTYPE_FUNCTION,
2093 codeview_get_address(msc_dbg, sym->public_v3.segment, sym->public_v3.offset), 1);
2094 }
2095 break;
2096 case S_PUB_FUNC1_V3:
2097 case S_PUB_FUNC2_V3: /* using a data_v3 isn't what we'd expect */
2098#if 0
2099 /* FIXME: this is plain wrong (from a simple test) */
2101 {
2102 symt_new_public(msc_dbg->module, compiland,
2103 sym->data_v3.name,
2104 codeview_get_address(msc_dbg, sym->data_v3.segment, sym->data_v3.offset), 1);
2105 }
2106#endif
2107 break;
2108 /*
2109 * Global and local data symbols. We don't associate these
2110 * with any given source file.
2111 */
2112 case S_GDATA_V1:
2113 case S_LDATA_V1:
2114 codeview_add_variable(msc_dbg, compiland, terminate_string(&sym->data_v1.p_name),
2115 sym->data_v1.segment, sym->data_v1.offset, sym->data_v1.symtype,
2116 sym->generic.id == S_LDATA_V1, FALSE, FALSE);
2117 break;
2118 case S_GDATA_V2:
2119 case S_LDATA_V2:
2120 codeview_add_variable(msc_dbg, compiland, terminate_string(&sym->data_v2.p_name),
2121 sym->data_v2.segment, sym->data_v2.offset, sym->data_v2.symtype,
2122 sym->generic.id == S_LDATA_V2, FALSE, FALSE);
2123 break;
2124 case S_GDATA_V3:
2125 case S_LDATA_V3:
2126 codeview_add_variable(msc_dbg, compiland, sym->data_v3.name,
2127 sym->data_v3.segment, sym->data_v3.offset, sym->data_v3.symtype,
2128 sym->generic.id == S_LDATA_V3, FALSE, FALSE);
2129 break;
2130
2131 /* variables with thread storage */
2132 case S_GTHREAD_V1:
2133 case S_LTHREAD_V1:
2134 codeview_add_variable(msc_dbg, compiland, terminate_string(&sym->thread_v1.p_name),
2135 sym->thread_v1.segment, sym->thread_v1.offset, sym->thread_v1.symtype,
2136 sym->generic.id == S_LTHREAD_V1, TRUE, FALSE);
2137 break;
2138 case S_GTHREAD_V2:
2139 case S_LTHREAD_V2:
2140 codeview_add_variable(msc_dbg, compiland, terminate_string(&sym->thread_v2.p_name),
2141 sym->thread_v2.segment, sym->thread_v2.offset, sym->thread_v2.symtype,
2142 sym->generic.id == S_LTHREAD_V2, TRUE, FALSE);
2143 break;
2144 case S_GTHREAD_V3:
2145 case S_LTHREAD_V3:
2146 codeview_add_variable(msc_dbg, compiland, sym->thread_v3.name,
2147 sym->thread_v3.segment, sym->thread_v3.offset, sym->thread_v3.symtype,
2148 sym->generic.id == S_LTHREAD_V3, TRUE, FALSE);
2149 break;
2150
2151 /*
2152 * These are special, in that they are always followed by an
2153 * additional length-prefixed string which is *not* included
2154 * into the symbol length count. We need to skip it.
2155 */
2156 case S_PROCREF_V1:
2157 case S_DATAREF_V1:
2158 case S_LPROCREF_V1:
2159 length += (((const char*)sym)[length] + 1 + 3) & ~3;
2160 break;
2161 }
2162 msc_dbg->module->sortlist_valid = TRUE;
2163 }
2164 msc_dbg->module->sortlist_valid = FALSE;
2165 return TRUE;
2166}
struct symt_public * symt_new_public(struct module *module, struct symt_compiland *parent, const char *typename, BOOL is_function, ULONG_PTR address, unsigned size) DECLSPEC_HIDDEN
Definition: symbol.c:224
#define SYMOPT_NO_PUBLICS
Definition: compat.h:993
unsigned dbghelp_options
Definition: dbghelp.c:73
#define SYMTYPE_FUNCTION
Definition: mscvpdb.h:1235
struct codeview_symbol::@3643 public_v3
struct codeview_symbol::@3641 public_v1
struct codeview_symbol::@3642 public_v2

Referenced by pdb_process_internal().

◆ dump()

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

Definition at line 95 of file msc.c.

96{
97 unsigned int i, j;
98 char msg[128];
99 const char* hexof = "0123456789abcdef";
100 const BYTE* x = ptr;
101
102 for (i = 0; i < len; i += 16)
103 {
104 sprintf(msg, "%08x: ", i);
105 memset(msg + 10, ' ', 3 * 16 + 1 + 16);
106 for (j = 0; j < min(16, len - i); j++)
107 {
108 msg[10 + 3 * j + 0] = hexof[x[i + j] >> 4];
109 msg[10 + 3 * j + 1] = hexof[x[i + j] & 15];
110 msg[10 + 3 * j + 2] = ' ';
111 msg[10 + 3 * 16 + 1 + j] = (x[i + j] >= 0x20 && x[i + j] < 0x7f) ?
112 x[i + j] : '.';
113 }
114 msg[10 + 3 * 16] = ' ';
115 msg[10 + 3 * 16 + 1 + 16] = '\0';
116 FIXME("%s\n", msg);
117 }
118}
#define msg(x)
Definition: auth_time.c:54
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLenum GLsizei len
Definition: glext.h:6722
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define min(a, b)
Definition: monoChain.cc:55
#define memset(x, y, z)
Definition: compat.h:39

Referenced by codeview_parse_one_type(), codeview_snarf(), DumpCommand(), 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 259 of file msc.c.

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

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 2443 of file msc.c.

2446{
2447 HANDLE hFile, hMap = NULL;
2448 WCHAR dbg_file_path[MAX_PATH];
2449 BOOL ret = FALSE;
2450
2451 switch (lookup->kind)
2452 {
2453 case PDB_JG:
2454 ret = path_find_symbol_file(pcs, module, lookup->filename, DMT_PDB, NULL, lookup->timestamp,
2455 lookup->age, dbg_file_path, &module->module.PdbUnmatched);
2456 break;
2457 case PDB_DS:
2458 ret = path_find_symbol_file(pcs, module, lookup->filename, DMT_PDB, &lookup->guid, 0,
2459 lookup->age, dbg_file_path, &module->module.PdbUnmatched);
2460 break;
2461 }
2462 if (!ret)
2463 {
2464 WARN("\tCouldn't find %s\n", lookup->filename);
2465 return NULL;
2466 }
2467 if ((hFile = CreateFileW(dbg_file_path, GENERIC_READ, FILE_SHARE_READ, NULL,
2469 {
2472 }
2473 return hMap;
2474}
BOOL path_find_symbol_file(const struct process *pcs, const struct module *module, PCSTR full_path, enum module_type type, const GUID *guid, DWORD dw1, DWORD dw2, WCHAR *buffer, BOOL *is_unmatched) DECLSPEC_HIDDEN
Definition: path.c:596
@ DMT_PDB
#define CloseHandle
Definition: compat.h:739
#define PAGE_READONLY
Definition: compat.h:138
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:744
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define FILE_SHARE_READ
Definition: compat.h:136
static ULONG lookup[16]
Definition: vga.c:48
_In_ HANDLE hFile
Definition: mswsock.h:90
IMAGEHLP_MODULEW64 module
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by pdb_process_internal().

◆ numeric_leaf()

static int numeric_leaf ( int value,
const unsigned short int leaf 
)
static

Definition at line 385 of file msc.c.

386{
387 unsigned short int type = *leaf++;
388 int length = 2;
389
390 if (type < LF_NUMERIC)
391 {
392 *value = type;
393 }
394 else
395 {
396 switch (type)
397 {
398 case LF_CHAR:
399 length += 1;
400 *value = *(const char*)leaf;
401 break;
402
403 case LF_SHORT:
404 length += 2;
405 *value = *(const short*)leaf;
406 break;
407
408 case LF_USHORT:
409 length += 2;
410 *value = *leaf;
411 break;
412
413 case LF_LONG:
414 length += 4;
415 *value = *(const int*)leaf;
416 break;
417
418 case LF_ULONG:
419 length += 4;
420 *value = *(const unsigned int*)leaf;
421 break;
422
423 case LF_QUADWORD:
424 case LF_UQUADWORD:
425 FIXME("Unsupported numeric leaf type %04x\n", type);
426 length += 8;
427 *value = 0; /* FIXME */
428 break;
429
430 case LF_REAL32:
431 FIXME("Unsupported numeric leaf type %04x\n", type);
432 length += 4;
433 *value = 0; /* FIXME */
434 break;
435
436 case LF_REAL48:
437 FIXME("Unsupported numeric leaf type %04x\n", type);
438 length += 6;
439 *value = 0; /* FIXME */
440 break;
441
442 case LF_REAL64:
443 FIXME("Unsupported numeric leaf type %04x\n", type);
444 length += 8;
445 *value = 0; /* FIXME */
446 break;
447
448 case LF_REAL80:
449 FIXME("Unsupported numeric leaf type %04x\n", type);
450 length += 10;
451 *value = 0; /* FIXME */
452 break;
453
454 case LF_REAL128:
455 FIXME("Unsupported numeric leaf type %04x\n", type);
456 length += 16;
457 *value = 0; /* FIXME */
458 break;
459
460 case LF_COMPLEX32:
461 FIXME("Unsupported numeric leaf type %04x\n", type);
462 length += 4;
463 *value = 0; /* FIXME */
464 break;
465
466 case LF_COMPLEX64:
467 FIXME("Unsupported numeric leaf type %04x\n", type);
468 length += 8;
469 *value = 0; /* FIXME */
470 break;
471
472 case LF_COMPLEX80:
473 FIXME("Unsupported numeric leaf type %04x\n", type);
474 length += 10;
475 *value = 0; /* FIXME */
476 break;
477
478 case LF_COMPLEX128:
479 FIXME("Unsupported numeric leaf type %04x\n", type);
480 length += 16;
481 *value = 0; /* FIXME */
482 break;
483
484 case LF_VARSTRING:
485 FIXME("Unsupported numeric leaf type %04x\n", type);
486 length += 2 + *leaf;
487 *value = 0; /* FIXME */
488 break;
489
490 default:
491 FIXME("Unknown numeric leaf type %04x\n", type);
492 *value = 0;
493 break;
494 }
495 }
496
497 return length;
498}

Referenced by codeview_add_type_enum_field_list(), codeview_add_type_struct_field_list(), and codeview_parse_one_type().

◆ pdb_convert_symbol_file()

static void pdb_convert_symbol_file ( const PDB_SYMBOLS symbols,
PDB_SYMBOL_FILE_EX sfile,
unsigned size,
const void image 
)
static

Definition at line 2421 of file msc.c.

2425{
2426 if (symbols->version < 19970000)
2427 {
2428 const PDB_SYMBOL_FILE *sym_file = image;
2429 memset(sfile, 0, sizeof(*sfile));
2430 sfile->file = sym_file->file;
2431 sfile->range.index = sym_file->range.index;
2432 sfile->symbol_size = sym_file->symbol_size;
2433 sfile->lineno_size = sym_file->lineno_size;
2434 *size = sizeof(PDB_SYMBOL_FILE) - 1;
2435 }
2436 else
2437 {
2438 memcpy(sfile, image, sizeof(PDB_SYMBOL_FILE_EX));
2439 *size = sizeof(PDB_SYMBOL_FILE_EX) - 1;
2440 }
2441}
GLeglImageOES image
Definition: gl.h:2204
struct _PDB_SYMBOL_FILE_EX PDB_SYMBOL_FILE_EX
struct _PDB_SYMBOL_FILE PDB_SYMBOL_FILE
DWORD version
Definition: mscvpdb.h:2060
PDB_SYMBOL_RANGE_EX range
Definition: mscvpdb.h:2017
DWORD symbol_size
Definition: mscvpdb.h:2006
PDB_SYMBOL_RANGE range
Definition: mscvpdb.h:2003
DWORD lineno_size
Definition: mscvpdb.h:2007

Referenced by pdb_process_internal().

◆ pdb_convert_symbols_header()

static void pdb_convert_symbols_header ( PDB_SYMBOLS symbols,
int header_size,
const BYTE image 
)
static

Definition at line 2391 of file msc.c.

2393{
2394 memset(symbols, 0, sizeof(PDB_SYMBOLS));
2395 if (!image) return;
2396
2397 if (*(const DWORD*)image != 0xffffffff)
2398 {
2399 /* Old version of the symbols record header */
2400 const PDB_SYMBOLS_OLD* old = (const PDB_SYMBOLS_OLD*)image;
2401 symbols->version = 0;
2402 symbols->module_size = old->module_size;
2403 symbols->offset_size = old->offset_size;
2404 symbols->hash_size = old->hash_size;
2405 symbols->srcmodule_size = old->srcmodule_size;
2406 symbols->pdbimport_size = 0;
2407 symbols->hash1_file = old->hash1_file;
2408 symbols->hash2_file = old->hash2_file;
2409 symbols->gsym_file = old->gsym_file;
2410
2411 *header_size = sizeof(PDB_SYMBOLS_OLD);
2412 }
2413 else
2414 {
2415 /* New version of the symbols record header */
2416 *symbols = *(const PDB_SYMBOLS*)image;
2417 *header_size = sizeof(PDB_SYMBOLS);
2418 }
2419}
struct _PDB_SYMBOLS_OLD PDB_SYMBOLS_OLD
struct _PDB_SYMBOLS PDB_SYMBOLS
DWORD offset_size
Definition: mscvpdb.h:2052
DWORD module_size
Definition: mscvpdb.h:2051
DWORD srcmodule_size
Definition: mscvpdb.h:2054
DWORD hash_size
Definition: mscvpdb.h:2068
DWORD srcmodule_size
Definition: mscvpdb.h:2069
DWORD hash2_file
Definition: mscvpdb.h:2063
DWORD hash1_file
Definition: mscvpdb.h:2062
DWORD pdbimport_size
Definition: mscvpdb.h:2070
WORD gsym_file
Definition: mscvpdb.h:2064
DWORD offset_size
Definition: mscvpdb.h:2067
DWORD module_size
Definition: mscvpdb.h:2066

Referenced by pdb_process_internal().

◆ pdb_convert_types_header()

static void pdb_convert_types_header ( PDB_TYPES types,
const BYTE image 
)
static

Definition at line 2368 of file msc.c.

2369{
2370 memset(types, 0, sizeof(PDB_TYPES));
2371 if (!image) return;
2372
2373 if (*(const DWORD*)image < 19960000) /* FIXME: correct version? */
2374 {
2375 /* Old version of the types record header */
2376 const PDB_TYPES_OLD* old = (const PDB_TYPES_OLD*)image;
2377 types->version = old->version;
2378 types->type_offset = sizeof(PDB_TYPES_OLD);
2379 types->type_size = old->type_size;
2380 types->first_index = old->first_index;
2381 types->last_index = old->last_index;
2382 types->file = old->file;
2383 }
2384 else
2385 {
2386 /* New version of the types record header */
2387 *types = *(const PDB_TYPES*)image;
2388 }
2389}
struct _PDB_TYPES_OLD PDB_TYPES_OLD
DWORD type_size
Definition: mscvpdb.h:1952
DWORD version
Definition: mscvpdb.h:1949
WORD last_index
Definition: mscvpdb.h:1951
WORD first_index
Definition: mscvpdb.h:1950

Referenced by pdb_process_types().

◆ pdb_ds_read()

static void * pdb_ds_read ( const struct PDB_DS_HEADER pdb,
const DWORD block_list,
int  size 
)
static

Definition at line 2190 of file msc.c.

2192{
2193 int i, num_blocks;
2194 BYTE* buffer;
2195
2196 if (!size) return NULL;
2197
2198 num_blocks = (size + pdb->block_size - 1) / pdb->block_size;
2199 buffer = HeapAlloc(GetProcessHeap(), 0, num_blocks * pdb->block_size);
2200
2201 for (i = 0; i < num_blocks; i++)
2202 memcpy(buffer + i * pdb->block_size,
2203 (const char*)pdb + block_list[i] * pdb->block_size, pdb->block_size);
2204
2205 return buffer;
2206}
GLuint buffer
Definition: glext.h:5915
JBLOCKROW JDIMENSION num_blocks
Definition: jpegint.h:423

Referenced by pdb_init(), and pdb_read_ds_file().

◆ pdb_fetch_file_info()

BOOL pdb_fetch_file_info ( const struct pdb_lookup pdb_lookup,
unsigned matched 
)

Definition at line 2913 of file msc.c.

2914{
2915 HANDLE hFile, hMap = NULL;
2916 char* image = NULL;
2917 BOOL ret;
2918 struct pdb_file_info pdb_file;
2919
2923 ((image = MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0)) == NULL))
2924 {
2925 WARN("Unable to open .PDB file: %s\n", pdb_lookup->filename);
2926 ret = FALSE;
2927 }
2928 else
2929 {
2930 ret = pdb_init(pdb_lookup, &pdb_file, image, matched);
2931 pdb_free_file(&pdb_file);
2932 }
2933
2935 if (hMap) CloseHandle(hMap);
2937
2938 return ret;
2939}
#define UnmapViewOfFile
Definition: compat.h:746
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define FILE_MAP_READ
Definition: compat.h:776
#define MapViewOfFile
Definition: compat.h:745
static void pdb_free_file(struct pdb_file_info *pdb_file)
Definition: msc.c:2269
static BOOL pdb_init(const struct pdb_lookup *pdb_lookup, struct pdb_file_info *pdb_file, const char *image, unsigned *matched)
Definition: msc.c:2539
HANDLE hMap
Definition: msc.c:64

Referenced by module_find_cb().

◆ pdb_free()

static void pdb_free ( void buffer)
static

◆ pdb_free_file()

static void pdb_free_file ( struct pdb_file_info pdb_file)
static

Definition at line 2269 of file msc.c.

2270{
2271 switch (pdb_file->kind)
2272 {
2273 case PDB_JG:
2274 pdb_free(pdb_file->u.jg.toc);
2275 pdb_file->u.jg.toc = NULL;
2276 break;
2277 case PDB_DS:
2278 pdb_free(pdb_file->u.ds.toc);
2279 pdb_file->u.ds.toc = NULL;
2280 break;
2281 }
2282 HeapFree(GetProcessHeap(), 0, pdb_file->stream_dict);
2283}
static void pdb_free(void *buffer)
Definition: msc.c:2264
struct pdb_file_info::@389::@391 ds
struct pdb_stream_name * stream_dict
Definition: msc.c:66
union pdb_file_info::@389 u
struct pdb_file_info::@389::@390 jg
enum pdb_kind kind
Definition: msc.c:62

Referenced by pdb_fetch_file_info(), and pdb_module_remove().

◆ pdb_get_file_size()

static unsigned pdb_get_file_size ( const struct pdb_file_info pdb_file,
DWORD  file_nr 
)
static

Definition at line 2254 of file msc.c.

2255{
2256 switch (pdb_file->kind)
2257 {
2258 case PDB_JG: return pdb_file->u.jg.toc->file[file_nr].size;
2259 case PDB_DS: return pdb_file->u.ds.toc->file_size[file_nr];
2260 }
2261 return 0;
2262}

Referenced by pdb_init(), pdb_process_internal(), and pdb_virtual_unwind().

◆ pdb_get_stream_by_name()

static unsigned pdb_get_stream_by_name ( const struct pdb_file_info pdb_file,
const char name 
)
static

Definition at line 2326 of file msc.c.

2327{
2328 struct pdb_stream_name* psn;
2329
2330 for (psn = pdb_file->stream_dict; psn && psn->name; psn++)
2331 {
2332 if (!strcmp(psn->name, name)) return psn->index;
2333 }
2334 return -1;
2335}
const char * name
Definition: msc.c:56
unsigned index
Definition: msc.c:57

Referenced by pdb_read_strings().

◆ pdb_init()

static BOOL pdb_init ( const struct pdb_lookup pdb_lookup,
struct pdb_file_info pdb_file,
const char image,
unsigned matched 
)
static

Definition at line 2539 of file msc.c.

2541{
2542 BOOL ret = TRUE;
2543
2544 /* check the file header, and if ok, load the TOC */
2545 TRACE("PDB(%s): %.40s\n", pdb_lookup->filename, debugstr_an(image, 40));
2546
2547 *matched = 0;
2548 if (!memcmp(image, PDB_JG_IDENT, sizeof(PDB_JG_IDENT)))
2549 {
2550 const struct PDB_JG_HEADER* pdb = (const struct PDB_JG_HEADER*)image;
2551 struct PDB_JG_ROOT* root;
2552
2553 pdb_file->u.jg.toc = pdb_jg_read(pdb, pdb->toc_block, pdb->toc.size);
2554 root = pdb_read_jg_file(pdb, pdb_file->u.jg.toc, 1);
2555 if (!root)
2556 {
2557 ERR("-Unable to get root from .PDB in %s\n", pdb_lookup->filename);
2558 return FALSE;
2559 }
2560 switch (root->Version)
2561 {
2562 case 19950623: /* VC 4.0 */
2563 case 19950814:
2564 case 19960307: /* VC 5.0 */
2565 case 19970604: /* VC 6.0 */
2566 break;
2567 default:
2568 ERR("-Unknown root block version %d\n", root->Version);
2569 }
2570 if (pdb_lookup->kind != PDB_JG)
2571 {
2572 WARN("Found %s, but wrong PDB kind\n", pdb_lookup->filename);
2573 pdb_free(root);
2574 return FALSE;
2575 }
2576 pdb_file->kind = PDB_JG;
2577 pdb_file->u.jg.timestamp = root->TimeDateStamp;
2578 pdb_file->age =