I’m compiling sqlite3 using Visual Studio 2008. When I try to single-step into any sqlite3 function (e.g. sqlite3_open), Visual Studio displays the wrong line of source code. And it looks really wrong. The sqlite3_open function seems to be declared on line 114,788; and when I single-step in, it brings me to line 49,254.
I’ve tried rebuilding everything. I think I’m compiling everything the same way (i.e. same runtime-library, debug information format, etc).
What am I doing wrong?
Edit: To compile sqlite3 for Windows, I created a new “Win32 Project” naming it “sqlite3”, selecting for it to be a static library, and an empty project. I added “sqlite3.c” to the “Source Files” folder under the new “sqlite3” project, and the “sqlite3.h” file to the “Header files” folder. Hitting compile at this step yielded the sqlite3.lib.
Here’s the command line passed into cl:
/Od /D "WIN32" /D "_DEBUG" /D "_LIB" /D "_MBCS" /Gm /EHsc /RTC1 /MTd /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /nologo /c /ZI /TP /errorReport:prompt
I have a separate .exe project in the same solution that I created as a “Win32 Project” selecting for it to be an “empty project” and a “console application”. This project includes the sqlite3.h header, and as “Additional Dependencies” I include the sqlite3.lib.
My code looks like the following:
sqlite3 *pDb;
sqlite3_open("C:\\some.db", &pDb);
Stepping into this function brings me to the wrong source line in sqlite3.c.
Edit2: Here’s the link to the sqlite3 source that I downloaded: http://www.sqlite.org/sqlite-amalgamation-3071100.zip
And here’s the documentation for how to build it this way (that is, just compile the sqlite3.c in your project): http://www.sqlite.org/amalgamation.html
Edit3: For what it’s worth, the call-stack in my debugging window appears to follow the correct code. And using the API correctly leads to correct results. It appears the compilation works, the source code line is just wrong.
the vs2008, vs2010, etc. debuggers can’t step in more than 65536 lines.
Solution1 : put any function you want to step in, in the 1st 65536 lines, by moving this part in the huge file. Move one chapter a time, I did it to debug gettable and worked (minor bug with *pnColumn)
Solution2 : don’t use vs2kXX anymore, return to vi, emacs, etc.. (Ha..ha..)
Solution3 : cut this huge file in smallest ones, following the indications “Include pcache.h in the middle of sqliteInt.h” etc. etc. But then you’ll have to manage about 150,000 lines !.. with surprises as a missing “tcl.h” for example, etc. etc. A nice piece of work, but the community will raise a statue of you !..
Believe me, the best solution is the #1.
Thanks to guy or the team who gave us SQLite amalgamation !