Skip to content

Commit aeee892

Browse files
authored
ISOSDacInterface::GetMethodDescName use proper path separator in cross-dac scenarios (#116981)
* use TARGET_* OS specific path separator
1 parent e2c99a9 commit aeee892

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/coreclr/debug/daccess/request.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,16 @@ ClrDataAccess::GetMethodDescName(CLRDATA_ADDRESS methodDesc, unsigned int count,
14881488
nChars > 0 && nChars <= ARRAY_SIZE(path))
14891489
{
14901490
WCHAR* pFile = path + nChars - 1;
1491-
while ((pFile >= path) && (*pFile != DIRECTORY_SEPARATOR_CHAR_W))
1491+
1492+
// PAL DIRECTORY_SEPARATOR_CHAR_W defines are based on the host platform.
1493+
// Here, the directory separator depends on the target platform, not the host platform
1494+
// in order to accommodate cross dac scenarios.
1495+
#ifdef TARGET_WINDOWS
1496+
WCHAR directorySeparatorChar = W('\\');
1497+
#else
1498+
WCHAR directorySeparatorChar = W('/');
1499+
#endif // TARGET_WINDOWS
1500+
while ((pFile >= path) && (*pFile != directorySeparatorChar))
14921501
{
14931502
pFile--;
14941503
}

0 commit comments

Comments
 (0)