[DynInst_API:] [dyninst/dyninst] 67dfbb: Fix hang when creating ELF dynamic sections (#1474)


Date: Mon, 28 Aug 2023 08:58:18 -0700
From: Bolo -- Josef Burger <noreply@xxxxxxxxxx>
Subject: [DynInst_API:] [dyninst/dyninst] 67dfbb: Fix hang when creating ELF dynamic sections (#1474)
  Branch: refs/heads/bolo/amdgpu_call
  Home:   https://github.com/dyninst/dyninst
  Commit: 67dfbb4ac8f5a6c1f98395983ff3a6ba57527101
      https://github.com/dyninst/dyninst/commit/67dfbb4ac8f5a6c1f98395983ff3a6ba57527101
  Author: bbiiggppiigg <bbiiggppiigg@xxxxxxxxx>
  Date:   2023-08-03 (Thu, 03 Aug 2023)

  Changed paths:
    M symtabAPI/src/emitElf.C

  Log Message:
  -----------
  Fix hang when creating ELF dynamic sections (#1474)

This is triggered when a binary with no .rel.dyn and .rela.dyn
sections, but its target platform uses rel type relocation records.

This happened on an AMDGPU binary that was previously incorrectly
specified as using a rel relocation record.


  Commit: b6fcbb0c4f647fe4fbd39db1e0fb8cbc5cd1206f
      https://github.com/dyninst/dyninst/commit/b6fcbb0c4f647fe4fbd39db1e0fb8cbc5cd1206f
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2023-08-08 (Tue, 08 Aug 2023)

  Changed paths:
    M symtabAPI/h/Function.h

  Log Message:
  -----------
  Clean up SymtabAPI::Function classes (#1475)

* Remove undefined FunctionBase constructors

They were added by 5ed068167 in 2013, but never defined.

* Make ~FunctionBase public

FunctionBase is intended to be derived from and thus derived types can
be deleted through pointers to base. This would cause UB in the current
state.

http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-dtor-virtual

  A base class destructor should be either public and virtual, or
protected and non-virtual

* Make Function(Symbol *) public

It's awkward having it be protected and then friended so it can be used.
Just make it part of the API.

* Function should not export its interface.

These functions should override those in FunctionBase, but should not
define a new interface.

* Explicitly mark overridden members in Function

* Make InlinedFunction(FunctionBase *) public

It's awkward having it be protected and then friended so it can be used.
Just make it part of the API.

* Make ~InlinedFunction public

InlinedFunction is intended to be derived from and thus derived types
can be deleted through pointers to base. This would cause UB in the
current state.

http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-dtor-virtual

  A base class destructor should be either public and virtual, or
protected and non-virtual

* Make InlinedFunction::getModule public

It's a pure virtual member in FunctionBase, so making it protected here
means that calls through a pointer to InlinedFunction could generate a
runtime error. gcc and clang seem to "do what I mean" even though it's
ill-formed. It also removes the astonishment that `getModule` isn't
accessible through the public interface even though it is required to be
there.

>From C++11 standard (n3242):

11 Member access control [class.access]

5. It should be noted that it is access to members and base classes that
is controlled, not their visibility. Names of members are still visible,
and implicit conversions to base classes are still considered, when
those members and base classes are inaccessible. The interpretation of a
given construct is established without regard to access control. If the
interpretation established makes use of inaccessible member names or
base classes, the construct is ill-formed.

* InlinedFunction should not export its interface.

These functions should override those in FunctionBase, but should not
define a new interface.

* Explicitly mark overridden members in InlinedFunction


  Commit: d5055bcf55802fa9a57d7dd4e5397a978ee8d4d0
      https://github.com/dyninst/dyninst/commit/d5055bcf55802fa9a57d7dd4e5397a978ee8d4d0
  Author: bbiiggppiigg <bbiiggppiigg@xxxxxxxxx>
  Date:   2023-08-09 (Wed, 09 Aug 2023)

  Changed paths:
    M instructionAPI/h/ArchSpecificFormatters.h
    M instructionAPI/src/AMDGPU/gfx908/InstructionDecoder-amdgpu-gfx908.C
    M instructionAPI/src/AMDGPU/gfx908/InstructionDecoder-amdgpu-gfx908.h
    M instructionAPI/src/AMDGPU/gfx90a/InstructionDecoder-amdgpu-gfx90a.C
    M instructionAPI/src/AMDGPU/gfx90a/InstructionDecoder-amdgpu-gfx90a.h
    M instructionAPI/src/ArchSpecificFormatters.C
    M instructionAPI/src/Register.C

  Log Message:
  -----------
  Fix AMDGPU register formatting (#1473)

* Separate out AMDGPU register formatting

Here we extract the logic of displaying multiple registers as
a single operand when doing instruction formatting into a separate helper
function that is only called when the architecture is passed to
Instruction.format or Operand.format;

This change enables the ability get register operand name in two ways:
Consider s[0:3]
1. Without passing in architecture, each register will be printed separately.
That is s0,s1,s2,s3
2. By passing in architecture, the first register will return a string
for the entire group, and the rest will return empty string.
That is s[0:3],"","",""
These empty strings will later be discarded by the
ArchitectureSpecificFormatter functions.

* Fix missing parameter for makeRegisterExpression

During one of the PRs that targets compiler warning,
the num_elements parameter to makeRegisterExpression is omitted,
resulting in all register operands are displayed separately,
whether they should be displayed as a group or not.

In addition to adding the parameter, certern unused helper functions
and fields of InstructionDecoder-amdgpu-gfx*** has been removed
to avoid shadowing of variable names.

Note that this change isn't applied to vega as we don't have ISA-XML for
it.


  Commit: 9cba0b348ce2006ce8a41e8ab549f05abbac377f
      https://github.com/dyninst/dyninst/commit/9cba0b348ce2006ce8a41e8ab549f05abbac377f
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2023-08-09 (Wed, 09 Aug 2023)

  Changed paths:
    M symtabAPI/src/dwarfWalker.h

  Log Message:
  -----------
  Don't include compiler-specific headers (#1477)

Including anything in <bits/*> is not portable. Also, the contents of
this header were never used.

Stan Cox (scox@xxxxxxxxxx) reported:

It's not included as the first thing in the file, which means it can't
use the precompiled version of that header
(https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html) and
therefore it's just including the entire C++ standard library, which is
going to be much slower than just including the right headers.


  Commit: cc88eac20fdbd2b7ce3450ec1cca3e7eb417ee24
      https://github.com/dyninst/dyninst/commit/cc88eac20fdbd2b7ce3450ec1cca3e7eb417ee24
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2023-08-09 (Wed, 09 Aug 2023)

  Changed paths:
    M symtabAPI/h/Symtab.h

  Log Message:
  -----------
  Remove Symtab::forceFullLineInfoParse (#1478)

It was added by 1867619517b3 in 2015, but was never implemented.


  Commit: 5a12cccf2395d6a6fc0a5156c420016a04cf8d27
      https://github.com/dyninst/dyninst/commit/5a12cccf2395d6a6fc0a5156c420016a04cf8d27
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2023-08-11 (Fri, 11 Aug 2023)

  Changed paths:
    M symtabAPI/h/LineInformation.h
    M symtabAPI/src/LineInformation.C

  Log Message:
  -----------
  Clean up SymtabAPI::LineInformation class (#1479)

* Remove unused member variables

These were added by 0dee1c8f8 in 2016, but never used.

* Remove redundant visibility specifiers

* Remove useless comments

These are either incorrect or just noise.

* Make the class uninheritable

This appears to be some remnants of someone's scratch/dev work.

* Use a default dtor

No reason to have it.

* Reduce string copies

These parameters are only ever read from.


  Commit: fc408511ee37c72bd4444de69fd4c34bd07de786
      https://github.com/dyninst/dyninst/commit/fc408511ee37c72bd4444de69fd4c34bd07de786
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2023-08-17 (Thu, 17 Aug 2023)

  Changed paths:
    M symtabAPI/h/Symtab.h
    M symtabAPI/src/Symtab.C

  Log Message:
  -----------
  Remove Symtab::updateIndices (#1481)

Its usage was removed by cabbe58ff in 2015. It's a private function, so
there are no API/ABI issues in removing it.


  Commit: 47605aa681ca733a7d3ab6e7fbc7dee3fc83913b
      https://github.com/dyninst/dyninst/commit/47605aa681ca733a7d3ab6e7fbc7dee3fc83913b
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2023-08-17 (Thu, 17 Aug 2023)

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

  Log Message:
  -----------
  Remove unused Object::find_symbol in Object-elf (#1480)

Its usage was removed by 9de709ec5 in 2016.


  Commit: 789b9468d8a9160972e64d1aae0239e06cbf980d
      https://github.com/dyninst/dyninst/commit/789b9468d8a9160972e64d1aae0239e06cbf980d
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2023-08-17 (Thu, 17 Aug 2023)

  Changed paths:
    M symtabAPI/src/Object-elf.C

  Log Message:
  -----------
  Clean up unused global variables in Object-elf.C (#1483)

* Clean up stab globals

These were removed by 5e142effc in 2021.

* Remove unused globals from old symbol fixer

These were removed by 9de709ec5 in 2016.


  Commit: d40984a42345144c842bc7be469f9f9c9d314be5
      https://github.com/dyninst/dyninst/commit/d40984a42345144c842bc7be469f9f9c9d314be5
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2023-08-18 (Fri, 18 Aug 2023)

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

  Log Message:
  -----------
  Remove unused Object::getFileName (#1489)

Its usage was removed by 760bfda6e in 2019. It's also confusing because
it could return either the object's SONAME or the Module's filename.
These two things are not the same.


  Commit: 366f9201032c51d2f15b1c4f5f96d541a21feb7f
      https://github.com/dyninst/dyninst/commit/366f9201032c51d2f15b1c4f5f96d541a21feb7f
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2023-08-18 (Fri, 18 Aug 2023)

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

  Log Message:
  -----------
  Remove declaration of Object::load_shared_object (#1487)

Its definition was removed by 758aa226 in 2016.


  Commit: a49e5e5a882f5035cc01ca9e2962f341748b34be
      https://github.com/dyninst/dyninst/commit/a49e5e5a882f5035cc01ca9e2962f341748b34be
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2023-08-18 (Fri, 18 Aug 2023)

  Changed paths:
    M dyninstAPI/src/image.h

  Log Message:
  -----------
  Remove declaration of image::getModuleLanguageInfo (#1486)

It's definition was removed by 6c65e3c9a in 2007.


  Commit: 7132622b1fc93f763437c7f6f1170916bfc983e9
      https://github.com/dyninst/dyninst/commit/7132622b1fc93f763437c7f6f1170916bfc983e9
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2023-08-18 (Fri, 18 Aug 2023)

  Changed paths:
    M symtabAPI/h/Module.h
    M symtabAPI/src/Module.C

  Log Message:
  -----------
  Remove Module::setName (#1485)

This is never called internally. The filename corresponding to the
module is a class invariant. It makes no sense to make it mutable. This
member function is not documented.


  Commit: 369ec2d033d4554229d5e9228acdeb68791b1f85
      https://github.com/dyninst/dyninst/commit/369ec2d033d4554229d5e9228acdeb68791b1f85
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2023-08-18 (Fri, 18 Aug 2023)

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

  Log Message:
  -----------
  Remove AObject::symsToModules_ (#1488)

* Remove AObject::findModuleForSym

Its usage was removed by 4e4a375a4 in 2016.

* Remove AObject::setModuleForOffset

Its usage was removed by 0e5d83405 in 2016.

* Remove use of AObject::symsToModules_ in Object-nt

It is only ever written to, and its usage was removed by 4e4a375a4
in 2016.

* Remove use of AObject::symsToModules_ in Object-elf

It is only ever written to, and its usage was removed by 4e4a375a4
in 2016.

* Remove unused parameters and variables

These are no longer needed.


  Commit: 82268024ac1a4c180b9da876010e5b3abfa5a2ac
      https://github.com/dyninst/dyninst/commit/82268024ac1a4c180b9da876010e5b3abfa5a2ac
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2023-08-18 (Fri, 18 Aug 2023)

  Changed paths:
    R patchAPI/example/README.md
    R patchAPI/example/main.cpp
    R patchAPI/example/mutatee/main.c

  Log Message:
  -----------
  Remove patchAPI/example (#1491)

It is already in the examples repository under 'insertSnippet'.


  Commit: 692ff9f4b7e52f5689f880e01bfdd708a0dcdc14
      https://github.com/dyninst/dyninst/commit/692ff9f4b7e52f5689f880e01bfdd708a0dcdc14
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2023-08-18 (Fri, 18 Aug 2023)

  Changed paths:
    R patchAPI/test/findPoint/Makefile
    R patchAPI/test/findPoint/main.C
    R patchAPI/test/findPoint/mutatee/Makefile
    R patchAPI/test/findPoint/mutatee/lib.c
    R patchAPI/test/findPoint/mutatee/main.c
    R patchAPI/test/findPoint/run.sh

  Log Message:
  -----------
  Remove patchAPI/test/findPoint (#1490)

It uses code that is no longer available and the functionality it
covers is already in the testsuite.


  Commit: 6c2e31c0886b30f7b7b07b1e7ab840d3bb5521d1
      https://github.com/dyninst/dyninst/commit/6c2e31c0886b30f7b7b07b1e7ab840d3bb5521d1
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2023-08-21 (Mon, 21 Aug 2023)

  Changed paths:
    R parseAPI/doc/code_sample.cc
    R parseAPI/doc/example.cc

  Log Message:
  -----------
  Remove parseAPI examples (#1494)

* Remove parseAPI/doc/code_sample.cc

This exists in the dyninst/examples repository as 'disassemble'.

* Remove parseAPI/doc/example.cc

This exists in the dynint/examples repository as 'CFGraph'.


  Commit: bf6e869f966112344d627d3044f5e76fcbbc9676
      https://github.com/dyninst/dyninst/commit/bf6e869f966112344d627d3044f5e76fcbbc9676
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2023-08-21 (Mon, 21 Aug 2023)

  Changed paths:
    R dataflowAPI/tests/inst2ast/Makefile
    R dataflowAPI/tests/inst2ast/foo.c
    R dataflowAPI/tests/inst2ast/inst.txt
    R dataflowAPI/tests/inst2ast/inst2ast.C

  Log Message:
  -----------
  Move inst2ast example to examples repo (#1492)


  Commit: bef2a707838fe4d630b37445f519746a8467d808
      https://github.com/dyninst/dyninst/commit/bef2a707838fe4d630b37445f519746a8467d808
  Author: Bolo -- Josef Burger <bigtrak@xxxxxxxxxxxxxxxxxxxxxxxx>
  Date:   2023-08-28 (Mon, 28 Aug 2023)

  Changed paths:
    R dataflowAPI/tests/inst2ast/Makefile
    R dataflowAPI/tests/inst2ast/foo.c
    R dataflowAPI/tests/inst2ast/inst.txt
    R dataflowAPI/tests/inst2ast/inst2ast.C
    M dyninstAPI/src/image.h
    M instructionAPI/h/ArchSpecificFormatters.h
    M instructionAPI/src/AMDGPU/gfx908/InstructionDecoder-amdgpu-gfx908.C
    M instructionAPI/src/AMDGPU/gfx908/InstructionDecoder-amdgpu-gfx908.h
    M instructionAPI/src/AMDGPU/gfx90a/InstructionDecoder-amdgpu-gfx90a.C
    M instructionAPI/src/AMDGPU/gfx90a/InstructionDecoder-amdgpu-gfx90a.h
    M instructionAPI/src/ArchSpecificFormatters.C
    M instructionAPI/src/Register.C
    R parseAPI/doc/code_sample.cc
    R parseAPI/doc/example.cc
    R patchAPI/example/README.md
    R patchAPI/example/main.cpp
    R patchAPI/example/mutatee/main.c
    R patchAPI/test/findPoint/Makefile
    R patchAPI/test/findPoint/main.C
    R patchAPI/test/findPoint/mutatee/Makefile
    R patchAPI/test/findPoint/mutatee/lib.c
    R patchAPI/test/findPoint/mutatee/main.c
    R patchAPI/test/findPoint/run.sh
    M symtabAPI/h/Function.h
    M symtabAPI/h/LineInformation.h
    M symtabAPI/h/Module.h
    M symtabAPI/h/Symtab.h
    M symtabAPI/src/LineInformation.C
    M symtabAPI/src/Module.C
    M symtabAPI/src/Object-elf.C
    M symtabAPI/src/Object-elf.h
    M symtabAPI/src/Object-nt.C
    M symtabAPI/src/Object.C
    M symtabAPI/src/Object.h
    M symtabAPI/src/Symtab.C
    M symtabAPI/src/dwarfWalker.h
    M symtabAPI/src/emitElf.C

  Log Message:
  -----------
  Merge branch 'master' into bolo/amdgpu_call


Compare: https://github.com/dyninst/dyninst/compare/d73b4e956ca8...bef2a707838f
[← Prev in Thread] Current Thread [Next in Thread→]