reko icon indicating copy to clipboard operation
reko copied to clipboard

Mapping of static memory locations to string variables

Open Elthial opened this issue 5 years ago • 2 comments

This is functionality that is provided in some other decompilers and would be a nice to have.

If we have a static memory location in the decompiled code that points to a text string then instead of having the memory location in the decompiled code then replace with text string in question. (Optional: Annotation only if problematic?)

Text strings provide invaluable extra information on the procedures functionality when skimming the code and at least some of the DOS applications have a lot of text strings directly in code.

Elthial avatar Dec 12 '20 14:12 Elthial

The difficulty here is determining whether the pointed-to data is actually a string (and which encoding?), or whether it is other kinds of data, or even machine code whose opcodes happen to coincide with valid ASCII / text code points. Reko uses type information to help disambiguate.

One possibility is to add a user option "optimistically guess that blobs of ASCII code points (of minimum length N) are actually strings". Would this be satisfactory?

uxmal avatar Dec 14 '20 13:12 uxmal

Well there's the minimum length N that ends in Null delimiter that works for a number of DOS strings and is already in Reko in the "Find Strings" view option.

Additionally even though it's not suitable for a first-pass decompile, User-Defined variables in the globals would be nice feature for subsequent decompiles.

I'm think that if you have a static memory value then check to see if there is a global variables at that memory location and then pull that type information / value and replace.

Elthial avatar Dec 14 '20 21:12 Elthial