On Tuesday, 20 November 2018 at 15:11:56 UTC, Stefan Koch wrote:
On Sunday, 4 November 2018 at 21:17:32 UTC, Michelle Long wrote:
On Sunday, 4 November 2018 at 08:27:34 UTC, Rainer Schuetze wrote:
[...]


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

[...]

Debug information is mapped to machine-code on a source line by source line basis.

Therefore it's indeed nontrivial to do this.


Why would that be non-trivial?

semantically there is nothing different between

statement; statement;

and

statement;
statement;

to say that there is a difference to the compiler is not true.

To say it is non-trivial does not mean it is. You have to at least prove it with some reasonable logic because the facts do not support your claim.


Whatever mapping takes place, one just needs to propagate the column info along with the line. It may be non-trivial to implement in the compiler because of the design, but it is not a hard problem, in fact, it should be quite easy.


In fact, if the compiler simply broke every statement in to it's own line, by adding a new line to each statement(after every `;`) and memorized that mapping then it could be inverted to get the desired behavior... that is almost a trivial solution, so to say it is non-trivial simply does not jive and you will have to be more specific why.

For example, one could write a pre-parser that records the line and column mapping of statements, converts all multi-statement lines into multi-line statements. Compile, then unmap whatever the compiler says:

statement1; statement2; statement3;

Record line/col

0/0 0/12 0/24

convert

statement1;
statement2;
statement3;

0/0
1/0
2/0

map

0/0 -> 0/0
0/12 -> 1/0
0/24 -> 2/0

Then the mapping can be inverted after compilation.

E.g., If there is an error on line 2 it is looked up in the mapping

2/0 -> 0/24.

And so the error is actually at line 0/24 in the original sort(before newlines added).

It's quite simple. So you are simply wrong. One could write such a preprocessor and get the mapping and such and it would work fine. All it would require is to properly parse D code code to get the end of statements ';', insert a new line, and determine the mapping and for the debugger then to invert the map when line info is presented.

Because it is trivial to do, except for the D language processing(which the dmd parser should handle without problem and why it could be done in dmd transparently pre and post), it probably should be looked in to.

It's easy to say something is true or false... but it doesn't make it so. I've demonstrated a feasible solution.

Many people thought it was impossible to do X and they were proven wrong. Have you learned your lesson? We can at least then spend the time in finding an optimal way to do this so we all benefit from it.









  • 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