Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

huge C file debugging problem

I have a source file in my project, which has more than 65,536 code lines (112,444 to be exact). I'm using an "sqlite amalgamation", which comes in a single huge source file.

I'm using MSVC 2005. The problems arrives during debugging. Everything compiles and links ok. But then when I'm trying to step into a function with the debugger - it shows an incorrect code line.

What's interesting is that the difference between the correct line number and the one the debugger shows is exactly 65536. This makes me suspect (almost be sure in) some unsigned short overflow.

I also suspect that it's not a bug in the MSVC itself. Perhaps it's the limitation of the debug information format. That is, the debug information format used by MSVC stores the line numbers as 2-byte shorts.

Is there anything can be done about this (apart from cutting the huge file into several smaller ones) ?

like image 477
valdo Avatar asked May 20 '10 15:05

valdo


2 Answers

According to a MS moderator, this is a known issue with the debugger only (the compiler seems to handle it fine as you pointed out). There is apparently no workaround, other than using shorter source files. See official response to very similar question here

like image 171
Dusty Avatar answered Oct 18 '22 18:10

Dusty


Well, when I wanted to look at how sqlite works, I took the last 60000 or so lines, moved them to another file and then #include'd it. That was easy and did the trick for me. Also, if you do that, be careful not to split inside #ifdef .

like image 1
Vladimir Gorsunov Avatar answered Oct 18 '22 17:10

Vladimir Gorsunov