} else {
D->scope_count = 0;
}
- if (S->LineInfoList) {
+ if (S->LineInfoList) {
D->line_count = CollCount (S->LineInfoList);
} else {
D->line_count = 0;
+const cc65_lineinfo* cc65_line_byspan (cc65_dbginfo Handle, unsigned SpanId)
+/* Return line information for a a span. The function returns NULL if the
+ * span id is invalid, otherwise a list of line infos.
+ */
+{
+ const DbgInfo* Info;
+ const SpanInfo* S;
+ cc65_lineinfo* D;
+ unsigned I;
+
+ /* Check the parameter */
+ assert (Handle != 0);
+
+ /* The handle is actually a pointer to a debug info struct */
+ Info = Handle;
+
+ /* Check if the span id is valid */
+ if (SpanId >= CollCount (&Info->SpanInfoById)) {
+ return 0;
+ }
+
+ /* Get the span */
+ S = CollAt (&Info->SpanInfoById, SpanId);
+
+ /* Prepare the struct we will return to the caller */
+ D = new_cc65_lineinfo (S->LineInfoList? CollCount (S->LineInfoList) : 0);
+
+ /* Fill in the data. Since D->LineInfoList may be NULL, we will use the
+ * count field of the returned data struct instead.
+ */
+ for (I = 0; I < D->count; ++I) {
+ /* Copy the data */
+ CopyLineInfo (D->data + I, CollAt (S->LineInfoList, I));
+ }
+
+ /* Return the allocated struct */
+ return D;
+}
+
+
+
void cc65_free_lineinfo (cc65_dbginfo Handle, const cc65_lineinfo* Info)
/* Free line info returned by one of the other functions */
{
+const cc65_scopeinfo* cc65_scope_byspan (cc65_dbginfo Handle, unsigned SpanId)
+/* Return scope information for a a span. The function returns NULL if the
+ * span id is invalid, otherwise a list of line scopes.
+ */
+{
+ const DbgInfo* Info;
+ const SpanInfo* S;
+ cc65_scopeinfo* D;
+ unsigned I;
+
+ /* Check the parameter */
+ assert (Handle != 0);
+
+ /* The handle is actually a pointer to a debug info struct */
+ Info = Handle;
+
+ /* Check if the span id is valid */
+ if (SpanId >= CollCount (&Info->SpanInfoById)) {
+ return 0;
+ }
+
+ /* Get the span */
+ S = CollAt (&Info->SpanInfoById, SpanId);
+
+ /* Prepare the struct we will return to the caller */
+ D = new_cc65_scopeinfo (S->ScopeInfoList? CollCount (S->ScopeInfoList) : 0);
+
+ /* Fill in the data. Since D->ScopeInfoList may be NULL, we will use the
+ * count field of the returned data struct instead.
+ */
+ for (I = 0; I < D->count; ++I) {
+ /* Copy the data */
+ CopyScopeInfo (D->data + I, CollAt (S->ScopeInfoList, I));
+ }
+
+ /* Return the allocated struct */
+ return D;
+}
+
+
+
const cc65_scopeinfo* cc65_childscopes_byid (cc65_dbginfo Handle, unsigned Id)
/* Return the direct child scopes of a scope with a given id. The function
* returns NULL if no scope with this id was found, otherwise a list of the
* returns NULL if the symbol id is invalid, otherwise a list of line infos.
*/
+const cc65_lineinfo* cc65_line_byspan (cc65_dbginfo handle, unsigned span_id);
+/* Return line information for a a span. The function returns NULL if the
+ * span id is invalid, otherwise a list of line infos.
+ */
+
void cc65_free_lineinfo (cc65_dbginfo handle, const cc65_lineinfo* info);
/* Free line info returned by one of the other functions */
* the given name was found, otherwise a non empty scope list.
*/
+const cc65_scopeinfo* cc65_scope_byspan (cc65_dbginfo handle, unsigned span_id);
+/* Return scope information for a a span. The function returns NULL if the
+ * span id is invalid, otherwise a list of line scopes.
+ */
+
const cc65_scopeinfo* cc65_childscopes_byid (cc65_dbginfo handle, unsigned id);
/* Return the direct child scopes of a scope with a given id. The function
* returns NULL if no scope with this id was found, otherwise a list of the