Commit b9aa7c9a authored by Ulrich Weigand's avatar Ulrich Weigand Committed by Alexandre Julliard

Bugfix: -debug didn't work anymore after the last startup sequence patch.

parent 999b1b70
...@@ -332,27 +332,25 @@ void DEBUG_InfoBreakpoints(void) ...@@ -332,27 +332,25 @@ void DEBUG_InfoBreakpoints(void)
/*********************************************************************** /***********************************************************************
* DEBUG_AddModuleBreakpoints * DEBUG_AddTaskEntryBreakpoint
* *
* Add a breakpoint at the start of every loaded module. * Add a breakpoint at the entry point of the given task
*/ */
void DEBUG_AddModuleBreakpoints(void) void DEBUG_AddTaskEntryBreakpoint( HTASK16 hTask )
{ {
MODULEENTRY entry; TDB *pTask = (TDB *)GlobalLock16( hTask );
NE_MODULE *pModule; NE_MODULE *pModule;
BOOL32 ok;
DBG_ADDR addr = { NULL, 0, 0 }; DBG_ADDR addr = { NULL, 0, 0 };
WINE_MODREF *wm;
for (ok = ModuleFirst(&entry); ok; ok = ModuleNext(&entry)) if ( pTask )
{ {
if (!(pModule = NE_GetPtr( entry.hModule ))) continue; if (!(pModule = NE_GetPtr( pTask->hModule ))) return;
if (pModule->flags & NE_FFLAGS_LIBMODULE) continue; /* Library */ if (pModule->flags & NE_FFLAGS_LIBMODULE) return; /* Library */
if (pModule->lpDosTask) { /* DOS module */ if (pModule->lpDosTask) { /* DOS module */
addr.seg = pModule->lpDosTask->init_cs | ((DWORD)pModule->self << 16); addr.seg = pModule->lpDosTask->init_cs | ((DWORD)pModule->self << 16);
addr.off = pModule->lpDosTask->init_ip; addr.off = pModule->lpDosTask->init_ip;
fprintf( stderr, "DOS task '%s': ", entry.szModule ); fprintf( stderr, "DOS task '%s': ", NE_MODULE_NAME( pModule ) );
DEBUG_AddBreakpoint( &addr ); DEBUG_AddBreakpoint( &addr );
} else } else
if (!(pModule->flags & NE_FFLAGS_WIN32)) /* NE module */ if (!(pModule->flags & NE_FFLAGS_WIN32)) /* NE module */
...@@ -360,31 +358,15 @@ void DEBUG_AddModuleBreakpoints(void) ...@@ -360,31 +358,15 @@ void DEBUG_AddModuleBreakpoints(void)
addr.seg = addr.seg =
GlobalHandleToSel(NE_SEG_TABLE(pModule)[pModule->cs-1].hSeg); GlobalHandleToSel(NE_SEG_TABLE(pModule)[pModule->cs-1].hSeg);
addr.off = pModule->ip; addr.off = pModule->ip;
fprintf( stderr, "Win16 task '%s': ", entry.szModule ); fprintf( stderr, "Win16 task '%s': ", NE_MODULE_NAME( pModule ) );
DEBUG_AddBreakpoint( &addr ); DEBUG_AddBreakpoint( &addr );
} }
else /* PE module */ else /* PE module */
{ {
if (!(wm = PROCESS_Current()->modref_list))
{
addr.seg = 0; addr.seg = 0;
addr.off = (DWORD)RVA_PTR( pModule->module32, addr.off = (DWORD)RVA_PTR( pModule->module32,
OptionalHeader.AddressOfEntryPoint); OptionalHeader.AddressOfEntryPoint);
} fprintf( stderr, "Win32 task '%s': ", NE_MODULE_NAME( pModule ) );
else
{
while (wm)
{
if (wm->module == pModule->module32) break;
wm = wm->next;
}
if (!wm) continue;
addr.seg = 0;
addr.off = (DWORD)RVA_PTR( wm->module,
OptionalHeader.AddressOfEntryPoint);
}
fprintf( stderr, "Win32 task '%s': ", entry.szModule );
DEBUG_AddBreakpoint( &addr ); DEBUG_AddBreakpoint( &addr );
} }
} }
......
...@@ -152,7 +152,7 @@ extern void DEBUG_AddBreakpoint( const DBG_ADDR *addr ); ...@@ -152,7 +152,7 @@ extern void DEBUG_AddBreakpoint( const DBG_ADDR *addr );
extern void DEBUG_DelBreakpoint( int num ); extern void DEBUG_DelBreakpoint( int num );
extern void DEBUG_EnableBreakpoint( int num, BOOL32 enable ); extern void DEBUG_EnableBreakpoint( int num, BOOL32 enable );
extern void DEBUG_InfoBreakpoints(void); extern void DEBUG_InfoBreakpoints(void);
extern void DEBUG_AddModuleBreakpoints(void); extern void DEBUG_AddTaskEntryBreakpoint( HTASK16 hTask );
extern BOOL32 DEBUG_HandleTrap(void); extern BOOL32 DEBUG_HandleTrap(void);
extern BOOL32 DEBUG_ShouldContinue( enum exec_mode mode, int * count ); extern BOOL32 DEBUG_ShouldContinue( enum exec_mode mode, int * count );
extern enum exec_mode DEBUG_RestartExecution( enum exec_mode mode, int count ); extern enum exec_mode DEBUG_RestartExecution( enum exec_mode mode, int count );
......
...@@ -144,6 +144,7 @@ typedef struct _THHOOK ...@@ -144,6 +144,7 @@ typedef struct _THHOOK
#pragma pack(4) #pragma pack(4)
extern THHOOK *pThhook; extern THHOOK *pThhook;
extern void (*TASK_AddTaskEntryBreakpoint)( HTASK16 hTask );
extern HTASK16 TASK_Create( struct _THDB *thdb, struct _NE_MODULE *pModule, extern HTASK16 TASK_Create( struct _THDB *thdb, struct _NE_MODULE *pModule,
HINSTANCE16 hInstance, HINSTANCE16 hPrevInstance, HINSTANCE16 hInstance, HINSTANCE16 hPrevInstance,
......
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