Is line number in DbgStopPointInst in LLVM accurate?

Dear developers,
     When I try to map line numbers in source code back to LLVM basicblocks, I meet some problems: there is a source file with 1500 lines of code, but when I use BasicBlockPass to collect all DbgStopPoint instructions in this file, I can only get 500 lines of code.
     The source code and the collected results are both attached.
     Is there any way to map line numbers in source code back to an LLVM basicblock precisely? Can LLVM-2.6 do this?

Heming (42.6 KB) (111 KB)


The C or CXX flags are "-O0 -g". I am not using any optimization options.

Not all lines of the source code are executable, take blank lines, line
with only braces, comments, function prototypes as an example.

How many lines of source code are left after you remove those? More than

Best regards,

Quoting Török Edwin <>:

Hi Torok,
     There are some code lines that do not have dbgstoppoint. For example, the 1345 to 1355 (the function below). 1347, 1348, and 1349 do not exist in the result file.

void select_insert::send_error(uint errcode,const char *err)
   if (info.copied || info.deleted)
     query_cache_invalidate3(thd, table, 1);