Commit graph

6 commits

Author SHA1 Message Date
Peiwei Hu
286d9bd874
Transition of virtual_files in RzBinPlugin (from list to pvector) (#4042) 2023-12-22 01:06:18 +08:00
Peiwei Hu
c0f62c529b
Refactor <libs> from RzList to RzPVector in RzBinPlugin (#3961) 2023-11-08 15:51:41 +08:00
Peiwei Hu
c9aabf8419
Refactor <resources> from RzList to RzPVector in RzBinPlugin (#3960) 2023-11-06 17:23:20 +08:00
Peiwei Hu
0063415d89
Refactor <mem> from RzList to RzPVector (#3868) 2023-09-17 20:35:28 +08:00
wargio
53e1fee6c5 Fixed regressions 2023-06-02 09:51:35 +08:00
wargio
c85b1afa4c Rewrite how bins are loaded into RzBinObject
This commit rewrites completely how RzBinPlugin are used to load info
into the RzBinObject structure.

Main changes are:
- Avoid looping multiple times to set the same data:
  now the data is cycled only once to rebase addresses, demangle strings
  and to make each loaded structure similar to each other.

- rz_bin_demangle is now demangling only strings:
  the old implementation was a hack over a hack to add classes & methods
  into the RzBinObject while demangling a string.
  This allowed methods and classes to be added to RzBinObject when for
  example invoking `is` or other printing commands.
  This was meant to be an "optimization" to avoid looping and doing
  things on-the-fly.

- Now the demangling is done after guessing the language used in the bin.
  This is done to avoid looping to various demanglers hoping that a
  string is going to be correctly demangled.
  After each string is demangled, the string is given to the language
  related function which adds classes, methods and fields into the
  RzBinObject fields.

- Swift handling is a special case, since the demangler can be disabled
  via -Duse_swift_demangler.
  The issue with the swift demangler is that is not correctly demangling
  strings and outputting swift code, but instead is creating something
  that sometimes works, sometimes doesn't.
  Also the old code only added fields and never methods for "reasons",
  and the new code just uses what the old code was doing as is.

- The new code also takes advantage of the language detection, which now
  happens before the demangling of symbols, imports and relocs.
2023-06-01 23:16:09 +08:00