Skip to content

Commit fd03cb5

Browse files
committed
Fix another error in backport of #37101 impacting Windows.
1 parent 7285f71 commit fd03cb5

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/debuginfo.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,3 +1695,21 @@ uint64_t jl_getUnwindInfo(uint64_t dwAddr)
16951695
uv_rwlock_rdunlock(&threadsafe);
16961696
return ipstart;
16971697
}
1698+
1699+
extern "C"
1700+
uint64_t jl_trygetUnwindInfo(uint64_t dwAddr)
1701+
{
1702+
// Might be called from unmanaged thread
1703+
Optional<std::map<size_t, ObjectInfo, revcomp>*> maybeobjmap = jl_jit_events->trygetObjectMap();
1704+
if (maybeobjmap) {
1705+
std::map<size_t, ObjectInfo, revcomp> &objmap = **maybeobjmap;
1706+
std::map<size_t, ObjectInfo, revcomp>::iterator it = objmap.lower_bound(dwAddr);
1707+
uint64_t ipstart = 0; // ip of the start of the section (if found)
1708+
if (it != objmap.end() && dwAddr < it->first + it->second.SectionSize) {
1709+
ipstart = (uint64_t)(uintptr_t)(*it).first;
1710+
}
1711+
uv_rwlock_rdunlock(&threadsafe);
1712+
return ipstart;
1713+
}
1714+
return 0;
1715+
}

src/julia_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,7 @@ typedef struct {
758758

759759
// Might be called from unmanaged thread
760760
uint64_t jl_getUnwindInfo(uint64_t dwBase);
761+
uint64_t jl_trygetUnwindInfo(uint64_t dwBase);
761762
#ifdef _OS_WINDOWS_
762763
#include <dbghelp.h>
763764
JL_DLLEXPORT EXCEPTION_DISPOSITION __julia_personality(

0 commit comments

Comments
 (0)