The C parser searches the generated C code for special comments and maps the comments to line numbers. When a user selects On Chip debugging in the Build Specification Properties dialog box, the LabVIEW C Code Generator adds a set of comments to the generated C code to notate where potential probes, breakpoints, controls, and indicators might be placed. For example, the extra comments generated for simple_math.vi is as follows:
hA8EA7A0->sCA8/* n: MultiplyConstant */ = 5.0000000000000000000E+2;
hA8EA7A0->sA9C/* n: DivideConstant */ = 1.0000000000000000000E+2;
hA8EA7A0->sBEC/* n: NumberIn */ =NumberIn__1364;
OCDI_BEGIN_NODE(profileInfo_simple_math, 0, 2) /* OCDI::Begin::Node(1, 2, 3) */
/**/
/* Multiply */
/**/
OCDI_CHECK_POINT(simple_math_OCDIFlag[0] & 0x1, &simple_math_OCDIFlag, 0)/* OCDI::BreakPoint::Node(1, 2, 3) */
hA8EA7A0->sB58/* n: Multiply: x*y */ = hA8EA7A0->sBEC/* n: NumberIn */ * hA8EA7A0->sCA8/* n: MultiplyConstant */;
OCDI_END_NODE(profileInfo_simple_math, 0, 2) /* OCDI::End::Node(1, 2, 3) */
OCDI_BEGIN_NODE(profileInfo_simple_math, 1, 3) /* OCDI::Begin::Node(2, 3, 3) */
/**/
/* Divide */
/**/
OCDI_CHECK_POINT(simple_math_OCDIFlag[0] & 0x2, &simple_math_OCDIFlag, 1)/* OCDI::BreakPoint::Node(2, 3, 3) */ hA8EA7A0->sA08/* n: Divide: x/y */ = (float64)hA8EA7A0->sB58/* n: Multiply: x*y *//(float64)hA8EA7A0->sA9C/* n:DivideConstant */;
OCDI_END_NODE(profileInfo_simple_math, 1, 3) /* OCDI::End::Node(2, 3, 3) */
if (NumberOut__616) {
*NumberOut__616 =hA8EA7A0->sA08/* n: Divide: x/y */;
}
return eFinished;
This information is stored in the debug database, which translates control and signal IDs into relative symbol addresses. The database records for all breakpoints only map breakpoint IDs into line numbers. For controls and indicators, the C parser does not store actual offsets because the parser does not know the layout of the ControlDataItem structure. Instead, the parser stores indexes to the ControlDataItem table. To convert the index value to the actual offset, you must multiply the index value with the size of the ControlData structure and add the offset of the hValue variable of the ControlDataItem structure.
The list parser must resolve relative offsets of all breakpoints. You do not need to port the C parser because the parser is target independent. The C parser generates the bold portion of the following LVM file for simple_math.vi:
[simple_math.vi]
Node(1,2,3)@92=0x4011BF
Node(2,3,3)@99=0x40122B
Location.Node(1,2,3)@[88..94]
Location.Node(2,3,3)@[95..101]
SID_2716=0x4727A0
SID_2904=0x4727A8
SID_3052=0x4727B0
SID_3240=0x4727B8
SID_2568=0x4727C0
For nodes, the syntax for this portion of the LVM file is as follows:
Node(a, b, c)@x=...where ( a , b , c ) represents the unique LabVIEW-generated coordinates that identify the node on the block diagram, and x represents the line number where the comment occurs.
For node location information, the syntax for this portion of the LVM file is as follows:
Location.Node(1,2,3)@[123...456]
Location.SNode(1,2,3)@[123...456]
Location.SRN(1,2,3)@[123...456]
where Location.Node represents nodes, Location.SNode represents structures, and Location.SRN represents self-referencing nodes. [123...456] represents the line numbers in the generated C file.
For controls and signals, the syntax for this portion of the LVM file is as follows:
CID_i=...
SID_i=...
where CID represents Control ID, SID represents Signal ID, and i represents the unique LabVIEW-generated object ID.