Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! [#1349] Always use --simple-values in newer versions of GDB.
  • Loading branch information
gareth-rees committed May 26, 2023
commit 550bcbcca25918cbb94f0ff70874c3c9874b3750
30 changes: 20 additions & 10 deletions src/MIDebugEngine/Engine.Impl/DebuggedProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ internal class DebuggedProcess : MICore.Debugger
private IProcessSequence _childProcessHandler;
private bool _deleteEntryPointBreakpoint;
private string _entryPointBreakpoint = string.Empty;
private bool _simpleValuesExcludesRefTypes = false;
private bool? _simpleValuesExcludesRefTypes = null;

public DebuggedProcess(bool bLaunched, LaunchOptions launchOptions, ISampleEngineCallback callback, WorkerThread worker, BreakpointManager bpman, AD7Engine engine, HostConfigurationStore configStore, HostWaitLoop waitLoop = null) : base(launchOptions, engine.Logger)
{
Expand Down Expand Up @@ -551,8 +551,6 @@ public async Task Initialize(HostWaitLoop waitLoop, CancellationToken token)

try
{
_simpleValuesExcludesRefTypes = await this.MICommandFactory.SupportsSimpleValuesExcludesRefTypes();

await this.MICommandFactory.EnableTargetAsyncOption();

await this.CheckCygwin(_launchOptions as LocalLaunchOptions);
Expand Down Expand Up @@ -1988,13 +1986,25 @@ public async Task<List<SimpleVariableInformation>> GetParameterInfoOnly(AD7Threa
//NOTE: eval is not called
public async Task<List<ArgumentList>> GetParameterInfoOnly(AD7Thread thread, bool values, bool types, uint low, uint high)
{
// If SimpleValues excludes printing values for references to compound types,
// use SimpleValues (even if values are not requested) as it gets types too.
// Otherwise, if values are requested, use SimpleValues, but if not, the
// potential performance penalty of fetching values for references to compound
// types is too high, so use NoValues and follow up with -var-create to get
// the types.
PrintValue printValue = (_simpleValuesExcludesRefTypes || values) ? PrintValue.SimpleValues : PrintValue.NoValues;
PrintValue printValue = values ? PrintValue.SimpleValues : PrintValue.NoValues;
if (types && !values)
{
// We want types but not values. There is no PrintValue option for this, but if
// SimpleValues excludes printing values for references to compound types, then
// the fastest approach is to use SimpleValues (and ignore the values).
// Otherwise, the potential performance penalty of fetching values for
// references to compound types is too high, so use NoValues and follow up with
// -var-create to get the types.
if (!_simpleValuesExcludesRefTypes.HasValue)
{
_simpleValuesExcludesRefTypes = await this.MICommandFactory.SupportsSimpleValuesExcludesRefTypes();
}
if (_simpleValuesExcludesRefTypes.Value)
{
printValue = PrintValue.SimpleValues;
}
}

var frames = await MICommandFactory.StackListArguments(printValue, thread.Id, low, high);
List<ArgumentList> parameters = new List<ArgumentList>();

Expand Down