Browse Source

Added some debug output which helped in finding the problems on WinCE.

git-svn-id: branches/svenbarth/collector@17275 -
svenbarth 14 years ago
parent
commit
4d3d820710
1 changed files with 13 additions and 1 deletions
  1. 13 1
      rtl/win/systhrd.inc

+ 13 - 1
rtl/win/systhrd.inc

@@ -293,6 +293,11 @@ var
     var
     var
       entry: PExternalThreadInfo;
       entry: PExternalThreadInfo;
     begin
     begin
+{$ifdef debug_collector}
+      WritelnDirect('Registering new thread with data area $' +
+        hexstr(aDataArea));
+{$endif}
+
       SysEnterCriticalSection(RegisterExternalLock);
       SysEnterCriticalSection(RegisterExternalLock);
       if not ExternalThreadsDetected then begin
       if not ExternalThreadsDetected then begin
         { from now on we are running in external thread mode }
         { from now on we are running in external thread mode }
@@ -307,12 +312,19 @@ var
       { we must not use FPC's heap, because the memory would be allocated in the
       { we must not use FPC's heap, because the memory would be allocated in the
         external thread's context which is not what we want }
         external thread's context which is not what we want }
       entry := Pointer(LocalAlloc(LMEM_FIXED, SizeOf(TExternalThreadInfo)));
       entry := Pointer(LocalAlloc(LMEM_FIXED, SizeOf(TExternalThreadInfo)));
-      if entry = nil then
+      if entry = nil then begin
+{$ifdef debug_collector}
+        WritelnDirect('Local alloc failed');
+{$endif}
         { oh damn }
         { oh damn }
         Exit;
         Exit;
+      end;
 
 
       if not DuplicateHandle(GetCurrentProcess, aThread, GetCurrentProcess,
       if not DuplicateHandle(GetCurrentProcess, aThread, GetCurrentProcess,
           entry^.Handle, 0, False, DUPLICATE_SAME_ACCESS) then begin
           entry^.Handle, 0, False, DUPLICATE_SAME_ACCESS) then begin
+{$ifdef debug_collector}
+        WritelnDirect('DuplicateHandle failed');
+{$endif}
         { oh damn 2nd }
         { oh damn 2nd }
         LocalFree(entry);
         LocalFree(entry);
         Exit;
         Exit;