On 1 June 2015 at 15:13, Iain Hibbert <[email protected]> wrote: > On Mon, 1 Jun 2015, Andrew Cagney wrote: > >> PCC, as a "classic" C compiler, only generates debug information at >> -O0. This this is because the stabs code is restricted to the >> un-optimized code generator path. > > this is not actually the case btw, and I don't recall it being like that > in the last few years either..
Like I mentioned in another reply, I'm being a little fast and loose. The file "cc/ccom/scan.l" from http://pcc.ludd.ltu.se/fisheye/browse/pcc/pcc/cc/ccom/scan.l?r=1.127 which I'm assuming is the C parser is doing this: #define STABS_LINE(x) if (gflag && cftnsp) stabs_line(x) ... "\n" { ++lineno; STABS_LINE(lineno); } which, I believe, is executing this: cprint(1, "\t.stabn %d,0,%d," STABLBL "\n" STABLBL ":\n", N_SLINE, line, stablbl, stablbl); and this will will insert the stab into the assembler stream (send_passt). However, and here's the key thing, as best I can tell, the stab isn't tied to an instruction, just a position in the instruction stream. If an optimizer so much as sneezes, re-ordering instructions for instance, the information is wrong. When the back-end goes to generate assembler, all it has, is a string. In the case of variables. They are generated at the start of a block, so have no connection at all to the code. perhaps I'm wrong? Andrew > regards, > iain
