Patch to the "missing label before goto $-1" problem
Status: Alpha
Brought to you by:
rudnai
(Summarize: change 308 line to solve the "missing label before goto $-1" problem)
In this case:
clrf mem_30, f ; 0010: 01B0 clrf mem_0c, f ; 0011: 018C ; <=== NO label_0012 !!! ; jump here from: 0032 btfss mem_05, 3 ; 0012: 1D85 goto $-1 ; 0013: 2812 <=== guilty call sub_04b ; 0014: 204B ; [...] goto ; 0032: 2812 <=== NO label_0012 !!!
The problem is with the goto $-1. The program run this ($pc = 0x0013):
523: elsif ($pc-1 == $addr) { 524: undef $prog{$addr}{label}; 525: delete $prog{$pc}{addr}; 526: $prog{$pc}{arg} = '$-1'; 527: }
In this moment, $prog{0x0012}{label} is created with a 'undef' value.
More later, when display() run:
948: # display label if any 949: if ( (exists $prog{$pc}{jumpref}) 950: or (exists $prog{$pc}{label}) ) 951: { 952: $label = getLabel($pc);
Of course, {jumpref} exists (jump to 0012), and {label} (created by goto in 0013), but at line 952, it call to getLabel():
305: my $lbl = sprintf("label_%03x", $pc); 306: 307: # oh, we have a better name for this address 308: if (exists $prog{$pc}{label}) { 309: $lbl = $prog{$pc}{label}; 310: }
the problem now is that $prog{$pc}{label} exists, but with a 'undef' value, so $lbl will by 'undef', so a void label will be show (not visible).
Solution: modify line 308:
308: if ($prog{$pc}{label}) {