Open
Description
Description
With the test code:
// integers in different size:
// 1-byte: sbyte, byte
// 2-byte: short, ushort
// 4-byte: int, uint
// 8-byte: long, ulong
namespace Vars01;
class Program
{
static void Main(string[] args)
{
sbyte b1 = SByte.MaxValue;
byte b2 = Byte.MaxValue;
Console.WriteLine("signed byte and unsigned byte:");
Console.Write(b1);
Console.Write(',');
Console.WriteLine(b2);
short short1 = Int16.MaxValue;
ushort short2 = UInt16.MaxValue;
Console.WriteLine("signed short and unsigned short:");
Console.Write(short1);
Console.Write(',');
Console.WriteLine(short2);
int int1 = Int32.MaxValue;
uint int2 = UInt32.MaxValue;
Console.WriteLine("signed int and unsigned int:");
Console.Write(int1);
Console.Write(',');
Console.WriteLine(int2);
long long1 = Int64.MaxValue;
ulong long2 = UInt64.MaxValue;
Console.WriteLine("signed long and unsigned long:");
Console.Write(long1);
Console.Write(',');
Console.WriteLine(long2);
}
}
When I try to view the internal details through lldb + sos with clrstack command, I found it might be showing the wrong value for ushort, the key command and output is below:
(lldb) clrstack -l
OS Thread Id: 0xaf9d14 (1)
Child SP IP Call Site
000000016B6A26E0 0000000108981E94 Vars01.Program.Main(System.String[]) [/Users/gdc/Repos/dotnet-examples/vars/Vars01/Program.cs @ 43]
LOCALS:
0x000000016B6A2704 = 0x000000000000007f
0x000000016B6A2700 = 0x00000000000000ff
0x000000016B6A26FC = 0x0000000000007fff
0x000000016B6A26F8 = 0xffffffffffffffff
0x000000016B6A26F4 = 0x000000007fffffff
0x000000016B6A26F0 = 0x00000000ffffffff
0x000000016B6A26E8 = 0x7fffffffffffffff
0x000000016B6A26E0 = 0xffffffffffffffff
(lldb) memory read 0x000000016B6A26E0 -c 0x30
0x16b6a26e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 7f ................
0x16b6a26f0: ff ff ff ff ff ff ff 7f ff ff 00 00 ff 7f 00 00 ................
0x16b6a2700: ff 00 00 00 7f 00 00 00 f0 cf 00 40 01 00 00 00 ...........@....
(lldb) memory read -c 1 0x000000016B6A2704
0x16b6a2704: 7f .
(lldb) memory read -c 1 0x000000016B6A2700
0x16b6a2700: ff .
(lldb) memory read -c 2 0x000000016B6A26FC
0x16b6a26fc: ff 7f ..
(lldb) memory read -c 2 0x000000016B6A26F8
0x16b6a26f8: ff ff ..
(lldb) memory read -c 4 0x000000016B6A26F4
0x16b6a26f4: ff ff ff 7f ....
(lldb) memory read -c 4 0x000000016B6A26F0
0x16b6a26f0: ff ff ff ff ....
(lldb) memory read -c 8 0x000000016B6A26E8
0x16b6a26e8: ff ff ff ff ff ff ff 7f ........
(lldb) memory read -c 8 0x000000016B6A26E0
0x16b6a26e0: ff ff ff ff ff ff ff ff ........
The value for variable short2
at address 0x000000016B6A26F8
showing as 0xffffffffffffffff
, it should be 0x000000000000ffff
.
Configuration
sh vars $ dotnet --info
.NET SDK:
Version: 9.0.100
Commit: 59db016f11
Workload version: 9.0.100-manifests.3068a692
MSBuild version: 17.12.7+5b8665660
Runtime Environment:
OS Name: Mac OS X
OS Version: 15.2
OS Platform: Darwin
RID: osx-arm64
Base Path: /Users/gdc/dotnet/sdk/9.0.100/
.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.0
Architecture: arm64
Commit: 9d5a6a9aa4
.NET SDKs installed:
8.0.403 [/Users/gdc/dotnet/sdk]
8.0.404 [/Users/gdc/dotnet/sdk]
9.0.100 [/Users/gdc/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.10 [/Users/gdc/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.11 [/Users/gdc/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0 [/Users/gdc/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.10 [/Users/gdc/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.11 [/Users/gdc/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0 [/Users/gdc/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_ROOT [/Users/gdc/dotnet]
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
sh vars $ lldb -v
lldb version 16.0.6
sh vars $ which lldb
/opt/homebrew/bin/lldb
Regression?
Not sure.