Skip to content

Commit 387cfc2

Browse files
authored
Merge pull request dotnet#19652 from hoyosjs/dev/arm-stepping-fix-2.1
[release/2.1] Arm stepping fix
2 parents e9fbe02 + eae0a38 commit 387cfc2

File tree

9 files changed

+19
-20
lines changed

9 files changed

+19
-20
lines changed

src/debug/ee/controller.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6319,8 +6319,8 @@ void DebuggerStepper::TrapStepOut(ControllerStackInfo *info, bool fForceTraditio
63196319
_ASSERTE(IsCloserToLeaf(dbgLastFP, info->m_activeFrame.fp));
63206320
#endif
63216321

6322-
#ifdef FEATURE_STUBS_AS_IL
6323-
if (info->m_activeFrame.md->IsILStub() && info->m_activeFrame.md->AsDynamicMethodDesc()->IsMulticastStub())
6322+
#ifdef FEATURE_MULTICASTSTUB_AS_IL
6323+
if (info->m_activeFrame.md != nullptr && info->m_activeFrame.md->IsILStub() && info->m_activeFrame.md->AsDynamicMethodDesc()->IsMulticastStub())
63246324
{
63256325
LOG((LF_CORDB, LL_INFO10000,
63266326
"DS::TSO: multicast frame.\n"));
@@ -6347,7 +6347,7 @@ void DebuggerStepper::TrapStepOut(ControllerStackInfo *info, bool fForceTraditio
63476347
break;
63486348
}
63496349
else
6350-
#endif // FEATURE_STUBS_AS_IL
6350+
#endif // FEATURE_MULTICASTSTUB_AS_IL
63516351
if (info->m_activeFrame.managed)
63526352
{
63536353
LOG((LF_CORDB, LL_INFO10000,

src/debug/ee/debugger.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3221,10 +3221,7 @@ CodeRegionInfo CodeRegionInfo::GetCodeRegionInfo(DebuggerJitInfo *dji, MethodDes
32213221

32223222
if (addr)
32233223
{
3224-
PCODE pCode = (PCODE)dac_cast<TADDR>(addr);
3225-
#ifdef _TARGET_ARM_
3226-
pCode |= THUMB_CODE;
3227-
#endif
3224+
PCODE pCode = PINSTRToPCODE(dac_cast<TADDR>(addr));
32283225
codeRegionInfo.InitializeFromStartAddress(pCode);
32293226
}
32303227

@@ -11118,7 +11115,7 @@ bool Debugger::HandleIPCEvent(DebuggerIPCEvent * pEvent)
1111811115
// In the EnC case, if we look for an older version, we need to find the DJI by starting
1111911116
// address, rather than just by MethodDesc. In the case of generics, we may need to create a DJI, so we
1112011117
pDJI = pDMI->FindOrCreateInitAndAddJitInfo(pEvent->SetIP.vmMethodDesc.GetRawPtr(),
11121-
(TADDR)pEvent->SetIP.startAddress);
11118+
PINSTRToPCODE((TADDR)pEvent->SetIP.startAddress));
1112211119
}
1112311120

1112411121
if ((pDJI != NULL) && (pThread != NULL) && (pModule != NULL))

src/debug/ee/debugger.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,7 @@ class CodeRegionInfo
13241324
{
13251325
LIMITED_METHOD_CONTRACT;
13261326

1327-
PCODE address = (PCODE)addr;
1327+
PCODE address = PINSTRToPCODE((TADDR)addr);
13281328

13291329
if ((address >= m_addrOfHotCode) &&
13301330
(address < m_addrOfHotCode + m_sizeOfHotCode))
@@ -1346,7 +1346,7 @@ class CodeRegionInfo
13461346
{
13471347
LIMITED_METHOD_CONTRACT;
13481348

1349-
PCODE address = (PCODE)addr;
1349+
PCODE address = PINSTRToPCODE((TADDR)addr);
13501350
return (((address >= m_addrOfHotCode) &&
13511351
(address < m_addrOfHotCode + m_sizeOfHotCode)) ||
13521352
((address >= m_addrOfColdCode) &&

src/debug/ee/frameinfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1563,7 +1563,7 @@ StackWalkAction DebuggerWalkStackProc(CrawlFrame *pCF, void *data)
15631563
// The only exception is dynamic methods. We want to report them when SIS is turned on.
15641564
if ((md != NULL) && md->IsILStub() && pCF->IsFrameless())
15651565
{
1566-
#ifdef FEATURE_STUBS_AS_IL
1566+
#ifdef FEATURE_MULTICASTSTUB_AS_IL
15671567
if(md->AsDynamicMethodDesc()->IsMulticastStub())
15681568
{
15691569
use = true;

src/debug/ee/functioninfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,7 @@ void DebuggerJitInfo::Init(TADDR newAddress)
12281228
this->m_addrOfCode = (ULONG_PTR)PTR_TO_CORDB_ADDRESS((BYTE*) newAddress);
12291229
this->m_jitComplete = true;
12301230

1231-
this->m_codeRegionInfo.InitializeFromStartAddress((PCODE)this->m_addrOfCode);
1231+
this->m_codeRegionInfo.InitializeFromStartAddress(PINSTRToPCODE((TADDR)this->m_addrOfCode));
12321232
this->m_sizeOfCode = this->m_codeRegionInfo.getSizeOfTotalCode();
12331233

12341234
this->m_encVersion = this->m_methodInfo->GetCurrentEnCVersion();
@@ -1586,6 +1586,7 @@ DebuggerJitInfo *DebuggerMethodInfo::FindOrCreateInitAndAddJitInfo(MethodDesc* f
15861586
//
15871587
// We haven't got the lock yet so we'll repeat this lookup once
15881588
// we've taken the lock.
1589+
ARM_ONLY(_ASSERTE((startAddr & THUMB_CODE) == 1));
15891590
DebuggerJitInfo * pResult = FindJitInfo(fd, startAddr);
15901591
if (pResult != NULL)
15911592
{

src/inc/daccess.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2414,7 +2414,7 @@ typedef DPTR(RUNTIME_FUNCTION) PTR_RUNTIME_FUNCTION;
24142414
//----------------------------------------------------------------------------
24152415
//
24162416
// A PCODE is a valid PC/IP value -- a pointer to an instruction, possibly including some processor mode bits.
2417-
// (On ARM, for example, a PCODE value should should have the low-order THUMB_CODE bit set if the code should
2417+
// (On ARM, for example, a PCODE value should have the low-order THUMB_CODE bit set if the code should
24182418
// be executed in that mode.)
24192419
//
24202420
typedef TADDR PCODE;

src/vm/codeman.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4166,7 +4166,7 @@ PCODE ExecutionManager::GetCodeStartAddress(PCODE currentPC)
41664166
EECodeInfo codeInfo(currentPC);
41674167
if (!codeInfo.IsValid())
41684168
return NULL;
4169-
return (PCODE)codeInfo.GetStartAddress();
4169+
return PINSTRToPCODE(codeInfo.GetStartAddress());
41704170
}
41714171

41724172
//**************************************************************************

src/vm/comdelegate.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2448,6 +2448,12 @@ FCIMPL1(PCODE, COMDelegate::GetMulticastInvoke, Object* refThisIn)
24482448
//Label_nextDelegate:
24492449
pCode->EmitLabel(nextDelegate);
24502450

2451+
#ifdef DEBUGGING_SUPPORTED
2452+
pCode->EmitLoadThis();
2453+
pCode->EmitLDLOC(dwLoopCounterNum);
2454+
pCode->EmitCALL(METHOD__STUBHELPERS__MULTICAST_DEBUGGER_TRACE_HELPER, 2, 0);
2455+
#endif // DEBUGGING_SUPPORTED
2456+
24512457
// compare LoopCounter with InvocationCount. If equal then branch to Label_endOfMethod
24522458
pCode->EmitLDLOC(dwLoopCounterNum);
24532459
pCode->EmitLDLOC(dwInvocationCountNum);
@@ -2477,11 +2483,6 @@ FCIMPL1(PCODE, COMDelegate::GetMulticastInvoke, Object* refThisIn)
24772483
pCode->EmitADD();
24782484
pCode->EmitSTLOC(dwLoopCounterNum);
24792485

2480-
#ifdef DEBUGGING_SUPPORTED
2481-
pCode->EmitLoadThis();
2482-
pCode->EmitLDLOC(dwLoopCounterNum);
2483-
pCode->EmitCALL(METHOD__STUBHELPERS__MULTICAST_DEBUGGER_TRACE_HELPER, 2, 0);
2484-
#endif // DEBUGGING_SUPPORTED
24852486

24862487
// branch to next delegate
24872488
pCode->EmitBR(nextDelegate);

src/vm/stubmgr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ class StubManagerHelpers
976976
Thread::VirtualUnwindCallFrame(&context);
977977
Thread::VirtualUnwindCallFrame(&context);
978978

979-
return pContext->Rip;
979+
return context.Rip;
980980
#elif defined(_TARGET_ARM_)
981981
return *((PCODE *)pContext->R11 + 1);
982982
#elif defined(_TARGET_ARM64_)

0 commit comments

Comments
 (0)