On Sunday, 4 November 2018 at 08:27:34 UTC, Rainer Schuetze wrote:


On 03/11/2018 17:31, Michelle Long wrote:
On Saturday, 3 November 2018 at 08:10:37 UTC, Rainer Schuetze wrote:


On 30/10/2018 16:21, Michelle Long wrote:
statement1; statement2;

Would be nice to easily be able to set a BP just on statement2 without having to add a new line.


I haven't seen this with the VS native debugger and C++, so I doubt it is feasible.

Supposedly it is possible. When you put a BP it has a "char" value which is usually set to 1. (you can see it in when you hover over the BP).

Supposedly setting the value to something else allows one to do BP's in the middle of lines. It may be only valid for certain languages though but it is doable in some cases as you can find information online about people doing it.

https://stackoverflow.com/questions/36166205/setting-a-breakpoint-in-the-middle-of-a-line-with-multiple-statements

These examples are with the debugger for managed code (e.g. C#), not the debug engine for native applications.

I haven't yet seen any compiler (C++ or D) emit CodeView debug information that contains more than the line number.


Is it then possible to simply split a line internally to handle it?

1. Surely the char/statement for the BP on a multi-statement line can be determined?

2. If such a BP exist then simply insert a new line in the text before compiling(I know it modifies the code but it's just whitespace and it could be an optional feature).

3. Then remove the inserted new line character after compiling. (might need to suppress file modifications temporarily).

4. When a BP is hit just re-calculate the line positions(will be offset by one and such.

Should be pretty simple to do and allows one to not have to worry about reformatting code just to add BP's.

I routinely do stuff like

if (x) return;

and I want a BP on the return, not the if. I have to insert the new line by hand just so I can add a BP!

Since this is a white space problem it really should be trival and technically should be supported by the compiler and debugger/IDE. It's a pretty basic problem and also helpful to have the ability to put BP's in the middle of lines.

It may actually be easier to implement though since the IDE already does have some of the capabilities.

  • Can't set BP in m... Michelle Long via Digitalmars-d-debugger
    • Re: Can't se... Rainer Schuetze via Digitalmars-d-debugger
      • Re: Can'... Michelle Long via Digitalmars-d-debugger
        • Re: ... Rainer Schuetze via Digitalmars-d-debugger
          • ... Michelle Long via Digitalmars-d-debugger
            • ... Stefan Koch via Digitalmars-d-debugger
              • ... WTF Is Wrong with you people? via Digitalmars-d-debugger
              • ... Michelle Long via Digitalmars-d-debugger
                • ... wjoe via Digitalmars-d-debugger

Reply via email to