Commit b88d3407 authored by Alexandre Julliard's avatar Alexandre Julliard

Removed uses of u_long. Use void* type for pointers where possible.

parent 2d55e048
......@@ -21,7 +21,6 @@
#ifndef __WINE_DEBUGGER_H
#define __WINE_DEBUGGER_H
#include <sys/types.h> /* u_long ... */
#include <assert.h>
#include "windef.h"
#include "winbase.h"
......@@ -430,21 +429,17 @@ extern int DEBUG_PrintStringW( int chnl, const DBG_ADDR* address, int len );
/* debugger/module.c */
extern int DEBUG_LoadEntryPoints( const char * prefix );
extern void DEBUG_LoadModule32( const char* name, HANDLE hFile, DWORD base );
extern DBG_MODULE* DEBUG_AddModule(const char* name, enum DbgModuleType type,
void* mod_addr, u_long size, HMODULE hmod);
extern void DEBUG_LoadModule32( const char* name, HANDLE hFile, void *base );
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_FindModuleByAddr(void* addr, enum DbgModuleType type);
extern DBG_MODULE* DEBUG_GetProcessMainModule(DBG_PROCESS* process);
extern DBG_MODULE* DEBUG_RegisterPEModule(HMODULE, u_long load_addr, u_long size,
const char* name);
extern DBG_MODULE* DEBUG_RegisterELFModule(u_long load_addr, u_long size,
extern DBG_MODULE* DEBUG_RegisterELFModule(void *load_addr, unsigned long size,
const char* name);
extern enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
void* _nth, unsigned long nth_ofs);
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);
/* debugger/msc.c */
......@@ -479,7 +474,7 @@ extern int DEBUG_GetCurrentFrame(struct name_hash ** name,
/* debugger/stabs.c */
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 strtaboff, int strtablen);
......
......@@ -597,7 +597,7 @@ static void handle_debug_event(struct gdb_context* gdbctx, DEBUG_EVENT* de)
de->u.CreateProcessInfo.lpThreadLocalBase);
#if 0
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 */
{
......@@ -635,7 +635,7 @@ static void handle_debug_event(struct gdb_context* gdbctx, DEBUG_EVENT* de)
de->u.LoadDll.nDebugInfoSize);
#if 0
_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();
if (DBG_IVAR(BreakOnDllLoad))
{
......
......@@ -31,8 +31,8 @@
* Creates and links a new module to the current process
*
*/
DBG_MODULE* DEBUG_AddModule(const char* name, enum DbgModuleType type,
void* mod_addr, u_long size, HMODULE hmodule)
static DBG_MODULE* DEBUG_AddModule(const char* name, enum DbgModuleType type,
void* mod_addr, unsigned long size, HMODULE hmodule)
{
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++) {
if ((type == DMT_UNKNOWN || type == amod[i]->type) &&
(u_long)addr >= (u_long)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 &&
(char *)addr < (char *)amod[i]->load_addr + amod[i]->size) {
/* amod[i] contains it... check against res now */
if (!res || res->load_addr < amod[i]->load_addr)
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
* 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;
......@@ -148,9 +148,10 @@ DBG_MODULE* DEBUG_RegisterELFModule(u_long load_addr, u_long size, const char* n
* 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;
......@@ -159,11 +160,13 @@ DBG_MODULE* DEBUG_RegisterPEModule(HMODULE hModule, u_long load_addr, u_long siz
return wmod;
}
#if 0
/***********************************************************************
* 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);
......@@ -173,7 +176,6 @@ DBG_MODULE* DEBUG_RegisterNEModule(HMODULE hModule, void* load_addr, u_long size
return wmod;
}
#if 0
/***********************************************************************
* DEBUG_GetEP16
*
......@@ -270,7 +272,7 @@ static void DEBUG_LoadModule16(HMODULE hModule, NE_MODULE* module, char* moduleA
/***********************************************************************
* 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;
DWORD nth_ofs;
......@@ -282,16 +284,16 @@ void DEBUG_LoadModule32(const char* name, HANDLE hFile, DWORD base)
enum DbgInfoLoad dil = DIL_ERROR;
/* 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)) ||
!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;
pe_seg_ofs = nth_ofs + OFFSET_OF(IMAGE_NT_HEADERS, OptionalHeader) +
pe_header.FileHeader.SizeOfOptionalHeader;
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;
if (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;
const char* prefix;
IMAGE_NT_HEADERS* nth = (PIMAGE_NT_HEADERS)_nth;
DWORD base = (u_long)wmod->load_addr;
void * base = wmod->load_addr;
value.type = NULL;
value.cookie = DV_TARGET;
......@@ -335,7 +337,7 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
value.addr.off = 0;
/* Add start of DLL */
value.addr.off = base;
value.addr.off = (unsigned long)base;
if ((prefix = strrchr(wmod->module_name, '\\' ))) prefix++;
else prefix = wmod->module_name;
......@@ -343,7 +345,7 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
/* Add entry point */
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);
/* Add start of sections */
......@@ -351,10 +353,10 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
nth->FileHeader.SizeOfOptionalHeader;
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;
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);
}
......@@ -362,35 +364,35 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
dir_ofs = nth_ofs +
OFFSET_OF(IMAGE_NT_HEADERS,
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;
WORD* ordinals = NULL;
void** functions = NULL;
DWORD* names = NULL;
unsigned int j;
if (DEBUG_READ_MEM_VERBOSE((void*)(base + dir.VirtualAddress),
if (DEBUG_READ_MEM_VERBOSE( (char *)base + dir.VirtualAddress,
&exports, sizeof(exports)) &&
((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) &&
((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) &&
((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)) {
for (i = 0; i < exports.NumberOfNames; 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;
bufstr[sizeof(bufstr) - 1] = 0;
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);
}
......@@ -401,7 +403,7 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
if ((ordinals[j] == i) && names[j]) break;
if (j < exports.NumberOfNames) continue;
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);
}
}
......@@ -465,22 +467,22 @@ int DEBUG_LoadEntryPoints(const char* pfx)
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;
switch (dil) {
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;
case DIL_LOADED:
fmt = "Loaded debug information from %s '%s' (0x%08x)\n";
fmt = "Loaded debug information from %s '%s' (%p)\n";
break;
case DIL_NOINFO:
fmt = "No debug information in %s '%s' (0x%08x)\n";
fmt = "No debug information in %s '%s' (%p)\n";
break;
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;
default:
DEBUG_Printf(DBG_CHN_ERR, "Oooocch (%d)\n", dil);
......
......@@ -95,7 +95,7 @@
typedef struct tagELF_DBG_INFO
{
unsigned long elf_addr;
void *elf_addr;
} ELF_DBG_INFO;
struct stab_nlist {
......@@ -862,7 +862,7 @@ DEBUG_ParseStabType(const char * stab)
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 strtaboff, int strtablen)
{
......@@ -957,7 +957,7 @@ enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset,
*/
new_value.addr.seg = 0;
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;
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.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;
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.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;
/*
* 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.
*/
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)
{
char * curfile = NULL;
......@@ -1242,7 +1242,7 @@ static int DEBUG_ProcessElfSymtab(DBG_MODULE* module, char* addr,
new_value.type = NULL;
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;
flags = SYM_WINE | ((ELF32_ST_TYPE(symp->st_info) == STT_FUNC)
? SYM_FUNC : SYM_DATA);
......@@ -1375,7 +1375,7 @@ enum DbgInfoLoad DEBUG_LoadElfStabs(DBG_MODULE* module)
* 1 on success
*/
static enum DbgInfoLoad DEBUG_ProcessElfFile(const char* filename,
unsigned int load_offset,
void *load_offset,
unsigned int* dyn_addr)
{
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.
*/
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;
......@@ -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);
if (!module) {
dil = DIL_ERROR;
......@@ -1474,7 +1474,7 @@ static enum DbgInfoLoad DEBUG_ProcessElfFile(const char* filename,
}
static enum DbgInfoLoad DEBUG_ProcessElfFileFromPath(const char * filename,
unsigned int load_offset,
void *load_offset,
unsigned int* dyn_addr,
const char* path)
{
......@@ -1503,7 +1503,7 @@ static enum DbgInfoLoad DEBUG_ProcessElfFileFromPath(const char * filename,
}
static enum DbgInfoLoad DEBUG_ProcessElfObject(const char* filename,
unsigned int load_offset,
void *load_offset,
unsigned int* dyn_addr)
{
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)
{
u_long lm_addr;
void *lm_addr;
struct link_map lm;
Elf32_Ehdr ehdr;
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
* does.
*/
for (lm_addr = (u_long)dbg_hdr->r_map; lm_addr; lm_addr = (u_long)lm.l_next) {
if (!DEBUG_READ_MEM_VERBOSE((void*)lm_addr, &lm, sizeof(lm)))
for (lm_addr = (void *)dbg_hdr->r_map; lm_addr; lm_addr = (void *)lm.l_next) {
if (!DEBUG_READ_MEM_VERBOSE(lm_addr, &lm, sizeof(lm)))
return FALSE;
if (lm.l_addr != 0 &&
......@@ -1551,7 +1551,7 @@ static BOOL DEBUG_WalkList(struct r_debug* dbg_hdr)
lm.l_name != NULL &&
DEBUG_READ_MEM_VERBOSE((void*)lm.l_name, bufstr, sizeof(bufstr))) {
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;
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) {
DBG_VALUE value;
......
......@@ -761,7 +761,7 @@ static BOOL DEBUG_HandleDebugEvent(DEBUG_EVENT* de)
} while (0);
DEBUG_LoadModule32(DEBUG_CurrProcess->imageName, de->u.CreateProcessInfo.hFile,
(DWORD)de->u.CreateProcessInfo.lpBaseOfImage);
de->u.CreateProcessInfo.lpBaseOfImage);
break;
......@@ -813,7 +813,7 @@ static BOOL DEBUG_HandleDebugEvent(DEBUG_EVENT* de)
de->u.LoadDll.dwDebugInfoFileOffset,
de->u.LoadDll.nDebugInfoSize);
_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();
if (DBG_IVAR(BreakOnDllLoad))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment