Skip to content

Commit e641da7

Browse files
authored
Update DumpAsync to allow method table and object address to not have 0x prefix (#3876)
* Update DumpAsync to allow method table and object address to not have 0x prefix * Specify null-return OK
1 parent 3ae4837 commit e641da7

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/Microsoft.Diagnostics.ExtensionCommands/DumpAsyncCommand.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,24 @@ public sealed class DumpAsyncCommand : ExtensionCommandBase
5252
[ServiceImport(Optional = true)]
5353
public ClrRuntime? Runtime { get; set; }
5454

55+
5556
/// <summary>Gets whether to only show stacks that include the object with the specified address.</summary>
5657
[Option(Name = "--address", Aliases = new string[] { "-addr" }, Help = "Only show stacks that include the object with the specified address.")]
57-
public ulong? ObjectAddress { get; set; }
58+
public string? ObjectAddress
59+
{
60+
get => _objectAddress?.ToString();
61+
set => _objectAddress = ParseAddress(value);
62+
}
63+
private ulong? _objectAddress;
5864

5965
/// <summary>Gets whether to only show stacks that include objects with the specified method table.</summary>
6066
[Option(Name = "--methodtable", Aliases = new string[] { "-mt" }, Help = "Only show stacks that include objects with the specified method table.")]
61-
public ulong? MethodTableAddress { get; set; }
67+
public string? MethodTableAddress
68+
{
69+
get => _methodTableAddress?.ToString();
70+
set => _methodTableAddress = ParseAddress(value);
71+
}
72+
private ulong? _methodTableAddress;
6273

6374
/// <summary>Gets whether to only show stacks that include objects whose type includes the specified name in its name.</summary>
6475
[Option(Name = "--type", Help = "Only show stacks that include objects whose type includes the specified name in its name.")]
@@ -532,14 +543,14 @@ string Describe(ClrObject obj)
532543
// <summary>Determines whether the specified object is of interest to the user based on their criteria provided as command arguments.</summary>
533544
bool IncludeInOutput(ClrObject obj)
534545
{
535-
if (ObjectAddress is ulong addr && obj.Address != addr)
546+
if (_objectAddress is ulong addr && obj.Address != addr)
536547
{
537548
return false;
538549
}
539550

540551
if (obj.Type is not null)
541552
{
542-
if (MethodTableAddress is ulong mt && obj.Type.MethodTable != mt)
553+
if (_methodTableAddress is ulong mt && obj.Type.MethodTable != mt)
543554
{
544555
return false;
545556
}

0 commit comments

Comments
 (0)