Fossil SCM

In debug config, reference the compiled sources; this allows stepping through the actual code in the debugger

ashepilko 2018-07-22 21:10 UTC trunk
Commit 58bf02d1273e386086503360b95e1e56a26ce3732f16c517b2e3f6e09f5f905d
1 file changed +8
--- src/translate.c
+++ src/translate.c
@@ -213,19 +213,27 @@
213213
if( in==0 ){
214214
fprintf(stderr,"can not open %s\n", argv[1]);
215215
exit(1);
216216
}
217217
zInFile = argv[1];
218
+#ifndef FOSSIL_DEBUG
219
+ /* Set source line reference to the original source file.
220
+ * This makes compiler show the original file name in the compile error
221
+ * messages, instead of referring to the translated file.
222
+ * NOTE: This somewhat complicates stepping in debugger, as the resuling
223
+ * code would not match the referenced sources.
224
+ */
218225
printf("#line 1 \"");
219226
for(arg=argv[1]; *arg; arg++){
220227
if( *arg!='\\' ){
221228
printf("%c", *arg);
222229
}else{
223230
printf("\\\\");
224231
}
225232
}
226233
printf("\"\n");
234
+#endif
227235
trans(in, stdout);
228236
fclose(in);
229237
}else{
230238
trans(stdin, stdout);
231239
}
232240
--- src/translate.c
+++ src/translate.c
@@ -213,19 +213,27 @@
213 if( in==0 ){
214 fprintf(stderr,"can not open %s\n", argv[1]);
215 exit(1);
216 }
217 zInFile = argv[1];
 
 
 
 
 
 
 
218 printf("#line 1 \"");
219 for(arg=argv[1]; *arg; arg++){
220 if( *arg!='\\' ){
221 printf("%c", *arg);
222 }else{
223 printf("\\\\");
224 }
225 }
226 printf("\"\n");
 
227 trans(in, stdout);
228 fclose(in);
229 }else{
230 trans(stdin, stdout);
231 }
232
--- src/translate.c
+++ src/translate.c
@@ -213,19 +213,27 @@
213 if( in==0 ){
214 fprintf(stderr,"can not open %s\n", argv[1]);
215 exit(1);
216 }
217 zInFile = argv[1];
218 #ifndef FOSSIL_DEBUG
219 /* Set source line reference to the original source file.
220 * This makes compiler show the original file name in the compile error
221 * messages, instead of referring to the translated file.
222 * NOTE: This somewhat complicates stepping in debugger, as the resuling
223 * code would not match the referenced sources.
224 */
225 printf("#line 1 \"");
226 for(arg=argv[1]; *arg; arg++){
227 if( *arg!='\\' ){
228 printf("%c", *arg);
229 }else{
230 printf("\\\\");
231 }
232 }
233 printf("\"\n");
234 #endif
235 trans(in, stdout);
236 fclose(in);
237 }else{
238 trans(stdin, stdout);
239 }
240

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button