Skip to content

Fix continuation names in SOS by using PTR_ equivalents#121009

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/fix-continuation-names-sos
Closed

Fix continuation names in SOS by using PTR_ equivalents#121009
Copilot wants to merge 2 commits intomainfrom
copilot/fix-continuation-names-sos

Conversation

Copy link
Contributor

Copilot AI commented Oct 23, 2025

Summary

Fixes an issue where continuation names appeared incorrectly when debugging with SOS (Son of Strike debugger extension).

Problem

When using SOS to inspect continuation objects, the names were displayed with incorrect values. For example:

0:009> !do poi(@rbp-0x50)
Name:        Continuation_32_2714363008_9_0_3

However, the internal MethodTable structure showed the correct name:

debug_m_szClassName : 0x00007ff8`a1c9e588  "Continuation_32_0_3"

Root Cause

The PrintContinuationName template function in asynccontinuations.h was using raw pointer types (CGCDesc* and CGCDescSeries*) to access GC descriptor information. These raw pointers don't work correctly in DAC (Data Access Component) scenarios where the debugger needs to read memory from a different process.

Solution

Replaced the raw pointer types with their DAC-aware PTR_ equivalents:

  • CGCDesc*PTR_CGCDesc
  • CGCDescSeries*PTR_CGCDescSeries

These PTR_ types properly handle address translation when accessed from the debugger, ensuring that continuation names are read and displayed correctly in SOS.

Changes

  • Updated AsyncContinuationsManager::PrintContinuationName in src/coreclr/vm/asynccontinuations.h to use PTR_CGCDesc and PTR_CGCDescSeries

Fixes #<issue_number>

Co-authored-by: Jakob Botsch Nielsen 7887810+jakobbotsch@users.noreply.github.com

Original prompt

This section details on the original issue you should resolve

<issue_title>Continuation names appear wrong in SOS</issue_title>
<issue_description>E.g.:

0:009> !do poi(@rbp-0x50)
Name:        Continuation_32_2714363008_9_0_3
MethodTable: 00007ff8a1c9e4b8
Canonical MethodTable: 00007ff8a1c9a678
Tracked Type: false
Size:        72(0x48) bytes
File:        C:\dev\dotnet\runtime2\artifacts\tests\coreclr\windows.x64.Debug\Tests\Core_Root\System.Private.CoreLib.dll
Fields:
None

Things look right for the internal name:

0:009> ?? *(MethodTable*)0x00007ff8a1c9e4b8
class MethodTable
   =00007ff9`017b5760 s_pMethodDataCache : 0x00000238`ea8a1ea0 MethodDataCache
   +0x000 m_dwFlags        : 0x1000000
   +0x004 m_BaseSize       : 0x48
   +0x008 m_dwFlags2       : 0
   +0x00c m_wNumVirtuals   : 4
   +0x00e m_wNumInterfaces : 0
   +0x010 debug_m_szClassName : 0x00007ff8`a1c9e588  "Continuation_32_0_3"
   +0x018 m_pParentMethodTable : 0x00007ff8`a1c981c0 MethodTable
   +0x020 m_pModule        : 0x00007ff8`a1554000 Module
   +0x028 m_pAuxiliaryData : 0x00007ff8`a1c9e528 MethodTableAuxiliaryData
   +0x030 m_pEEClass       : 0x00007ff8`a1c9a5d0 EEClass
   +0x030 m_pCanonMT       : 0x00007ff8`a1c9a5d0
   +0x038 m_pPerInstInfo   : (null) 
   +0x038 m_ElementTypeHnd : 0
   +0x040 m_pInterfaceMap  : (null) 
   +0x040 m_encodedNullableUnboxData : 0

@noahfalk @jkotas Any idea what could be wrong here? Is the way I access GC descs in AsyncContinuationsManager::PrintContinuationName wrong?</issue_description>

Comments on the Issue (you are @copilot in this section)

@jakobbotsch Ah.. The raw pointers in `PrintContinuationName` should use the `PTR_` equivalents.

Fixes #121008


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: jakobbotsch <7887810+jakobbotsch@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix incorrect continuation names in SOS Fix continuation names in SOS by using PTR_ equivalents Oct 23, 2025
Copilot AI requested a review from jakobbotsch October 23, 2025 10:04
@jkotas jkotas deleted the copilot/fix-continuation-names-sos branch October 24, 2025 03:30
@github-actions github-actions bot locked and limited conversation to collaborators Nov 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Continuation names appear wrong in SOS

2 participants