Debugger: Create auto-labels on addresses that contain only a comment + create auto-labels for functions
This commit is contained in:
parent
38b50f016f
commit
eacd07d010
1 changed files with 23 additions and 2 deletions
|
@ -188,11 +188,32 @@ namespace Mesen.GUI.Debugger
|
||||||
{
|
{
|
||||||
byte[] cdlData = InteropEmu.DebugGetPrgCdlData();
|
byte[] cdlData = InteropEmu.DebugGetPrgCdlData();
|
||||||
List<CodeLabel> labelsToAdd = new List<CodeLabel>();
|
List<CodeLabel> labelsToAdd = new List<CodeLabel>();
|
||||||
|
|
||||||
for(int i = 0; i < cdlData.Length; i++) {
|
for(int i = 0; i < cdlData.Length; i++) {
|
||||||
if((cdlData[i] & (byte)CdlPrgFlags.JumpTarget) != 0 && LabelManager.GetLabel((uint)i, AddressType.PrgRom) == null) {
|
if((cdlData[i] & (byte)(CdlPrgFlags.JumpTarget | CdlPrgFlags.SubEntryPoint)) != 0) {
|
||||||
labelsToAdd.Add(new CodeLabel() { Flags = CodeLabelFlags.AutoJumpLabel, Address = (uint)i, AddressType = AddressType.PrgRom, Label = "L" + i.ToString("X4"), Comment = "" });
|
CodeLabel existingLabel = LabelManager.GetLabel((uint)i, AddressType.PrgRom);
|
||||||
|
if(existingLabel == null) {
|
||||||
|
labelsToAdd.Add(new CodeLabel() {
|
||||||
|
Flags = CodeLabelFlags.AutoJumpLabel,
|
||||||
|
Address = (uint)i,
|
||||||
|
AddressType = AddressType.PrgRom,
|
||||||
|
Label = ((cdlData[i] & (byte)CdlPrgFlags.SubEntryPoint) == 0 ? "L" : "F") + i.ToString("X4"),
|
||||||
|
Comment = ""
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if(string.IsNullOrWhiteSpace(existingLabel.Label)) {
|
||||||
|
//A comment exists for this address, add the label to it, but keep the comment and don't mark it as a auto-label
|
||||||
|
labelsToAdd.Add(new CodeLabel() {
|
||||||
|
Address = (uint)i,
|
||||||
|
AddressType = AddressType.PrgRom,
|
||||||
|
Label = ((cdlData[i] & (byte)CdlPrgFlags.SubEntryPoint) == 0 ? "L" : "F") + i.ToString("X4"),
|
||||||
|
Comment = existingLabel.Comment
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(labelsToAdd.Count > 0) {
|
if(labelsToAdd.Count > 0) {
|
||||||
LabelManager.SetLabels(labelsToAdd, true);
|
LabelManager.SetLabels(labelsToAdd, true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue