[DynInst_API:] [dyninst/dyninst] eba485: fix Instruction class to allow valid assignment (#...


Date: Mon, 14 Nov 2022 19:53:29 -0800
From: kupsch <noreply@xxxxxxxxxx>
Subject: [DynInst_API:] [dyninst/dyninst] eba485: fix Instruction class to allow valid assignment (#...
  Branch: refs/heads/master
  Home:   https://github.com/dyninst/dyninst
  Commit: eba4854fc95b4fd394f7b1de8fd5f0c90036a4cf
      https://github.com/dyninst/dyninst/commit/eba4854fc95b4fd394f7b1de8fd5f0c90036a4cf
  Author: kupsch <kupsch@xxxxxxxxxxx>
  Date:   2022-11-14 (Mon, 14 Nov 2022)

  Changed paths:
    M instructionAPI/h/Instruction.h
    M instructionAPI/src/Instruction.C

  Log Message:
  -----------
  fix Instruction class to allow valid assignment (#1323)

* Allow the Instruction class to allow correct assignment semantics by
  changing a member from a reference to a pointer

* The formatter member is a reference (to a singleton) that can not be
  changed after it is initialized.  Assignment to this member wrongly
  assigns to the previously bound referent singleton and wrongly slices
  the rhs to the ArchSpecificFormatter base class.  The base class has
  no data members, and since the assignment does not change the type of
  the object (its vtable), it appears to have no effect.  Also a default
  constructed Instuction object sets the formatter to the x86 formatter
  even if the host was not x86.

* Change Instruction::format to return an error string if the arch is
  set to Arch_none (default constructed, to prevent nullptr dereference)


[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] [dyninst/dyninst] eba485: fix Instruction class to allow valid assignment (#..., kupsch <=