NationalSecurityAgency / ghidra

Ghidra is a software reverse engineering (SRE) framework
https://www.nsa.gov/ghidra
Apache License 2.0
50.48k stars 5.77k forks source link

Search Text Preview incorrectly parses operand text #550

Closed mumbel closed 5 years ago

mumbel commented 5 years ago

The preview in the search text where the operands starts with a '[', the '[' is cut off.

Search Text: st.w a5]0x4,d1 Listing: st.w [a5]0x4,d1

Don't know if related but found while developing Tricore processor module, AFAICT there are no other instructions in other processor modules where the operands start like this. For the given example:

:st.w [Ra1215]off10,Rd0811 is Ra1215 & Rd0811 & op0007=0x89 ; off10 & op2227=0x24
{
    local tmp:4 = Ra1215 + off10;
    *[ram]:4 tmp = Rd0811;
}

edit: trailing ']' seems to be effected as well, but this one also has a '+' missing ld.bu d15,[a5 ld.bu d15,[a5+]

"^:\S\s\[" found only tbh in THUMB tbh r0,r1 tbh [r0,r1]

Environment (please complete the following information):

emteere commented 5 years ago

We will have to take a look at the preview in the search text, I suspect the logic needed to highlight the searched value may be the culprit.

In general complex operands (more than scalar, register, address) are usually repeated across instruction types and are put into sub-constructors. This practice isn't always followed.

mumbel commented 5 years ago

I've been thinking of the best way to handle these different addressing modes that add this kind of complexity, but have yet to come up with a good approach (with the available bits). Code reuse would be great as I do have significant code dup across my instructions at this point