1
0
mirror of https://github.com/ksherlock/x65.git synced 2025-08-09 02:25:02 +00:00

Disassembler calling graph skips fallthrough labels

- significantly cleaner calling graph in complex projects.
This commit is contained in:
Carl-Henrik Skårstedt
2016-01-14 22:08:38 -08:00
parent 1f50f07c24
commit 5b9e5f6d46

View File

@@ -2037,6 +2037,7 @@ static const char *aRefStr[] = {
static void printCalls(const int curr_ref, const call_ref *pCalls, const int num_calls, const seg_call *pLookup, const int num_lookup, char *visited, char *included, char *prefix, RefType rtype, FILE *f)
{
if (rtype != RT_FALLTHROUGH) {
RefAddr &ra = refs[curr_ref];
if (ra.label)
_lblName.copy(ra.label);
@@ -2047,9 +2048,11 @@ static void printCalls(const int curr_ref, const call_ref *pCalls, const int num
fprintf(f, "%s" STRREF_FMT " ($%x) [%s]%s\n", prefix, STRREF_ARG(_lblName), pLookup[curr_ref].address, aRefStr[rtype], (visited[curr_ref>>3] & 1<<(curr_ref&7)) ? " ...":"");
if (visited[curr_ref>>3] & 1<<(curr_ref&7))
return;
strcpy(prefix+strlen(prefix), " ");
}
visited[curr_ref>>3] |= 1<<(curr_ref&7);
included[curr_ref>>3] |= 1<<(curr_ref&7);
strcpy(prefix+strlen(prefix), " ");
for (int j = 0; j<pLookup[curr_ref].num_calls_in_seg; j++) {
int next_ref = pCalls[pLookup[curr_ref].first_call_in_seg + j].seg_trg;
if ((visited[next_ref>>3] & 1<<(next_ref&7)) == 0) {
@@ -2057,6 +2060,7 @@ static void printCalls(const int curr_ref, const call_ref *pCalls, const int num
printCalls(next_ref, pCalls, num_calls, pLookup, num_lookup, visited, included, prefix, next_type, f);
}
}
if (rtype != RT_FALLTHROUGH)
prefix[strlen(prefix)-2] = 0;
}