Skip to content

Commit aae4cb2

Browse files
Use ClrMd to fill in stack frame text.
This is mostly just a display workaround until we use ClrMd to synthesize a DbgModuleInfo instead.
1 parent 634a63c commit aae4cb2

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

DbgProvider/public/Debugger/DbgManagedFunction.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public override DbgModuleInfo Module
2323
{
2424
using( new DbgEngContextSaver( Debugger, Context ) )
2525
{
26-
// TODO: this might not work for a managed module with public dbgeng...
27-
// could we query clrmd or something? To see the point of failure,
28-
// search for 8b09cd08-2fb1-4f51-902f-bdd6f967b105
26+
// TODO: this won't work for a managed module... we should use ClrMd
27+
// to synthesize a DbgModuleInfo.
28+
// https://github.com/Microsoft/DbgShell/issues/35
2929
return Debugger.GetModuleByAddress( m_clrMethod.Type.Module.ImageBase );
3030
}
3131
}

DbgProvider/public/Debugger/DbgModuleInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,9 +429,9 @@ private static DEBUG_MODULE_PARAMETERS _GetModParamsByAddress( DbgEngDebugger de
429429
uint index;
430430
ulong baseAddr;
431431

432-
// TODO: this might not work for a managed module with public dbgeng...
433-
// could we query clrmd or something? This is the actual point of
434-
// failure, c.f. 8b09cd08-2fb1-4f51-902f-bdd6f967b105
432+
// TODO: If it's a managed module, this will fail. We could use
433+
// ClrMd to synthesize this DbgModule instead.
434+
// https://github.com/Microsoft/DbgShell/issues/35
435435
StaticCheckHr( ds.GetModuleByOffset2( addressInModule,
436436
0, // start index
437437
DEBUG_GETMOD.DEFAULT,

DbgProvider/public/Debugger/DbgStackFrameInfo.cs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,26 @@ public override string ToString()
329329

330330
try
331331
{
332-
if( Displacement == 0 )
333-
return SymbolName;
334-
else
335-
return Util.Sprintf( "{0}+0x{1:x}", SymbolName, Displacement );
332+
string disp = String.Empty;
333+
334+
if( Displacement != 0 )
335+
{
336+
disp = "+0x" + Displacement.ToString( "x" );
337+
}
338+
339+
if( null != ManagedFrame )
340+
{
341+
// TODO: Ideally we wouldn't deal with this at this layer; we would
342+
// synthesize a DbgModuleInfo instead. But for now this is a handy
343+
// workaround.
344+
// https://github.com/Microsoft/DbgShell/issues/35
345+
346+
// It seems like dbgeng likes to replace dots in module names with
347+
// underbars... why? I guess I should do the same?
348+
return ManagedFrame.ModuleName.Replace( '.', '_' ) + "!" + ManagedFrame.Method.GetFullSignature() + disp;
349+
}
350+
351+
return SymbolName + disp;
336352
}
337353
catch( DbgProviderException dpe )
338354
{

0 commit comments

Comments
 (0)