Added cc65_line_byspan and cc65_scope_byspan.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5230 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -5098,6 +5098,47 @@ const cc65_lineinfo* cc65_line_bysymref (cc65_dbginfo Handle, unsigned SymId)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
void cc65_free_lineinfo (cc65_dbginfo Handle, const cc65_lineinfo* Info)
|
||||||
/* Free line info returned by one of the other functions */
|
/* Free line info returned by one of the other functions */
|
||||||
{
|
{
|
||||||
@@ -5991,6 +6032,47 @@ const cc65_scopeinfo* cc65_scope_byname (cc65_dbginfo Handle, const char* Name)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
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
|
/* 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 no scope with this id was found, otherwise a list of the
|
||||||
|
|||||||
@@ -204,6 +204,11 @@ const cc65_lineinfo* cc65_line_bysymref (cc65_dbginfo handle, unsigned symbol_id
|
|||||||
* returns NULL if the symbol id is invalid, otherwise a list of line infos.
|
* 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);
|
void cc65_free_lineinfo (cc65_dbginfo handle, const cc65_lineinfo* info);
|
||||||
/* Free line info returned by one of the other functions */
|
/* Free line info returned by one of the other functions */
|
||||||
|
|
||||||
@@ -535,6 +540,11 @@ const cc65_scopeinfo* cc65_scope_byname (cc65_dbginfo handle, const char* name);
|
|||||||
* the given name was found, otherwise a non empty scope list.
|
* 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);
|
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
|
/* 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 no scope with this id was found, otherwise a list of the
|
||||||
|
|||||||
Reference in New Issue
Block a user