[DynInst_API:] [dyninst/dyninst] 403918: Deprecate Symtab::getOrCreateModule (#1623)


Date: Tue, 07 Nov 2023 13:24:24 -0800
From: Tim Haines <noreply@xxxxxxxxxx>
Subject: [DynInst_API:] [dyninst/dyninst] 403918: Deprecate Symtab::getOrCreateModule (#1623)
  Branch: refs/heads/master
  Home:   https://github.com/dyninst/dyninst
  Commit: 4039188c7808c49d79127ea37a5c7514b1ce0869
      https://github.com/dyninst/dyninst/commit/4039188c7808c49d79127ea37a5c7514b1ce0869
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2023-11-07 (Tue, 07 Nov 2023)

  Changed paths:
    M dyninstAPI/src/binaryEdit.C
    M symtabAPI/h/Symtab.h
    M symtabAPI/src/Object-elf.C
    M symtabAPI/src/Object-elf.h
    M symtabAPI/src/Object.h
    M symtabAPI/src/Symtab.C

  Log Message:
  -----------
  Deprecate Symtab::getOrCreateModule (#1623)

* Deprecate Symtab::getOrCreateModule

There are several problems here:

1) Users shouldn't be creating modules

2) When created, the returned module must be "fixed up" before it's
useful. There's no need for that when one could be properly constructed
at the callsite inside Dyninst.

3) It violates the Single Responsibility Principle

* Add Symtab::addModule

It's private, so can only be used by friends- specifically Object.

* Use addModule throughout Symtab

* Don't update mod_lookup_ in fixSymModules

The address ranges have already been inserted there by 'addModule'.

* Use new check/add idiom for Modules in binaryEdit::writeFile

* Use new idiom in Object::fix_global_symbol_modules_static_dwarf


[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] [dyninst/dyninst] 403918: Deprecate Symtab::getOrCreateModule (#1623), Tim Haines <=