Removed the .xcnlnk section hack, and replaced it by another hack in
the debugger CREATE_PROCESS event handling.
This commit is contained in:
parent
27b790b4a6
commit
291fa66f9d
|
@ -1715,8 +1715,8 @@ int DEBUG_RegisterStabsDebugInfo(DBG_MODULE* module, HANDLE hFile, void* _nth,
|
||||||
{
|
{
|
||||||
IMAGE_SECTION_HEADER pe_seg;
|
IMAGE_SECTION_HEADER pe_seg;
|
||||||
unsigned long pe_seg_ofs;
|
unsigned long pe_seg_ofs;
|
||||||
int i, stabsize = 0, stabstrsize = 0, xcnlnksize = 0;
|
int i, stabsize = 0, stabstrsize = 0;
|
||||||
unsigned int stabs = 0, stabstr = 0, xcnlnk = 0;
|
unsigned int stabs = 0, stabstr = 0;
|
||||||
PIMAGE_NT_HEADERS nth = (PIMAGE_NT_HEADERS)_nth;
|
PIMAGE_NT_HEADERS nth = (PIMAGE_NT_HEADERS)_nth;
|
||||||
|
|
||||||
pe_seg_ofs = nth_ofs + OFFSET_OF(IMAGE_NT_HEADERS, OptionalHeader) +
|
pe_seg_ofs = nth_ofs + OFFSET_OF(IMAGE_NT_HEADERS, OptionalHeader) +
|
||||||
|
@ -1733,9 +1733,6 @@ int DEBUG_RegisterStabsDebugInfo(DBG_MODULE* module, HANDLE hFile, void* _nth,
|
||||||
} else if (!strncasecmp(pe_seg.Name, ".stabstr", 8)) {
|
} else if (!strncasecmp(pe_seg.Name, ".stabstr", 8)) {
|
||||||
stabstr = pe_seg.VirtualAddress;
|
stabstr = pe_seg.VirtualAddress;
|
||||||
stabstrsize = pe_seg.SizeOfRawData;
|
stabstrsize = pe_seg.SizeOfRawData;
|
||||||
} else if (!strncasecmp(pe_seg.Name, ".xcnlnk", 7)) {
|
|
||||||
xcnlnk = pe_seg.VirtualAddress;
|
|
||||||
xcnlnksize = pe_seg.SizeOfRawData;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1756,18 +1753,6 @@ int DEBUG_RegisterStabsDebugInfo(DBG_MODULE* module, HANDLE hFile, void* _nth,
|
||||||
stabsize + stabstrsize);
|
stabsize + stabstrsize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (xcnlnksize) {
|
|
||||||
DWORD addr;
|
|
||||||
char bufstr[256];
|
|
||||||
|
|
||||||
if (DEBUG_READ_MEM_VERBOSE((char*)module->load_addr + xcnlnk, &addr,
|
|
||||||
sizeof(addr)) &&
|
|
||||||
DEBUG_READ_MEM_VERBOSE((char*)addr, bufstr, sizeof(bufstr))) {
|
|
||||||
bufstr[sizeof(bufstr) - 1] = 0;
|
|
||||||
DEBUG_Printf(DBG_CHN_TRACE, "Got xcnlnk: argv0 '%s'\n", bufstr);
|
|
||||||
DEBUG_ReadExecutableDbgInfo(bufstr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "process.h"
|
#include "process.h"
|
||||||
|
#include "file.h"
|
||||||
#include "wincon.h"
|
#include "wincon.h"
|
||||||
#include "wingdi.h"
|
#include "wingdi.h"
|
||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
|
@ -479,9 +480,32 @@ static BOOL DEBUG_HandleDebugEvent(DEBUG_EVENT* de, LPDWORD cont)
|
||||||
|
|
||||||
DEBUG_InitCurrProcess();
|
DEBUG_InitCurrProcess();
|
||||||
DEBUG_InitCurrThread();
|
DEBUG_InitCurrThread();
|
||||||
/* so far, process name is not set */
|
|
||||||
DEBUG_LoadModule32("<Debugged process>", de->u.CreateProcessInfo.hFile,
|
DEBUG_ProcessGetStringIndirect(buffer, sizeof(buffer),
|
||||||
|
DEBUG_CurrThread->process->handle,
|
||||||
|
de->u.CreateProcessInfo.lpImageName);
|
||||||
|
DEBUG_LoadModule32(buffer[0] ? buffer : "<Debugged process>",
|
||||||
|
de->u.CreateProcessInfo.hFile,
|
||||||
(DWORD)de->u.CreateProcessInfo.lpBaseOfImage);
|
(DWORD)de->u.CreateProcessInfo.lpBaseOfImage);
|
||||||
|
|
||||||
|
if (buffer[0]) /* we got a process name */
|
||||||
|
{
|
||||||
|
DWORD type;
|
||||||
|
if (!GetBinaryTypeA( buffer, &type ))
|
||||||
|
{
|
||||||
|
/* not a Windows binary, assume it's a Unix executable then */
|
||||||
|
DOS_FULL_NAME fullname;
|
||||||
|
/* HACK!! should fix DEBUG_ReadExecutableDbgInfo to accept DOS filenames */
|
||||||
|
if (DOSFS_GetFullName( buffer, TRUE, &fullname ))
|
||||||
|
{
|
||||||
|
DEBUG_ReadExecutableDbgInfo( fullname.long_name );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* if it is a Windows binary, or an invalid or missing file name,
|
||||||
|
* we use wine itself as the main executable */
|
||||||
|
DEBUG_ReadExecutableDbgInfo( "wine" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXIT_THREAD_DEBUG_EVENT:
|
case EXIT_THREAD_DEBUG_EVENT:
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include "winerror.h"
|
#include "winerror.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "debugtools.h"
|
#include "debugtools.h"
|
||||||
#include "options.h" /* for argv0 */
|
|
||||||
|
|
||||||
DEFAULT_DEBUG_CHANNEL(module);
|
DEFAULT_DEBUG_CHANNEL(module);
|
||||||
DECLARE_DEBUG_CHANNEL(relay);
|
DECLARE_DEBUG_CHANNEL(relay);
|
||||||
|
@ -146,23 +145,16 @@ static HMODULE BUILTIN32_DoLoadImage( const BUILTIN32_DESCRIPTOR *descr )
|
||||||
IMAGE_EXPORT_DIRECTORY *exports = descr->exports;
|
IMAGE_EXPORT_DIRECTORY *exports = descr->exports;
|
||||||
INT i, size, nb_sections;
|
INT i, size, nb_sections;
|
||||||
BYTE *addr, *code_start, *data_start;
|
BYTE *addr, *code_start, *data_start;
|
||||||
BYTE* xcnlnk;
|
|
||||||
DWORD xcnsize = 0;
|
|
||||||
int page_size = VIRTUAL_GetPageSize();
|
int page_size = VIRTUAL_GetPageSize();
|
||||||
|
|
||||||
/* Allocate the module */
|
/* Allocate the module */
|
||||||
|
|
||||||
nb_sections = 2; /* code + data */
|
nb_sections = 2; /* code + data */
|
||||||
|
|
||||||
if (!strcmp(descr->filename, "kernel32.dll")) {
|
|
||||||
nb_sections++;
|
|
||||||
xcnsize = sizeof(DWORD);
|
|
||||||
}
|
|
||||||
size = (sizeof(IMAGE_DOS_HEADER)
|
size = (sizeof(IMAGE_DOS_HEADER)
|
||||||
+ sizeof(IMAGE_NT_HEADERS)
|
+ sizeof(IMAGE_NT_HEADERS)
|
||||||
+ nb_sections * sizeof(IMAGE_SECTION_HEADER)
|
+ nb_sections * sizeof(IMAGE_SECTION_HEADER)
|
||||||
+ (descr->nb_imports+1) * sizeof(IMAGE_IMPORT_DESCRIPTOR)
|
+ (descr->nb_imports+1) * sizeof(IMAGE_IMPORT_DESCRIPTOR));
|
||||||
+ xcnsize);
|
|
||||||
|
|
||||||
assert( size <= page_size );
|
assert( size <= page_size );
|
||||||
|
|
||||||
|
@ -184,7 +176,6 @@ static HMODULE BUILTIN32_DoLoadImage( const BUILTIN32_DESCRIPTOR *descr )
|
||||||
nt = (IMAGE_NT_HEADERS *)(dos + 1);
|
nt = (IMAGE_NT_HEADERS *)(dos + 1);
|
||||||
sec = (IMAGE_SECTION_HEADER *)(nt + 1);
|
sec = (IMAGE_SECTION_HEADER *)(nt + 1);
|
||||||
imp = (IMAGE_IMPORT_DESCRIPTOR *)(sec + nb_sections);
|
imp = (IMAGE_IMPORT_DESCRIPTOR *)(sec + nb_sections);
|
||||||
xcnlnk = (char *)(imp + descr->nb_imports + 1);
|
|
||||||
code_start = addr + page_size;
|
code_start = addr + page_size;
|
||||||
|
|
||||||
/* HACK! */
|
/* HACK! */
|
||||||
|
@ -258,23 +249,6 @@ static HMODULE BUILTIN32_DoLoadImage( const BUILTIN32_DESCRIPTOR *descr )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build Wine's .so link section. Those sections are used by the wine debugger to
|
|
||||||
* link a builtin PE header with the corresponding ELF module (from either a
|
|
||||||
* shared library, or the main executable - wine emulator or any winelib program
|
|
||||||
*/
|
|
||||||
if (xcnsize)
|
|
||||||
{
|
|
||||||
strcpy( sec->Name, ".xcnlnk" );
|
|
||||||
sec->Misc.VirtualSize = xcnsize;
|
|
||||||
sec->VirtualAddress = (BYTE *)xcnlnk - addr;
|
|
||||||
sec->SizeOfRawData = sec->Misc.VirtualSize;
|
|
||||||
sec->PointerToRawData = (BYTE *)xcnlnk - addr;
|
|
||||||
sec->Characteristics = (IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ);
|
|
||||||
sec++;
|
|
||||||
|
|
||||||
*(const char**)xcnlnk = argv0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Build the resource directory */
|
/* Build the resource directory */
|
||||||
|
|
||||||
if (descr->rsrc)
|
if (descr->rsrc)
|
||||||
|
|
Loading…
Reference in New Issue