简体   繁体   中英

Copy pointer address for conditional breakpoint from Visual Studio watch window?

Is there a quicker way to copypaste C++ pointers from Visual Studio's Watch window into a conditional breakpoint?

Context: My pointer values change each time I restart my application, so I need to update the address in my conditional breakpoint.

If I have a watch for this , copypasting it gives something like this:

+ this 0x000001287234a8c0 {mTick=2994 mTime=0.00000000...} AnimComponent *

When I right click on this , there's a "Copy Value" option, but it copies that {} block too:

0x000001287234a8c0 {mTick=2994 mTime=0.00000000...}

So my current process to copy my this watch's pointer value:

  • Click on this
  • Ctrl-C
  • Edit conditional breakpoint
  • Ctrl-v, remove the {} block, and add a == after this

I'm using C++, so I can't use the "Make Object ID" feature .

Watch Window

Use (void*)this in the watch window to prevent the {} block and make "Copy Value" copy only the number.

Keyboard Shortcut

Open Tools > Customize > Keyboard

Search for "CopyValue" and you should find DebuggerContextMenus.AutosWindow.CopyValue. Map a keyboard shortcut to it and you can copy values with only two steps: click + keyboard.

If you use Ctrl-Shift-C to copy, be sure to remove that shortcut from View.ClassView or it will interrupt your copying.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM