Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set a Data Breakpoint in mixed( C#/C++ ) debugging?

Tags:

I launch my program in C#, which then calls some unmanaged C++.

When I break on a line in the unmanaged C++, the 'New Data Breakpoint' menu item is grayed out.

Is there anyway around this?

like image 637
jyoung Avatar asked Oct 28 '08 13:10

jyoung


People also ask

How do you set a breakpoint within your code?

It's easy to set a breakpoint in Python code to i.e. inspect the contents of variables at a given line. Add import pdb; pdb. set_trace() at the corresponding line in the Python code and execute it. The execution will stop at the breakpoint.

How do you create a data breakpoint?

Set breakpoints in source code To set a breakpoint in source code, click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint.

How do I set debugger to mixed?

Select the C++ project in Solution Explorer and click the Properties icon, press Alt+Enter, or right-click and choose Properties. In the <Project> Property Pages dialog box, expand Configuration Properties, and then select Debugging. Set Debugger Type to Mixed or Auto. Select OK.

How do you use data breakpoints?

A data breakpoint can be created in any of the listed windows by right-clicking (or Shift + F10) the desired variable and selecting Break When Value Changes while in break mode.


2 Answers

So to do this I had to:

  • set the unmanaged dll as the startup project
  • set the managed program as the startup command
  • set debug mode as Native
  • "break execution" or hit a breakpoint so that you are in the "debugging" state

yech

like image 106
jyoung Avatar answered Oct 05 '22 17:10

jyoung


To set a data breakpoint in the native portion of a mixed mode process, see the answer posted by jyoung.

Visual Studio disables data breakpoints when running anything but pure, native code. See this post for a partial explanation why from a VS Program Manager.

like image 26
Stu Mackellar Avatar answered Oct 05 '22 16:10

Stu Mackellar