Removed uses of u_long. Use void* type for pointers where possible.
This commit is contained in:
parent
2d55e0484c
commit
b88d340755
|
@ -21,7 +21,6 @@
|
||||||
#ifndef __WINE_DEBUGGER_H
|
#ifndef __WINE_DEBUGGER_H
|
||||||
#define __WINE_DEBUGGER_H
|
#define __WINE_DEBUGGER_H
|
||||||
|
|
||||||
#include <sys/types.h> /* u_long ... */
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
|
@ -430,21 +429,17 @@ extern int DEBUG_PrintStringW( int chnl, const DBG_ADDR* address, int len );
|
||||||
|
|
||||||
/* debugger/module.c */
|
/* debugger/module.c */
|
||||||
extern int DEBUG_LoadEntryPoints( const char * prefix );
|
extern int DEBUG_LoadEntryPoints( const char * prefix );
|
||||||
extern void DEBUG_LoadModule32( const char* name, HANDLE hFile, DWORD base );
|
extern void DEBUG_LoadModule32( const char* name, HANDLE hFile, void *base );
|
||||||
extern DBG_MODULE* DEBUG_AddModule(const char* name, enum DbgModuleType type,
|
|
||||||
void* mod_addr, u_long size, HMODULE hmod);
|
|
||||||
extern DBG_MODULE* DEBUG_FindModuleByName(const char* name, enum DbgModuleType type);
|
extern DBG_MODULE* DEBUG_FindModuleByName(const char* name, enum DbgModuleType type);
|
||||||
extern DBG_MODULE* DEBUG_FindModuleByHandle(HANDLE handle, enum DbgModuleType type);
|
extern DBG_MODULE* DEBUG_FindModuleByHandle(HANDLE handle, enum DbgModuleType type);
|
||||||
extern DBG_MODULE* DEBUG_FindModuleByAddr(void* addr, enum DbgModuleType type);
|
extern DBG_MODULE* DEBUG_FindModuleByAddr(void* addr, enum DbgModuleType type);
|
||||||
extern DBG_MODULE* DEBUG_GetProcessMainModule(DBG_PROCESS* process);
|
extern DBG_MODULE* DEBUG_GetProcessMainModule(DBG_PROCESS* process);
|
||||||
extern DBG_MODULE* DEBUG_RegisterPEModule(HMODULE, u_long load_addr, u_long size,
|
extern DBG_MODULE* DEBUG_RegisterELFModule(void *load_addr, unsigned long size,
|
||||||
const char* name);
|
|
||||||
extern DBG_MODULE* DEBUG_RegisterELFModule(u_long load_addr, u_long size,
|
|
||||||
const char* name);
|
const char* name);
|
||||||
extern enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
|
extern enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
|
||||||
void* _nth, unsigned long nth_ofs);
|
void* _nth, unsigned long nth_ofs);
|
||||||
extern void DEBUG_ReportDIL(enum DbgInfoLoad dil, const char* pfx,
|
extern void DEBUG_ReportDIL(enum DbgInfoLoad dil, const char* pfx,
|
||||||
const char* filename, DWORD load_addr);
|
const char* filename, void *load_addr);
|
||||||
extern void DEBUG_InfoShare(void);
|
extern void DEBUG_InfoShare(void);
|
||||||
|
|
||||||
/* debugger/msc.c */
|
/* debugger/msc.c */
|
||||||
|
@ -479,7 +474,7 @@ extern int DEBUG_GetCurrentFrame(struct name_hash ** name,
|
||||||
|
|
||||||
/* debugger/stabs.c */
|
/* debugger/stabs.c */
|
||||||
extern enum DbgInfoLoad DEBUG_ReadExecutableDbgInfo(const char* exe_name);
|
extern enum DbgInfoLoad DEBUG_ReadExecutableDbgInfo(const char* exe_name);
|
||||||
extern enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset,
|
extern enum DbgInfoLoad DEBUG_ParseStabs(char * addr, void *load_offset,
|
||||||
unsigned int staboff, int stablen,
|
unsigned int staboff, int stablen,
|
||||||
unsigned int strtaboff, int strtablen);
|
unsigned int strtaboff, int strtablen);
|
||||||
|
|
||||||
|
|
|
@ -597,7 +597,7 @@ static void handle_debug_event(struct gdb_context* gdbctx, DEBUG_EVENT* de)
|
||||||
de->u.CreateProcessInfo.lpThreadLocalBase);
|
de->u.CreateProcessInfo.lpThreadLocalBase);
|
||||||
#if 0
|
#if 0
|
||||||
DEBUG_LoadModule32(DEBUG_CurrProcess->imageName, de->u.CreateProcessInfo.hFile,
|
DEBUG_LoadModule32(DEBUG_CurrProcess->imageName, de->u.CreateProcessInfo.hFile,
|
||||||
(DWORD)de->u.CreateProcessInfo.lpBaseOfImage);
|
de->u.CreateProcessInfo.lpBaseOfImage);
|
||||||
|
|
||||||
if (buffer[0]) /* we got a process name */
|
if (buffer[0]) /* we got a process name */
|
||||||
{
|
{
|
||||||
|
@ -635,7 +635,7 @@ static void handle_debug_event(struct gdb_context* gdbctx, DEBUG_EVENT* de)
|
||||||
de->u.LoadDll.nDebugInfoSize);
|
de->u.LoadDll.nDebugInfoSize);
|
||||||
#if 0
|
#if 0
|
||||||
_strupr(buffer);
|
_strupr(buffer);
|
||||||
DEBUG_LoadModule32(buffer, de->u.LoadDll.hFile, (DWORD)de->u.LoadDll.lpBaseOfDll);
|
DEBUG_LoadModule32(buffer, de->u.LoadDll.hFile, de->u.LoadDll.lpBaseOfDll);
|
||||||
DEBUG_CheckDelayedBP();
|
DEBUG_CheckDelayedBP();
|
||||||
if (DBG_IVAR(BreakOnDllLoad))
|
if (DBG_IVAR(BreakOnDllLoad))
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
* Creates and links a new module to the current process
|
* Creates and links a new module to the current process
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
DBG_MODULE* DEBUG_AddModule(const char* name, enum DbgModuleType type,
|
static DBG_MODULE* DEBUG_AddModule(const char* name, enum DbgModuleType type,
|
||||||
void* mod_addr, u_long size, HMODULE hmodule)
|
void* mod_addr, unsigned long size, HMODULE hmodule)
|
||||||
{
|
{
|
||||||
DBG_MODULE* wmod;
|
DBG_MODULE* wmod;
|
||||||
|
|
||||||
|
@ -88,8 +88,8 @@ DBG_MODULE* DEBUG_FindModuleByAddr(void* addr, enum DbgModuleType type)
|
||||||
|
|
||||||
for (i = 0; i < DEBUG_CurrProcess->num_modules; i++) {
|
for (i = 0; i < DEBUG_CurrProcess->num_modules; i++) {
|
||||||
if ((type == DMT_UNKNOWN || type == amod[i]->type) &&
|
if ((type == DMT_UNKNOWN || type == amod[i]->type) &&
|
||||||
(u_long)addr >= (u_long)amod[i]->load_addr &&
|
(char *)addr >= (char *)amod[i]->load_addr &&
|
||||||
(u_long)addr < (u_long)amod[i]->load_addr + (u_long)amod[i]->size) {
|
(char *)addr < (char *)amod[i]->load_addr + amod[i]->size) {
|
||||||
/* amod[i] contains it... check against res now */
|
/* amod[i] contains it... check against res now */
|
||||||
if (!res || res->load_addr < amod[i]->load_addr)
|
if (!res || res->load_addr < amod[i]->load_addr)
|
||||||
res = amod[i];
|
res = amod[i];
|
||||||
|
@ -133,9 +133,9 @@ DBG_MODULE* DEBUG_GetProcessMainModule(DBG_PROCESS* process)
|
||||||
* ELF modules are also entered into the list - this is so that we
|
* ELF modules are also entered into the list - this is so that we
|
||||||
* can make 'info shared' types of displays possible.
|
* can make 'info shared' types of displays possible.
|
||||||
*/
|
*/
|
||||||
DBG_MODULE* DEBUG_RegisterELFModule(u_long load_addr, u_long size, const char* name)
|
DBG_MODULE* DEBUG_RegisterELFModule(void *load_addr, unsigned long size, const char* name)
|
||||||
{
|
{
|
||||||
DBG_MODULE* wmod = DEBUG_AddModule(name, DMT_ELF, (void*)load_addr, size, 0);
|
DBG_MODULE* wmod = DEBUG_AddModule(name, DMT_ELF, load_addr, size, 0);
|
||||||
|
|
||||||
if (!wmod) return NULL;
|
if (!wmod) return NULL;
|
||||||
|
|
||||||
|
@ -148,9 +148,10 @@ DBG_MODULE* DEBUG_RegisterELFModule(u_long load_addr, u_long size, const char* n
|
||||||
* DEBUG_RegisterPEModule
|
* DEBUG_RegisterPEModule
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
DBG_MODULE* DEBUG_RegisterPEModule(HMODULE hModule, u_long load_addr, u_long size, const char *module_name)
|
static DBG_MODULE* DEBUG_RegisterPEModule(HMODULE hModule, void *load_addr,
|
||||||
|
unsigned long size, const char *module_name)
|
||||||
{
|
{
|
||||||
DBG_MODULE* wmod = DEBUG_AddModule(module_name, DMT_PE, (void*)load_addr, size, hModule);
|
DBG_MODULE* wmod = DEBUG_AddModule(module_name, DMT_PE, load_addr, size, hModule);
|
||||||
|
|
||||||
if (!wmod) return NULL;
|
if (!wmod) return NULL;
|
||||||
|
|
||||||
|
@ -159,11 +160,13 @@ DBG_MODULE* DEBUG_RegisterPEModule(HMODULE hModule, u_long load_addr, u_long siz
|
||||||
return wmod;
|
return wmod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* DEBUG_RegisterNEModule
|
* DEBUG_RegisterNEModule
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
DBG_MODULE* DEBUG_RegisterNEModule(HMODULE hModule, void* load_addr, u_long size, const char *module_name)
|
static DBG_MODULE* DEBUG_RegisterNEModule(HMODULE hModule, void* load_addr,
|
||||||
|
unsigned long size, const char *module_name)
|
||||||
{
|
{
|
||||||
DBG_MODULE* wmod = DEBUG_AddModule(module_name, DMT_NE, load_addr, size, hModule);
|
DBG_MODULE* wmod = DEBUG_AddModule(module_name, DMT_NE, load_addr, size, hModule);
|
||||||
|
|
||||||
|
@ -173,7 +176,6 @@ DBG_MODULE* DEBUG_RegisterNEModule(HMODULE hModule, void* load_addr, u_long size
|
||||||
return wmod;
|
return wmod;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* DEBUG_GetEP16
|
* DEBUG_GetEP16
|
||||||
*
|
*
|
||||||
|
@ -270,7 +272,7 @@ static void DEBUG_LoadModule16(HMODULE hModule, NE_MODULE* module, char* moduleA
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* DEBUG_LoadModule32
|
* DEBUG_LoadModule32
|
||||||
*/
|
*/
|
||||||
void DEBUG_LoadModule32(const char* name, HANDLE hFile, DWORD base)
|
void DEBUG_LoadModule32(const char* name, HANDLE hFile, void *base)
|
||||||
{
|
{
|
||||||
IMAGE_NT_HEADERS pe_header;
|
IMAGE_NT_HEADERS pe_header;
|
||||||
DWORD nth_ofs;
|
DWORD nth_ofs;
|
||||||
|
@ -282,16 +284,16 @@ void DEBUG_LoadModule32(const char* name, HANDLE hFile, DWORD base)
|
||||||
enum DbgInfoLoad dil = DIL_ERROR;
|
enum DbgInfoLoad dil = DIL_ERROR;
|
||||||
|
|
||||||
/* grab PE Header */
|
/* grab PE Header */
|
||||||
if (!DEBUG_READ_MEM_VERBOSE((void*)(base + OFFSET_OF(IMAGE_DOS_HEADER, e_lfanew)),
|
if (!DEBUG_READ_MEM_VERBOSE( (char *)base + OFFSET_OF(IMAGE_DOS_HEADER, e_lfanew),
|
||||||
&nth_ofs, sizeof(nth_ofs)) ||
|
&nth_ofs, sizeof(nth_ofs)) ||
|
||||||
!DEBUG_READ_MEM_VERBOSE((void*)(base + nth_ofs), &pe_header, sizeof(pe_header)))
|
!DEBUG_READ_MEM_VERBOSE( (char *)base + nth_ofs, &pe_header, sizeof(pe_header)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pe_seg_ofs = nth_ofs + OFFSET_OF(IMAGE_NT_HEADERS, OptionalHeader) +
|
pe_seg_ofs = nth_ofs + OFFSET_OF(IMAGE_NT_HEADERS, OptionalHeader) +
|
||||||
pe_header.FileHeader.SizeOfOptionalHeader;
|
pe_header.FileHeader.SizeOfOptionalHeader;
|
||||||
|
|
||||||
for (i = 0; i < pe_header.FileHeader.NumberOfSections; i++, pe_seg_ofs += sizeof(pe_seg)) {
|
for (i = 0; i < pe_header.FileHeader.NumberOfSections; i++, pe_seg_ofs += sizeof(pe_seg)) {
|
||||||
if (!DEBUG_READ_MEM_VERBOSE((void*)(base + pe_seg_ofs), &pe_seg, sizeof(pe_seg)))
|
if (!DEBUG_READ_MEM_VERBOSE( (char *)base + pe_seg_ofs, &pe_seg, sizeof(pe_seg)))
|
||||||
continue;
|
continue;
|
||||||
if (size < pe_seg.VirtualAddress + pe_seg.SizeOfRawData)
|
if (size < pe_seg.VirtualAddress + pe_seg.SizeOfRawData)
|
||||||
size = pe_seg.VirtualAddress + pe_seg.SizeOfRawData;
|
size = pe_seg.VirtualAddress + pe_seg.SizeOfRawData;
|
||||||
|
@ -327,7 +329,7 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
|
||||||
DWORD dir_ofs;
|
DWORD dir_ofs;
|
||||||
const char* prefix;
|
const char* prefix;
|
||||||
IMAGE_NT_HEADERS* nth = (PIMAGE_NT_HEADERS)_nth;
|
IMAGE_NT_HEADERS* nth = (PIMAGE_NT_HEADERS)_nth;
|
||||||
DWORD base = (u_long)wmod->load_addr;
|
void * base = wmod->load_addr;
|
||||||
|
|
||||||
value.type = NULL;
|
value.type = NULL;
|
||||||
value.cookie = DV_TARGET;
|
value.cookie = DV_TARGET;
|
||||||
|
@ -335,7 +337,7 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
|
||||||
value.addr.off = 0;
|
value.addr.off = 0;
|
||||||
|
|
||||||
/* Add start of DLL */
|
/* Add start of DLL */
|
||||||
value.addr.off = base;
|
value.addr.off = (unsigned long)base;
|
||||||
if ((prefix = strrchr(wmod->module_name, '\\' ))) prefix++;
|
if ((prefix = strrchr(wmod->module_name, '\\' ))) prefix++;
|
||||||
else prefix = wmod->module_name;
|
else prefix = wmod->module_name;
|
||||||
|
|
||||||
|
@ -343,7 +345,7 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
|
||||||
|
|
||||||
/* Add entry point */
|
/* Add entry point */
|
||||||
snprintf(buffer, sizeof(buffer), "%s.EntryPoint", prefix);
|
snprintf(buffer, sizeof(buffer), "%s.EntryPoint", prefix);
|
||||||
value.addr.off = base + nth->OptionalHeader.AddressOfEntryPoint;
|
value.addr.off = (unsigned long)base + nth->OptionalHeader.AddressOfEntryPoint;
|
||||||
DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC);
|
DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC);
|
||||||
|
|
||||||
/* Add start of sections */
|
/* Add start of sections */
|
||||||
|
@ -351,10 +353,10 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
|
||||||
nth->FileHeader.SizeOfOptionalHeader;
|
nth->FileHeader.SizeOfOptionalHeader;
|
||||||
|
|
||||||
for (i = 0; i < nth->FileHeader.NumberOfSections; i++, pe_seg_ofs += sizeof(pe_seg)) {
|
for (i = 0; i < nth->FileHeader.NumberOfSections; i++, pe_seg_ofs += sizeof(pe_seg)) {
|
||||||
if (!DEBUG_READ_MEM_VERBOSE((void*)(base + pe_seg_ofs), &pe_seg, sizeof(pe_seg)))
|
if (!DEBUG_READ_MEM_VERBOSE( (char *)base + pe_seg_ofs, &pe_seg, sizeof(pe_seg)))
|
||||||
continue;
|
continue;
|
||||||
snprintf(buffer, sizeof(buffer), "%s.%s", prefix, pe_seg.Name);
|
snprintf(buffer, sizeof(buffer), "%s.%s", prefix, pe_seg.Name);
|
||||||
value.addr.off = base + pe_seg.VirtualAddress;
|
value.addr.off = (unsigned long)base + pe_seg.VirtualAddress;
|
||||||
DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC);
|
DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,35 +364,35 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
|
||||||
dir_ofs = nth_ofs +
|
dir_ofs = nth_ofs +
|
||||||
OFFSET_OF(IMAGE_NT_HEADERS,
|
OFFSET_OF(IMAGE_NT_HEADERS,
|
||||||
OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT]);
|
OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT]);
|
||||||
if (DEBUG_READ_MEM_VERBOSE((void*)(base + dir_ofs), &dir, sizeof(dir)) && dir.Size) {
|
if (DEBUG_READ_MEM_VERBOSE( (char *)base + dir_ofs, &dir, sizeof(dir)) && dir.Size) {
|
||||||
IMAGE_EXPORT_DIRECTORY exports;
|
IMAGE_EXPORT_DIRECTORY exports;
|
||||||
WORD* ordinals = NULL;
|
WORD* ordinals = NULL;
|
||||||
void** functions = NULL;
|
void** functions = NULL;
|
||||||
DWORD* names = NULL;
|
DWORD* names = NULL;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
|
||||||
if (DEBUG_READ_MEM_VERBOSE((void*)(base + dir.VirtualAddress),
|
if (DEBUG_READ_MEM_VERBOSE( (char *)base + dir.VirtualAddress,
|
||||||
&exports, sizeof(exports)) &&
|
&exports, sizeof(exports)) &&
|
||||||
|
|
||||||
((functions = DBG_alloc(sizeof(functions[0]) * exports.NumberOfFunctions))) &&
|
((functions = DBG_alloc(sizeof(functions[0]) * exports.NumberOfFunctions))) &&
|
||||||
DEBUG_READ_MEM_VERBOSE((void*)(base + (DWORD)exports.AddressOfFunctions),
|
DEBUG_READ_MEM_VERBOSE( (char *)base + exports.AddressOfFunctions,
|
||||||
functions, sizeof(functions[0]) * exports.NumberOfFunctions) &&
|
functions, sizeof(functions[0]) * exports.NumberOfFunctions) &&
|
||||||
|
|
||||||
((ordinals = DBG_alloc(sizeof(ordinals[0]) * exports.NumberOfNames))) &&
|
((ordinals = DBG_alloc(sizeof(ordinals[0]) * exports.NumberOfNames))) &&
|
||||||
DEBUG_READ_MEM_VERBOSE((void*)(base + (DWORD)exports.AddressOfNameOrdinals),
|
DEBUG_READ_MEM_VERBOSE( (char *)base + (DWORD)exports.AddressOfNameOrdinals,
|
||||||
ordinals, sizeof(ordinals[0]) * exports.NumberOfNames) &&
|
ordinals, sizeof(ordinals[0]) * exports.NumberOfNames) &&
|
||||||
|
|
||||||
((names = DBG_alloc(sizeof(names[0]) * exports.NumberOfNames))) &&
|
((names = DBG_alloc(sizeof(names[0]) * exports.NumberOfNames))) &&
|
||||||
DEBUG_READ_MEM_VERBOSE((void*)(base + (DWORD)exports.AddressOfNames),
|
DEBUG_READ_MEM_VERBOSE( (char *)base + (DWORD)exports.AddressOfNames,
|
||||||
names, sizeof(names[0]) * exports.NumberOfNames)) {
|
names, sizeof(names[0]) * exports.NumberOfNames)) {
|
||||||
|
|
||||||
for (i = 0; i < exports.NumberOfNames; i++) {
|
for (i = 0; i < exports.NumberOfNames; i++) {
|
||||||
if (!names[i] ||
|
if (!names[i] ||
|
||||||
!DEBUG_READ_MEM_VERBOSE((void*)(base + names[i]), bufstr, sizeof(bufstr)))
|
!DEBUG_READ_MEM_VERBOSE( (char *)base + names[i], bufstr, sizeof(bufstr)))
|
||||||
continue;
|
continue;
|
||||||
bufstr[sizeof(bufstr) - 1] = 0;
|
bufstr[sizeof(bufstr) - 1] = 0;
|
||||||
snprintf(buffer, sizeof(buffer), "%s.%s", prefix, bufstr);
|
snprintf(buffer, sizeof(buffer), "%s.%s", prefix, bufstr);
|
||||||
value.addr.off = base + (DWORD)functions[ordinals[i]];
|
value.addr.off = (unsigned long)base + (DWORD)functions[ordinals[i]];
|
||||||
DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC);
|
DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,7 +403,7 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
|
||||||
if ((ordinals[j] == i) && names[j]) break;
|
if ((ordinals[j] == i) && names[j]) break;
|
||||||
if (j < exports.NumberOfNames) continue;
|
if (j < exports.NumberOfNames) continue;
|
||||||
snprintf(buffer, sizeof(buffer), "%s.%ld", prefix, i + exports.Base);
|
snprintf(buffer, sizeof(buffer), "%s.%ld", prefix, i + exports.Base);
|
||||||
value.addr.off = base + (DWORD)functions[i];
|
value.addr.off = (unsigned long)base + (DWORD)functions[i];
|
||||||
DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC);
|
DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -465,22 +467,22 @@ int DEBUG_LoadEntryPoints(const char* pfx)
|
||||||
return first;
|
return first;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DEBUG_ReportDIL(enum DbgInfoLoad dil, const char* pfx, const char* filename, DWORD load_addr)
|
void DEBUG_ReportDIL(enum DbgInfoLoad dil, const char* pfx, const char* filename, void *load_addr)
|
||||||
{
|
{
|
||||||
const char* fmt;
|
const char* fmt;
|
||||||
|
|
||||||
switch (dil) {
|
switch (dil) {
|
||||||
case DIL_DEFERRED:
|
case DIL_DEFERRED:
|
||||||
fmt = "Deferring debug information loading for %s '%s' (0x%08x)\n";
|
fmt = "Deferring debug information loading for %s '%s' (%p)\n";
|
||||||
break;
|
break;
|
||||||
case DIL_LOADED:
|
case DIL_LOADED:
|
||||||
fmt = "Loaded debug information from %s '%s' (0x%08x)\n";
|
fmt = "Loaded debug information from %s '%s' (%p)\n";
|
||||||
break;
|
break;
|
||||||
case DIL_NOINFO:
|
case DIL_NOINFO:
|
||||||
fmt = "No debug information in %s '%s' (0x%08x)\n";
|
fmt = "No debug information in %s '%s' (%p)\n";
|
||||||
break;
|
break;
|
||||||
case DIL_ERROR:
|
case DIL_ERROR:
|
||||||
fmt = "Can't find file for %s '%s' (0x%08x)\n";
|
fmt = "Can't find file for %s '%s' (%p)\n";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DEBUG_Printf(DBG_CHN_ERR, "Oooocch (%d)\n", dil);
|
DEBUG_Printf(DBG_CHN_ERR, "Oooocch (%d)\n", dil);
|
||||||
|
|
|
@ -95,7 +95,7 @@
|
||||||
|
|
||||||
typedef struct tagELF_DBG_INFO
|
typedef struct tagELF_DBG_INFO
|
||||||
{
|
{
|
||||||
unsigned long elf_addr;
|
void *elf_addr;
|
||||||
} ELF_DBG_INFO;
|
} ELF_DBG_INFO;
|
||||||
|
|
||||||
struct stab_nlist {
|
struct stab_nlist {
|
||||||
|
@ -862,7 +862,7 @@ DEBUG_ParseStabType(const char * stab)
|
||||||
return *DEBUG_ReadTypeEnum((char**)&c);
|
return *DEBUG_ReadTypeEnum((char**)&c);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset,
|
enum DbgInfoLoad DEBUG_ParseStabs(char * addr, void *load_offset,
|
||||||
unsigned int staboff, int stablen,
|
unsigned int staboff, int stablen,
|
||||||
unsigned int strtaboff, int strtablen)
|
unsigned int strtaboff, int strtablen)
|
||||||
{
|
{
|
||||||
|
@ -957,7 +957,7 @@ enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset,
|
||||||
*/
|
*/
|
||||||
new_value.addr.seg = 0;
|
new_value.addr.seg = 0;
|
||||||
new_value.type = DEBUG_ParseStabType(ptr);
|
new_value.type = DEBUG_ParseStabType(ptr);
|
||||||
new_value.addr.off = load_offset + stab_ptr->n_value;
|
new_value.addr.off = (unsigned long)load_offset + stab_ptr->n_value;
|
||||||
new_value.cookie = DV_TARGET;
|
new_value.cookie = DV_TARGET;
|
||||||
|
|
||||||
stab_strcpy(symname, sizeof(symname), ptr);
|
stab_strcpy(symname, sizeof(symname), ptr);
|
||||||
|
@ -986,7 +986,7 @@ enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset,
|
||||||
*/
|
*/
|
||||||
new_value.addr.seg = 0;
|
new_value.addr.seg = 0;
|
||||||
new_value.type = DEBUG_ParseStabType(ptr);
|
new_value.type = DEBUG_ParseStabType(ptr);
|
||||||
new_value.addr.off = load_offset + stab_ptr->n_value;
|
new_value.addr.off = (unsigned long)load_offset + stab_ptr->n_value;
|
||||||
new_value.cookie = DV_TARGET;
|
new_value.cookie = DV_TARGET;
|
||||||
|
|
||||||
stab_strcpy(symname, sizeof(symname), ptr);
|
stab_strcpy(symname, sizeof(symname), ptr);
|
||||||
|
@ -1064,7 +1064,7 @@ enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset,
|
||||||
{
|
{
|
||||||
new_value.addr.seg = 0;
|
new_value.addr.seg = 0;
|
||||||
new_value.type = DEBUG_ParseStabType(ptr);
|
new_value.type = DEBUG_ParseStabType(ptr);
|
||||||
new_value.addr.off = load_offset + stab_ptr->n_value;
|
new_value.addr.off = (unsigned long)load_offset + stab_ptr->n_value;
|
||||||
new_value.cookie = DV_TARGET;
|
new_value.cookie = DV_TARGET;
|
||||||
/*
|
/*
|
||||||
* Copy the string to a temp buffer so we
|
* Copy the string to a temp buffer so we
|
||||||
|
@ -1199,7 +1199,7 @@ enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset,
|
||||||
* numbers or local data variables.
|
* numbers or local data variables.
|
||||||
*/
|
*/
|
||||||
static int DEBUG_ProcessElfSymtab(DBG_MODULE* module, char* addr,
|
static int DEBUG_ProcessElfSymtab(DBG_MODULE* module, char* addr,
|
||||||
u_long load_addr, Elf32_Shdr* symtab,
|
void *load_addr, Elf32_Shdr* symtab,
|
||||||
Elf32_Shdr* strtab)
|
Elf32_Shdr* strtab)
|
||||||
{
|
{
|
||||||
char * curfile = NULL;
|
char * curfile = NULL;
|
||||||
|
@ -1242,7 +1242,7 @@ static int DEBUG_ProcessElfSymtab(DBG_MODULE* module, char* addr,
|
||||||
|
|
||||||
new_value.type = NULL;
|
new_value.type = NULL;
|
||||||
new_value.addr.seg = 0;
|
new_value.addr.seg = 0;
|
||||||
new_value.addr.off = load_addr + symp->st_value;
|
new_value.addr.off = (unsigned long)load_addr + symp->st_value;
|
||||||
new_value.cookie = DV_TARGET;
|
new_value.cookie = DV_TARGET;
|
||||||
flags = SYM_WINE | ((ELF32_ST_TYPE(symp->st_info) == STT_FUNC)
|
flags = SYM_WINE | ((ELF32_ST_TYPE(symp->st_info) == STT_FUNC)
|
||||||
? SYM_FUNC : SYM_DATA);
|
? SYM_FUNC : SYM_DATA);
|
||||||
|
@ -1375,7 +1375,7 @@ enum DbgInfoLoad DEBUG_LoadElfStabs(DBG_MODULE* module)
|
||||||
* 1 on success
|
* 1 on success
|
||||||
*/
|
*/
|
||||||
static enum DbgInfoLoad DEBUG_ProcessElfFile(const char* filename,
|
static enum DbgInfoLoad DEBUG_ProcessElfFile(const char* filename,
|
||||||
unsigned int load_offset,
|
void *load_offset,
|
||||||
unsigned int* dyn_addr)
|
unsigned int* dyn_addr)
|
||||||
{
|
{
|
||||||
static const unsigned char elf_signature[4] = { ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3 };
|
static const unsigned char elf_signature[4] = { ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3 };
|
||||||
|
@ -1406,7 +1406,7 @@ static enum DbgInfoLoad DEBUG_ProcessElfFile(const char* filename,
|
||||||
* Now mmap() the file.
|
* Now mmap() the file.
|
||||||
*/
|
*/
|
||||||
addr = mmap(0, statbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
|
addr = mmap(0, statbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||||
if (addr == (char*)0xffffffff) goto leave;
|
if (addr == (char*)-1) goto leave;
|
||||||
|
|
||||||
dil = DIL_NOINFO;
|
dil = DIL_NOINFO;
|
||||||
|
|
||||||
|
@ -1450,7 +1450,7 @@ static enum DbgInfoLoad DEBUG_ProcessElfFile(const char* filename,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module = DEBUG_RegisterELFModule((load_offset == 0) ? ehptr->e_entry : load_offset,
|
module = DEBUG_RegisterELFModule((load_offset == 0) ? (void *)ehptr->e_entry : load_offset,
|
||||||
size, filename);
|
size, filename);
|
||||||
if (!module) {
|
if (!module) {
|
||||||
dil = DIL_ERROR;
|
dil = DIL_ERROR;
|
||||||
|
@ -1474,7 +1474,7 @@ static enum DbgInfoLoad DEBUG_ProcessElfFile(const char* filename,
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum DbgInfoLoad DEBUG_ProcessElfFileFromPath(const char * filename,
|
static enum DbgInfoLoad DEBUG_ProcessElfFileFromPath(const char * filename,
|
||||||
unsigned int load_offset,
|
void *load_offset,
|
||||||
unsigned int* dyn_addr,
|
unsigned int* dyn_addr,
|
||||||
const char* path)
|
const char* path)
|
||||||
{
|
{
|
||||||
|
@ -1503,7 +1503,7 @@ static enum DbgInfoLoad DEBUG_ProcessElfFileFromPath(const char * filename,
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum DbgInfoLoad DEBUG_ProcessElfObject(const char* filename,
|
static enum DbgInfoLoad DEBUG_ProcessElfObject(const char* filename,
|
||||||
unsigned int load_offset,
|
void *load_offset,
|
||||||
unsigned int* dyn_addr)
|
unsigned int* dyn_addr)
|
||||||
{
|
{
|
||||||
enum DbgInfoLoad dil = DIL_ERROR;
|
enum DbgInfoLoad dil = DIL_ERROR;
|
||||||
|
@ -1530,7 +1530,7 @@ static enum DbgInfoLoad DEBUG_ProcessElfObject(const char* filename,
|
||||||
|
|
||||||
static BOOL DEBUG_WalkList(struct r_debug* dbg_hdr)
|
static BOOL DEBUG_WalkList(struct r_debug* dbg_hdr)
|
||||||
{
|
{
|
||||||
u_long lm_addr;
|
void *lm_addr;
|
||||||
struct link_map lm;
|
struct link_map lm;
|
||||||
Elf32_Ehdr ehdr;
|
Elf32_Ehdr ehdr;
|
||||||
char bufstr[256];
|
char bufstr[256];
|
||||||
|
@ -1541,8 +1541,8 @@ static BOOL DEBUG_WalkList(struct r_debug* dbg_hdr)
|
||||||
* cases the first entry doesn't appear with a name, in other cases it
|
* cases the first entry doesn't appear with a name, in other cases it
|
||||||
* does.
|
* does.
|
||||||
*/
|
*/
|
||||||
for (lm_addr = (u_long)dbg_hdr->r_map; lm_addr; lm_addr = (u_long)lm.l_next) {
|
for (lm_addr = (void *)dbg_hdr->r_map; lm_addr; lm_addr = (void *)lm.l_next) {
|
||||||
if (!DEBUG_READ_MEM_VERBOSE((void*)lm_addr, &lm, sizeof(lm)))
|
if (!DEBUG_READ_MEM_VERBOSE(lm_addr, &lm, sizeof(lm)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (lm.l_addr != 0 &&
|
if (lm.l_addr != 0 &&
|
||||||
|
@ -1551,7 +1551,7 @@ static BOOL DEBUG_WalkList(struct r_debug* dbg_hdr)
|
||||||
lm.l_name != NULL &&
|
lm.l_name != NULL &&
|
||||||
DEBUG_READ_MEM_VERBOSE((void*)lm.l_name, bufstr, sizeof(bufstr))) {
|
DEBUG_READ_MEM_VERBOSE((void*)lm.l_name, bufstr, sizeof(bufstr))) {
|
||||||
bufstr[sizeof(bufstr) - 1] = '\0';
|
bufstr[sizeof(bufstr) - 1] = '\0';
|
||||||
DEBUG_ProcessElfObject(bufstr, (unsigned)lm.l_addr, NULL);
|
DEBUG_ProcessElfObject(bufstr, (void *)lm.l_addr, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1607,7 +1607,7 @@ enum DbgInfoLoad DEBUG_ReadExecutableDbgInfo(const char* exe_name)
|
||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
assert(!DEBUG_CurrProcess->dbg_hdr_addr);
|
assert(!DEBUG_CurrProcess->dbg_hdr_addr);
|
||||||
DEBUG_CurrProcess->dbg_hdr_addr = (u_long)dyn.d_un.d_ptr;
|
DEBUG_CurrProcess->dbg_hdr_addr = (unsigned long)dyn.d_un.d_ptr;
|
||||||
|
|
||||||
if (dbg_hdr.r_brk) {
|
if (dbg_hdr.r_brk) {
|
||||||
DBG_VALUE value;
|
DBG_VALUE value;
|
||||||
|
|
|
@ -761,7 +761,7 @@ static BOOL DEBUG_HandleDebugEvent(DEBUG_EVENT* de)
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
DEBUG_LoadModule32(DEBUG_CurrProcess->imageName, de->u.CreateProcessInfo.hFile,
|
DEBUG_LoadModule32(DEBUG_CurrProcess->imageName, de->u.CreateProcessInfo.hFile,
|
||||||
(DWORD)de->u.CreateProcessInfo.lpBaseOfImage);
|
de->u.CreateProcessInfo.lpBaseOfImage);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -813,7 +813,7 @@ static BOOL DEBUG_HandleDebugEvent(DEBUG_EVENT* de)
|
||||||
de->u.LoadDll.dwDebugInfoFileOffset,
|
de->u.LoadDll.dwDebugInfoFileOffset,
|
||||||
de->u.LoadDll.nDebugInfoSize);
|
de->u.LoadDll.nDebugInfoSize);
|
||||||
_strupr(buffer);
|
_strupr(buffer);
|
||||||
DEBUG_LoadModule32(buffer, de->u.LoadDll.hFile, (DWORD)de->u.LoadDll.lpBaseOfDll);
|
DEBUG_LoadModule32(buffer, de->u.LoadDll.hFile, de->u.LoadDll.lpBaseOfDll);
|
||||||
DEBUG_CheckDelayedBP();
|
DEBUG_CheckDelayedBP();
|
||||||
if (DBG_IVAR(BreakOnDllLoad))
|
if (DBG_IVAR(BreakOnDllLoad))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue