Skip to content

Broken value field in a VariablesResponse, should be of type string, not array #344

@tinloaf

Description

@tinloaf

Hi, I'm trying to use this debugger as a debug adapter with Emacs' dap-mode. I realize that this is not the primary purpose of code-debug, but it's 'officially' supported by dap-mode. I'm using gdb v. 9.2 as debugger. dap-mode does some auto-download-magic for the debug adapter, so I did not download a specific version. But when looking into the downloaded extensions.vsixmanifest file, it looks to me like I'm using version 0.26.0:

<Identity Language="en-US" Id="debug" Version="0.26.0" Publisher="webfreak" />

I encountered a crash in dap-mode, which I think I traced back to a problem in code-debug.

I set dap-mode to print all I/O with the debug adapter (i.e., code-debug), and below is (some part of) what I see once a breakpoint is hit. This looks Okay so far - dap-mode is first requesting some info about the top stack frame, and then requests the local variables inside that stack frame. The response looks Okay to me.

Sending: 
{
  "command": "scopes",
  "arguments": {
    "frameId": 1
  },
  "type": "request",
  "seq": 14
}
Received:
{
  "seq": 6865,
  "type": "response",
  "request_seq": 14,
  "command": "scopes",
  "success": true,
  "body": {
    "scopes": [
      {
        "name": "Local",
        "variablesReference": 1001,
        "expensive": null
      }
    ]
  }
}



Sending: 
{
  "command": "variables",
  "arguments": {
    "variablesReference": 1001
  },
  "type": "request",
  "seq": 15
}
Received:
{
  "seq": 6866,
  "type": "response",
  "request_seq": 15,
  "command": "variables",
  "success": true,
  "body": {
    "variables": [
      {
        "name": "this",
        "value": "<args>",
        "variablesReference": 132072
      },
      {
        "name": "tripNotification",
        "value": "Ref@0x7ffffffecdb0",
        "variablesReference": 132073
      },
      {
        "name": "incoming",
        "type": "std::shared_ptr<rtd::CIncomingRBLData>",
        "value": "<unknown>",
        "variablesReference": 132074
      },
      {
        "name": "tripData",
        "type": "rtd::CRBLTripData",
        "value": "<unknown>",
        "variablesReference": 132075
      },
      {
        "name": "avmError",
        "value": "Ref@0x962a068",
        "variablesReference": 132076
      },
      {
        "name": "sanityCheckResult",
        "type": "EFAPTKernelLib::SAVMError",
        "value": "<unknown>",
        "variablesReference": 132077
      },
      {
        "name": "processingTime_msec",
        "value": "135841511",
        "variablesReference": 0
      }
    ]
  }
}

The crash now happens when I try to expand the this variable. This is the I/O for that request:

Sending: 
{
  "command": "variables",
  "arguments": {
    "variablesReference": 132072
  },
  "type": "request",
  "seq": 16
}
Received:
{
  "seq": 6867,
  "type": "response",
  "request_seq": 16,
  "command": "variables",
  "success": true,
  "body": {
    "variables": [
      {
        "name": "[err]",
        "value": [
          {
            "name": "m_lMessageCount",
            "value": "0",
            "variablesReference": 0
          },
          {
            "name": "m_accumulatedTime_msec",
            "value": "8675833939940",
            "variablesReference": 0
          },
          {
            "name": "m_ptKernelVersion",
            "value": "Object",
            "variablesReference": 132079
          },
          {
            "name": "m_ptrRblTripDataBuilder",
            "value": "std",
            "variablesReference": 0
          }
        ],
        "variablesReference": 0
      }
    ]
  }
}

Those variables look wrong to me. The DAP specification for the Variable type specifies that the value member must be a string, not a list.

Please let me know if there is anything I can do to help debug this. My (completely unsubstantiated) feeling is that this might be related to #342 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions