23.02.2016 21:47, Adriano dos Santos Fernandes wrote: > Hi! > > Debug cpp files generated from epp ones are a nightmare. > > The debugger goes/shows cpp line numbers where you want to see epp lines. > > Gpre has some support for #line directive but was not working properly. > > Attached I put a patch to fix it. It's rudimentary, it overloads std C > functions (*put*, *print*) to not change gpre too much. > > It does changes only the internal language used in our build. > > Here is a gdb session where I put a breakpoint in METD_get_relation > > http://pastebin.com/raw/B4qbQVrE > > Lines from 1388-1416 are the epp lines. You see the epp filename where > gdb breaks. > > Lines from 3357-3364 are the cpp lines. You see the cpp filename with bt. > > I want this. See generated code in the generated file and source code in > the source file. > > I have no idea if this works great in Visual Studio, I believe it's even > great than in gdb. When I used Visual Studio, sometimes I edited cpp > files while debugging and lost changes. > > What do you think and can you test it in Windows?
1. This code prints file names as is (with no duplicated slashes) @@ -2619,6 +2615,16 @@ static void pass2( SLONG start_position) fputc('\n', gpreGlob.out_file); } + if (!continue_flag && + sw_lines && + gpreGlob.sw_language == lang_internal && + gpreGlob.out_file.filename && + !(action->act_type == ACT_routine && !action->act_object)) + { + fprintf(gpreGlob.out_file, "\n#line %"SLONGFORMAT" \"%s\"", + gpreGlob.out_file.line + 2, gpreGlob.out_file.filename); + } + in result it generates code like: /**** end of GPRE definitions ****/ #line 65 "F:\\FB2\\fb30.new\\src\\burp\\OdsDetection.epp" << good #define DB tdgbl->db_handle #define gds_trans tdgbl->tr_handle #define isc_status tdgbl->status_vector void detectRuntimeODS() { #line 244 "F:\FB2\fb30.new\gen\preprocessing.cpp" << BAD !!! and a lot of warnings like: 2>------ Build started: Project: yvalve, Configuration: Release Win32 ------ 1>F:\FB2\fb30.new\src\burp\OdsDetection.epp(65): warning C4129: 'F' : unrecognized character escape sequence (..\..\..\gen\burp\OdsDetection.cpp) 1>F:\FB2\fb30.new\src\burp\OdsDetection.epp(65): warning C4129: 'g' : unrecognized character escape sequence (..\..\..\gen\burp\OdsDetection.cpp) 1>F:\FB2\fb30.new\src\burp\OdsDetection.epp(65): warning C4129: 'p' : unrecognized character escape sequence (..\..\..\gen\burp\OdsDetection.cpp) 1>F:\FB2\fb30.new\src\burp\OdsDetection.epp(73): warning C4129: 'F' : unrecognized character escape sequence (..\..\..\gen\burp\OdsDetection.cpp) 1>F:\FB2\fb30.new\src\burp\OdsDetection.epp(73): warning C4129: 'g' : unrecognized character escape sequence (..\..\..\gen\burp\OdsDetection.cpp) 1>F:\FB2\fb30.new\src\burp\OdsDetection.epp(73): warning C4129: 'p' : unrecognized character escape sequence (..\..\..\gen\burp\OdsDetection.cpp) Other code in gpre.cpp\pass2() used "backlash_fixed_file_name" when emits "#line" directives, btw 2. VC IDE works badly with new files. I can put breakpoint in .epp files, yes, but when i step into preprocessed code - IDE lost position and show me *nothing* until i set breakpoint in some not preprocessed place. Also, i don't know how debugger (VS or WinDBG) will react on memory dump produced by such binary. Regards, Vlad PS If you need it so much, i offer to apply patch but disable #line generation for release build in public source tree. And - after v3 release, please, not now ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel