Skip to content

Template symbols produced by MWCC diff incorrectly #171

@1superchip

Description

@1superchip

image

The instructions in this image may be using https://github.com/simonlindholm/asm-differ/blob/main/diff.py#L3113 and https://github.com/simonlindholm/asm-differ/blob/main/diff.py#L3114.

split_off_address handles instructions with address immediates (generally branch instructions).
The line is split by a comma in split_off_address. We want the entire address/symbol to be diffed for highlighting rather than just a part of it.

def split_off_address(line: str) -> Tuple[str, str]:
    """Split e.g. 'beqz $r0,1f0' into 'beqz $r0,' and '1f0'."""
    parts = line.split(",")
    if len(parts) < 2:
        parts = line.split(None, 1)
        if len(parts) < 2:
            parts.append("")
    off = len(line) - len(parts[-1].strip())
    return line[:off], line[off:]

This image shows that when the first part of the template split by the comma differs, the line is not highlighted.
image

When the 2nd part of the template differs (split_off_address):
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions