vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Global variable access in debugger

Open pjyoung63 opened this issue 4 years ago • 7 comments

Type: Feature Request

It is not possible to change the value of a global variable when debugging C++ with GBD since globals are only visible when added to the watch window which does not allow editing of a variables value. Either globals need to be made available by a selection process in Variables window, or the watch window needs to enable editing of values.

pjyoung63 avatar Mar 14 '22 09:03 pjyoung63

As this is marked as a feature request, it will need to be implemented.

In the meantime, you should be able to assign to it if it is a child item in the Watch Window e.g.

int c = 5;

In the watch window, use &c and expand it, right click on the child item and you should see a Set Value.

The other option is to set it via GDB commands using the Debug Console.

WardenGnaw avatar Mar 14 '22 18:03 WardenGnaw

Thanks, that works for me.

From: Andrew Wang @.> Sent: 14 March 2022 18:51 To: microsoft/vscode-cpptools @.> Cc: Phil Young @.>; Author @.> Subject: Re: [microsoft/vscode-cpptools] Global variable access in debugger (Issue #9019)

As this is marked as a feature request, it will need to be implemented.

In the meantime, you should be able to assign to it if it is a child item in the Watch Window e.g.

int c = 5;

In the watch window, use &c and expand it, right click on the child item and you should see a Set Value.

The other option is to set it via GDB commands using the Debug Console.

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/vscode-cpptools/issues/9019#issuecomment-1067170785, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYFTQ24CD5LKAIHOMVSE4TLU76DC3ANCNFSM5QU6J5KQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.@.>>

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

pjyoung63 avatar Mar 14 '22 18:03 pjyoung63

Either globals need to be made available by a selection process in Variables window, or the watch window needs to enable editing of values.

Yeah I remember seeing local/static/... sections in the variables view with other debug adapters like https://github.com/vadimcn/vscode-lldb#screenshots.

Trass3r avatar Jun 13 '22 19:06 Trass3r

This seems to have gotten fixed a while ago.

sean-mcmanus avatar Jan 06 '23 23:01 sean-mcmanus

Where is this fix? Still not present in the current release of this extension. Although the workaround is.

reporter123 avatar Mar 02 '24 06:03 reporter123

should this still be tagged "release-pending"? It seems to be released.

starball5 avatar Apr 23 '24 00:04 starball5

@starball5 The fix was released in 1.10.5 (in 2022). The label has been updated to "fixed" with the description "Check the Milestone for the release in which the fix is or will be available.".

sean-mcmanus avatar Apr 23 '24 00:04 sean-mcmanus