@@ -124,6 +124,8 @@ static void create_PRUNTIME_FUNCTION(uint8_t *Code, size_t Size, StringRef fnnam
124
124
tbl->BeginAddress = (DWORD)(Code - Section);
125
125
tbl->EndAddress = (DWORD)(Code - Section + Size);
126
126
tbl->UnwindData = (DWORD)(UnwindData - Section);
127
+ assert (Code >= Section && Code + Size <= Section + Allocated);
128
+ assert (UnwindData >= Section && UnwindData <= Section + Allocated);
127
129
#else // defined(_CPU_X86_64_)
128
130
Section += (uintptr_t )Code;
129
131
mod_size = Size;
@@ -265,20 +267,13 @@ class JITObjectRegistry
265
267
uint8_t *catchjmp = NULL ;
266
268
for (const object::SymbolRef &sym_iter : Object.symbols ()) {
267
269
StringRef sName = cantFail (sym_iter.getName ());
268
- uint8_t **pAddr = NULL ;
269
- if (sName .equals (" __UnwindData" )) {
270
- pAddr = &UnwindData;
271
- }
272
- else if (sName .equals (" __catchjmp" )) {
273
- pAddr = &catchjmp;
274
- }
275
- if (pAddr) {
270
+ if (sName .equals (" __UnwindData" ) || sName .equals (" __catchjmp" )) {
276
271
uint64_t Addr = cantFail (sym_iter.getAddress ());
277
272
auto Section = cantFail (sym_iter.getSection ());
278
273
assert (Section != EndSection && Section->isText ());
279
274
uint64_t SectionAddr = Section->getAddress ();
280
- sName = cantFail (Section->getName ());
281
- uint64_t SectionLoadAddr = getLoadAddress (sName );
275
+ StringRef secName = cantFail (Section->getName ());
276
+ uint64_t SectionLoadAddr = getLoadAddress (secName );
282
277
assert (SectionLoadAddr);
283
278
if (SectionAddrCheck) // assert that all of the Sections are at the same location
284
279
assert (SectionAddrCheck == SectionAddr &&
@@ -288,8 +283,13 @@ class JITObjectRegistry
288
283
SectionWriteCheck = SectionLoadAddr;
289
284
if (lookupWriteAddress)
290
285
SectionWriteCheck = (uintptr_t )lookupWriteAddress ((void *)SectionLoadAddr);
291
- Addr += SectionWriteCheck - SectionLoadAddr;
292
- *pAddr = (uint8_t *)Addr;
286
+ Addr += SectionWriteCheck - SectionLoadCheck;
287
+ if (sName .equals (" __UnwindData" )) {
288
+ UnwindData = (uint8_t *)Addr;
289
+ }
290
+ else if (sName .equals (" __catchjmp" )) {
291
+ catchjmp = (uint8_t *)Addr;
292
+ }
293
293
}
294
294
}
295
295
assert (catchjmp);
@@ -312,6 +312,7 @@ class JITObjectRegistry
312
312
UnwindData[6 ] = 1 ; // first instruction
313
313
UnwindData[7 ] = 0x50 ; // push RBP
314
314
*(DWORD*)&UnwindData[8 ] = (DWORD)(catchjmp - (uint8_t *)SectionWriteCheck); // relative location of catchjmp
315
+ UnwindData -= SectionWriteCheck - SectionLoadCheck;
315
316
#endif // defined(_OS_X86_64_)
316
317
#endif // defined(_OS_WINDOWS_)
317
318
@@ -1099,6 +1100,7 @@ static int jl_getDylibFunctionInfo(jl_frame_t **frames, size_t pointer, int skip
1099
1100
static IMAGEHLP_LINE64 frame_info_line;
1100
1101
DWORD dwDisplacement = 0 ;
1101
1102
uv_mutex_lock (&jl_in_stackwalk);
1103
+ jl_refresh_dbg_module_list ();
1102
1104
DWORD64 dwAddress = pointer;
1103
1105
frame_info_line.SizeOfStruct = sizeof (IMAGEHLP_LINE64);
1104
1106
if (SymGetLineFromAddr64 (GetCurrentProcess (), dwAddress, &dwDisplacement, &frame_info_line)) {
0 commit comments