Commit e762018d authored by rdubner's avatar rdubner

Eliminate dependency on -fsource-location

-fsource-location placed a trace_stment() call before the start of the generated
C for every COBOL instruction.  This was needed to make the .loc assembly directives
work.  Simon replaced those calls with "call cob_nop()".  I get rid of them, except
when the following .loc statement has "discriminator" in it.  Otherwise the code
doesn't trap properly through some loops.  I have no idea why.
parent fd7076fd
......@@ -292,8 +292,22 @@ build(PARAMETERS &params,
// the program.cob text, has inserted cob_nop() calls before the
// beginning of the generated C for each COBOL statement.
//
// In return for his generosity, we strip them out here:
//
// This still requires some research. But for a program fragment like this:
// PERFORM 2 TIMES
// DISPLAY 'xxx'
// END-PERFORM
// The generated assembly code has this:
// jmp L18:
// L19:
// call cob_nop
// .loc 1 123 discriminator 3
// call cob_display
// L18: # perform loop test
// jg L19
// I have learned that if I just drop the cob_nop, then GDB-8.3 never
// traps at line 123
// But if I turn the cob_nop into an actual nop, then it works
if( strstr(ach,"call\tcob_nop") ) {
continue;
}
......@@ -333,6 +347,10 @@ build(PARAMETERS &params,
if( new_num != 0 ) {
// Build the replacement line:
int new_line = atoi(premainder) - 1 ;
if( strstr(premainder,"discriminator") )
{
fprintf(f,"\tnop\n");
}
fprintf(f,"\t.loc %d %d\n",new_num,new_line);
break;
}
......@@ -353,6 +371,10 @@ build(PARAMETERS &params,
int newnum = replacements[oldnum];
if( newnum != 0 ) {
// Rebuild the .loc line
if( strstr(premainder,"discriminator") )
{
fprintf(f,"\tnop\n");
}
fprintf(f,"\t.loc %d%s\n",newnum,premainder);
}
continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment