NVlabs / NVBit

200 stars 18 forks source link

Getting lineinfo with device code #14

Closed ZejiaZheng closed 4 years ago

ZejiaZheng commented 4 years ago

If i add -lineinfo during nvcc compilation and disable all optimizations, would it be possible for nvbit to extract the lineinfo for each instruction?

More details: I am trying to write a basic code coverage tool with nvbit. I can generate cubin file with nvcc and use nvdisasm --print-line-info vectorAdd.cubin to get the intruction <=> line info correspondence, but the issue is that the instruction printed out from cubin and the instructions printed out from nvbit are not always matching. If nvbit can parse the lineinfo directly then this would be awesome.

Thank you.

ZejiaZheng commented 4 years ago

Ah I found this in the pdf paper: void getLineInfo(char** file, uint32_t* line); Closing the issue now.

ovilla commented 4 years ago

I am glad this issue was resolved.

ovilla commented 4 years ago

from nvbit.h

/* Get line information for a particular instruction offset if available,
 * binary must be compiled with --generate-line-info   (-lineinfo) */
bool nvbit_get_line_info(CUcontext cuctx, CUfunction cufunc, uint32_t offset,
                         char** file_name, char** dir_name, uint32_t* line);