Changeset 1019 for trunk/dll/fortify.c
- Timestamp:
- May 26, 2008, 11:02:41 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/fortify.c
r1015 r1019 42 42 43 43 /* 06 May 08 SHL Rework scope logic to be MT capable 44 26 May 08 SHL Show TID for leaking scope 44 45 */ 45 46 … … 66 67 #define MT_SCOPES 1 67 68 unsigned long Get_TID_Ordinal(void); 69 // Get tib_ptib2 from TIB 70 // Get thread id from TIB2 68 71 #pragma aux Get_TID_Ordinal = \ 69 "mov eax, far ptr fs:[0x14]" \ 70 modify exact [eax] \ 72 "mov ebx, fs:[0xc]" \ 73 "mov eax, [ebx+0]" \ 74 modify exact [eax ebx] \ 71 75 value [eax] 72 76 #endif … … 252 256 253 257 #ifdef MT_SCOPES 254 unsigned shortordinal;258 unsigned ordinal; 255 259 #endif 256 260 … … 686 690 #ifdef MT_SCOPES 687 691 ordinal = Get_TID_Ordinal(); 688 if (ordinal < st_cScopes && st_pScopes[ordinal] > 0)692 if (ordinal < st_cScopes && st_pScopes[ordinal] > 0) 689 693 #else 690 694 if(st_Scope > 0) … … 1004 1008 1005 1009 #ifdef MT_SCOPES 1006 // 06 May 08 SHL fixme to complain to leave without enter1010 // Complain on leave without enter 06 May 08 SHL 1007 1011 ordinal = Get_TID_Ordinal(); 1008 1012 if (ordinal < st_cScopes && st_pScopes[ordinal] > 0) 1009 1013 st_pScopes[ordinal]--; 1010 1014 else { 1011 sprintf(st_Buffer, "\nFortify: attempting to leave scope before enter at %s.%lu\n", file, line); 1015 sprintf(st_Buffer, 1016 "\nFortify: attempting to leave scope before enter at %s.%lu in TID %u\n", 1017 file, line, ordinal); // 26 May 08 SHL 1012 1018 st_Output(st_Buffer); 1013 1019 } … … 1031 1037 { 1032 1038 // Report just first occurrance 1039 #ifdef MT_SCOPES 1040 sprintf(st_Buffer, 1041 "\nFortify: Memory leak detected leaving scope at %s.%lu in TID %u\n", 1042 file, line, ordinal); 1043 #else 1033 1044 sprintf(st_Buffer, "\nFortify: Memory leak detected leaving scope at %s.%lu\n", file, line); 1045 #endif 1034 1046 st_Output(st_Buffer); 1035 1047 sprintf(st_Buffer, "%10s %8s %s\n", "Address", "Size", "Allocator"); … … 1680 1692 unsigned long FreedBlocks = 0; 1681 1693 #ifdef MT_SCOPES 1682 unsigned shortordinal = Get_TID_Ordinal();1694 unsigned ordinal = Get_TID_Ordinal(); 1683 1695 #endif 1684 1696
Note:
See TracChangeset
for help on using the changeset viewer.