-
Notifications
You must be signed in to change notification settings - Fork 263
Open
Description
Hi,
I am trying to get the value of a ClrThreadStaticField field in .NET Core on Linux using ClrMD. Here are the application details:
Target application:
private static readonly ThreadLocal<string> threadLocal = new();
ClrMD application:
foreach (var field in clrObject.Type.ThreadStaticFields)
DisplayFieldValues(runtime, field);
...
private void DisplayFieldValues(ClrRuntime runtime, ClrThreadStaticField field)
{
foreach (var thread in runtime.Threads)
if (field.IsObjectReference)
{
var fieldInitialized = field.IsInitialized(thread);
var fieldAddress = field.GetAddress(thread);
var fieldValue = field.ReadObject(thread);
}
}
The ClrMD application uses a full core dump of the Target application created using createdump -f.
In my case ClrThreadStaticField.GetAddress() returns 0 for all threads. As a result ClrThreadStaticField.ReadObject() returns null object (ClrObject.IsNull) for all threads as well.
Everything in LLDB using SOS works as expected:
(lldb) dumpobj 00007eec268c7468
Name: System.Threading.ThreadLocal`1[[System.String, System.Private.CoreLib]]
...
Fields:
MT Field Offset Type VT Attr Value Name
....
0000000000000000 4000d1e 10 SZARRAY 0 TLstatic ts_slotArray
>> Thread:Value 50e0:00007eec268c7aa0 50e2:00007eec268cb868 <<
00007f2c3d8373b0 4000d1f 18 ...Private.CoreLib]] 0 TLstatic ts_finalizationHelper
>> Thread:Value 50e0:00007eec268c7ac0 50e2:00007eec268cb888 <<
Here are the environment details:
- OS: Debian 12, x64, Linux VM-DEV 6.1.0-27-amd64 Add overloads to the GetValue() methods of ClrField classes that allo… #1 SMP PREEMPT_DYNAMIC Debian 6.1.115-1 (2024-11-01) x86_64 GNU/Linux
- .NET: Microsoft.NETCore.App 9.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
- ClrMD:
Is there anything that I am missing?
Thanks,
Marian.
Metadata
Metadata
Assignees
Labels
No labels