]> sourceware.org Git - dyninstfans.git/log
dyninstfans.git
7 days agoRevert "Fix duplicate base ID in x86_64 GPRs (#1702)" (#1766) dyninst/master
Kirill Batuzov [Thu, 22 Aug 2024 16:27:32 +0000 (19:27 +0300)]
Revert "Fix duplicate base ID in x86_64 GPRs (#1702)" (#1766)

This reverts commit 11baee8e51ca409b158718425d320be439bd2419.

Code for am_reg in InstructionDecoder_x86::decodeOneOperand
relies on internal register IDs being the same as their encoding
in the machine instruction.

Besides that, we need compatibility between x86 and x86_64 register IDs.

3 weeks agoAdd liveness support for AMDGPU GFX908/90A/940 (#1772)
bbiiggppiigg [Fri, 2 Aug 2024 14:41:28 +0000 (09:41 -0500)]
Add liveness support for AMDGPU GFX908/90A/940 (#1772)

* Add liveness support for AMDGPU GFX908 90A 940

6 weeks agoAMDGPU GFX90A GFX940 update based on ISA drop (2024 02-25) (#1770)
bbiiggppiigg [Wed, 17 Jul 2024 19:41:50 +0000 (14:41 -0500)]
AMDGPU GFX90A GFX940 update based on ISA drop (2024 02-25) (#1770)

* Add new registers based on ISA 2024 02-25

* Remove unused files

* GFX90A implementation update (ISA DROP 2024-0225)

* GFX940 Implementation Update (ISA DROP 2024-0225)

6 weeks agoAdd missing IGFX90A and GFX940 Indirect Analysis (#1771)
bbiiggppiigg [Wed, 17 Jul 2024 19:41:24 +0000 (14:41 -0500)]
Add missing IGFX90A and GFX940 Indirect Analysis (#1771)

6 weeks agoFix vector undefined behavior introduced in #1768 (#1769)
bbiiggppiigg [Tue, 16 Jul 2024 18:47:44 +0000 (13:47 -0500)]
Fix vector undefined behavior introduced in #1768 (#1769)

6 weeks agoFix the compiler error introduced in PR1733
bbiiggppiigg [Mon, 15 Jul 2024 21:03:40 +0000 (16:03 -0500)]
Fix the compiler error introduced in PR1733

Add missing return statements in Result.h

6 weeks agoAdd MultiRegisterAST to instructionAPI for AMDGPU (#1733)
bbiiggppiigg [Mon, 15 Jul 2024 19:14:04 +0000 (14:14 -0500)]
Add MultiRegisterAST to instructionAPI for AMDGPU (#1733)

This commit introduce a new AT that denotes the use of multiple registers as a single operand.

* Add new AST MultiRegisterAST to instructionAPI

* Update existing implementation to use MultiRegisterAST.

* The constructor of the Expression class has been restructured to avoid redundant implementation.

* Fix decodeOPR_VCC to use vcc_lo instead

* Update visibility control macros based on (#1738)

---------

Co-authored-by: kupsch <kupsch@cs.wisc.edu>
2 months agox86: correctly disassemble VMOVDQA/VMODQU instructions variants (#1761)
Kirill Batuzov [Tue, 11 Jun 2024 20:49:37 +0000 (23:49 +0300)]
x86: correctly disassemble VMOVDQA/VMODQU instructions variants (#1761)

Some of these instructions were supported, but not all. Some had incorrect number of arguments. Some vmovdqa32/vmodqa64 instructions were recognized as regular vmovdqa.

2 months agox86: add support for decoding multiple instructions and fix decoding of supported...
Dmitry Koltunov [Fri, 7 Jun 2024 20:48:46 +0000 (23:48 +0300)]
x86: add support for decoding multiple instructions and fix decoding of supported instructions (#1760)

* x86: add support for blsr, blsmsk, blsi with mem operand

Signed-off-by: koltunov <koltunov@ispras.ru>
* x86: add support for adcx, adox instructions

Signed-off-by: koltunov <koltunov@ispras.ru>
* x86: add support for vblendpd, vpblendw and fix blendps, blendpd, pblendw, vblendps instructions

Signed-off-by: koltunov <koltunov@ispras.ru>
* x86: fix decoding of vpmaskmovd,vpmaskmovq instructions

Signed-off-by: koltunov <koltunov@ispras.ru>
* x86: fix decoding of pextrb, pextrw and add vpextrw with opcode 0x15

Move pextrb and pextrw instructions to the correct position in sse_ter_table
since they are prefixed with 66 and not F2. Add support for decoding of EVEX
prefixed vpextrw instruction. Make  operands of vpextrw and vpextrb instructions
consistent with Intel manual. Add support for decoding a variant of vpextrw
instruction with opcode 0x15.

Signed-off-by: koltunov <koltunov@ispras.ru>
* x86: add rorx to vexw table

Signed-off-by: koltunov <koltunov@ispras.ru>
* x86: fix decoding of dpps and add vdpps instruction

Signed-off-by: koltunov <koltunov@ispras.ru>
* x86: fix decoding of pcmpestrm and add vpcmpestrm instruction

Signed-off-by: koltunov <koltunov@ispras.ru>
* x86: fix decoding of vbroadcastf128, movntdqa, mpsadbw, vmovntpd, vmovntps, vmovntdqa

Signed-off-by: koltunov <koltunov@ispras.ru>
* x86: fix decoding of roundps/pd/ss/sd, vrndscaleps/pd/ss/sd and add vroundps/pd/ss/sd instructions

Signed-off-by: koltunov <koltunov@ispras.ru>
2 months agox86: correctly decode 32 and 64 bit arguments of AVX instructions (#1759)
Dmitry Koltunov [Fri, 7 Jun 2024 18:14:19 +0000 (21:14 +0300)]
x86: correctly decode 32 and 64 bit arguments of AVX instructions (#1759)

Some combinations of operand types resulted in ModRM not being read.
Read ModRM when we encounter an operand that references r/m field.

Fill REX fields from VEX prefix so that we can choose correct
argument size in decodeAVX function.

Signed-off-by: koltunov <koltunov@ispras.ru>
2 months agox86: handle UD0 and UD1 instructions (#1756)
Kirill Batuzov [Thu, 6 Jun 2024 22:03:16 +0000 (01:03 +0300)]
x86: handle UD0 and UD1 instructions (#1756)

Intel manual define 3 different UD instructions: UD0, UD1, and UD2. UD2 is fully supported by Dyninst, UD0 and UD1 are not.

2 months agox86: support XOP horizontal add/sub instructions (#1753)
Kirill Batuzov [Thu, 6 Jun 2024 16:50:25 +0000 (19:50 +0300)]
x86: support XOP horizontal add/sub instructions (#1753)

2 months agoFix Race Condition in Parsing Line Map for NVIDIA Binaries (#1744)
Heather McIntyre [Sun, 2 Jun 2024 03:08:34 +0000 (22:08 -0500)]
Fix Race Condition in Parsing Line Map for NVIDIA Binaries (#1744)

* Fix Race Condition in Parsing Line Map for NVIDIA Binaries

---------

Co-authored-by: Heather McIntyre <hsm2@ufront.cs.rice.edu>
2 months agox86: handle disambiguation between XOP prefix and POP instruction (#1754)
Kirill Batuzov [Fri, 31 May 2024 22:14:31 +0000 (01:14 +0300)]
x86: handle disambiguation between XOP prefix and POP instruction (#1754)

0x8f can be either the first byte of XOP prefix, or the opcode of POP instruction. The disambiguation is resolved by map_select field of XOP's second byte. If it is XOP prefix, than the field should be from [0x8, 0x1f] range. Otherwise it is ModRM byte, and 0x8f is an opcode. The only instruction with this opcode is POP, and it requires Reg filed of ModRM to be 0.

2 months agox86: support XOP multiply-accumulate instructions (#1752)
Kirill Batuzov [Fri, 31 May 2024 21:00:20 +0000 (00:00 +0300)]
x86: support XOP multiply-accumulate instructions (#1752)

Support decoding of XOP instructions from multiply-and-accumulate group. They were partially supported before. There were IDs for them and one variant was present in decoding tables.

2 months agox86: only group opcodes from groupMap2 can be VEX-prefixed (#1747)
Kirill Batuzov [Thu, 30 May 2024 12:02:45 +0000 (15:02 +0300)]
x86: only group opcodes from groupMap2 can be VEX-prefixed (#1747)

3 months agox86: handle flag RF (#1749)
Kirill Batuzov [Tue, 28 May 2024 16:45:27 +0000 (19:45 +0300)]
x86: handle flag RF (#1749)

The only instruction supported by Dyninst that references flag RF is RSM. An attempt to getReadSet or getWriteSet for it fails.

3 months agox86: correctly detect 3DNow instruction length (#1748)
Kirill Batuzov [Mon, 27 May 2024 19:56:45 +0000 (22:56 +0300)]
x86: correctly detect 3DNow instruction length (#1748)

Also, 3DNow instructions can't be VEX-prefixed

Co-authored-by: Kirill Batuzov <kirill.batuzov1@huawei.com>
3 months agox86: check that opcode supports VEX/EVEX prefix if it is present (#1746)
Kirill Batuzov [Sun, 26 May 2024 16:43:46 +0000 (19:43 +0300)]
x86: check that opcode supports VEX/EVEX prefix if it is present (#1746)

Dyninst recognizes invalid combinations of VEX/EVEX prefixes and opcodes as valid instructions. The "&& false" check was introduced in 39caf8e and most probably is some debugging change that slipped into the main code by accident.

3 months agoFix clang warnings when SW_ANALYSIS_STEPPER=OFF. (#1742)
Tim Haines [Fri, 10 May 2024 18:27:49 +0000 (13:27 -0500)]
Fix clang warnings when SW_ANALYSIS_STEPPER=OFF. (#1742)

* Fix -Wunused-private-field in AnalysisStepper

This was found by clang's -Wunused-private-field when
SW_ANALYSIS_STEPPER=OFF.

* Fix unaligned memory read in CallChecker::isPrevInstrACall

Found by clang's -Wcast-align when SW_ANALYSIS_STEPPER=OFF.

3 months agoHide ompc_leftmost reducer if not using OpenMP (#1741)
Tim Haines [Fri, 10 May 2024 16:37:28 +0000 (11:37 -0500)]
Hide ompc_leftmost reducer if not using OpenMP (#1741)

This causes a unused function warning when USE_OpenMP=OFF.

3 months agoRemove BPatch_dll.h (#1739)
Tim Haines [Sun, 5 May 2024 21:25:48 +0000 (16:25 -0500)]
Remove BPatch_dll.h (#1739)

Since 67bc82c2d, this no longer serves a purpose. The definition for
V_libdyninstAPI was removed by dee8900a in 2011.

3 months agoConsolidate visibility control macros (#1738)
Tim Haines [Fri, 3 May 2024 21:54:01 +0000 (16:54 -0500)]
Consolidate visibility control macros (#1738)

There is no need to have one per toolkit.

This also removes the MSVC-specific check because we don't build there
and we don't have any of the visibility compiler switches set for it,
either.

3 months agoReplace utos with std::to_string (#1737)
Tim Haines [Fri, 3 May 2024 19:29:52 +0000 (14:29 -0500)]
Replace utos with std::to_string (#1737)

This function doesn't need to exist since there is a standard way of doing it now.

4 months agoUpdate Capstone importer scripts (#1734)
Tim Haines [Fri, 26 Apr 2024 14:59:34 +0000 (09:59 -0500)]
Update Capstone importer scripts (#1734)

* Restructure layout for mnemonic parsing
* Add stubs for register importing

4 months agoMachRegister: fix initialization order bug (#1731)
Tim Haines [Mon, 22 Apr 2024 20:32:12 +0000 (15:32 -0500)]
MachRegister: fix initialization order bug (#1731)

This fixes the static initialization ordering issue reported in https://github.com/dyninst/dyninst/issues/1730.

4 months agoCMake: update x86 platform detection (#1727)
Tim Haines [Fri, 19 Apr 2024 21:18:47 +0000 (16:18 -0500)]
CMake: update x86 platform detection (#1727)

4 months agofix hpctoolkit github ci workflow (#1729)
kupsch [Fri, 19 Apr 2024 12:17:32 +0000 (07:17 -0500)]
fix hpctoolkit github ci workflow (#1729)

have spack use python that it built and intalled instead of the
system python, so meson gets installed in the correct path

4 months agoFix AMDGPU register operand expansion (#1728)
bbiiggppiigg [Tue, 16 Apr 2024 00:11:37 +0000 (19:11 -0500)]
Fix AMDGPU register operand expansion (#1728)

This commit fixes an issue with the use of dynmaic_pointer_cast
in appendOperands.C, where the base type should be used in stead of
the Ptr type.

4 months agoDisable -Wdeprecated-declarations for Boost on clang > 17 (#1723)
Tim Haines [Wed, 10 Apr 2024 15:39:45 +0000 (10:39 -0500)]
Disable -Wdeprecated-declarations for Boost on clang > 17 (#1723)

It's not clear why, but clang 18 and 19 do not correctly detect that
/usr/include/boost is a system directory, and it emits warnings for
use of deprecated std::unary_function.

4 months agoignore .hmac files in system-libs github workflow (#1724)
kupsch [Wed, 10 Apr 2024 00:35:35 +0000 (19:35 -0500)]
ignore .hmac files in system-libs github workflow (#1724)

.hmac files are library files so do not try to parse

4 months agofix system-lib github workflow (#1722)
kupsch [Tue, 9 Apr 2024 18:06:21 +0000 (13:06 -0500)]
fix system-lib github workflow (#1722)

change shell code in workflow to be /bin/sh compliant instead of
using bash constructs

4 months agoimprove cmake install dirs (#1721)
kupsch [Tue, 9 Apr 2024 15:21:17 +0000 (10:21 -0500)]
improve cmake install dirs (#1721)

* Use cmake's GNUInstallDirs to get the lib, bin and include directory
  names instead of always using 'lib', 'bin', and 'include'.  This
  results in two changes to the installation:

  - lib directory becomes 'lib64' on platforms where this is the
    convention

  - the lib, bin and include may be overwritten using the cmake
    variables CMAKE_INSTALL_BINDIR, CMAKE_INSTALL_LIBDIR and
    CMAKE_INSTALL_INCLUDEDIR respectively

* Update github workflows to handle the lib install dir lib64:

  - use Dyninst_ROOT instead of Dyninst_DIR as it searches for the
    directory used

  - for non-cmake uses search for lib* to find either lib or lib64

5 months agoDead code cleanup (#1719)
Tim Haines [Tue, 26 Mar 2024 17:18:46 +0000 (12:18 -0500)]
Dead code cleanup (#1719)

* Symtab.C

  376da2b61 in 2007
  b9ee0a524 in 2007
  4025acd83 in 2012
  4e4a375a4 in 2016
  85927e97f in 2017

* instPoint.C

  d8ade2 in 2011

* Absloc.h

  cd39a7 in 2010

* headers.h

  65bd80557 in 2008
  ac8f2817 in 2008

* inst-power.C

  3169f28af in 1995
  90afda5d4 in 2002
  8f5d555a0 in 2005
  7d4113393 in 2006
  bb377beb9 in 2007
  7e70f8ea2 in 2007
  41d0401ff in 2008
  e07d7ad2e in 2009
  62b7d1f21 in 2010
  fcd67b50c in 2010
  1bdb443c7 in 2010
  b42dfb677 in 2011
  13eeea75f in 2012
  9fe681882 in 2012
  1ad3c5ead in 2018
04c9b8706 in 2018

* Remove proccontrol/notify_pipe.h

  Added empty by ac7f7e2001 in 2010

* Remove dyninstAPI/src/syscalltrap.h

  Usage removed by 7a737b6a09e in 2010

* Absloc.C

  4aa8839d9 in 2010
  8ad73999f in 2010
  0b763f360 in 2010

  Technically an ABI/API break, but it's irrelevant since no one has been
  able to use those functions since 2010.

* ia32_is_mode_64

  556bc2b3a01b in 2017

* Ternary.C

  Not sure when this was removed

* TernaryAST::makePC

  Never implemented

* Register.C

  DEBUG added by e4173885 in 2010
  Debug printing removed by a4125a9e62a in 2011

* Visitor.h

  74a1da3143 in 2016

* ProcessSet.h

  Added by c9ec57036 in 2012, but never implemented

* symtabAPI/Function.h

  name_iter added by 7a3f133bc47 in 2016, but never used

* Symbol::getVersionNum(unsigned&) const

  Added by b3c1c8e4f in 2009, but never implemented

* ProcessState::setLibraryTracker(LibraryState *)

  Added by 10ca1b477 in 2009, but never implemented

* dyninstAPI/src/ast.h

  condMatch added by c79afe66f in 2001, but not implemented

  20116a1026 in 2006
  20116a1026 in 2007
  fa14696b73 in 2009

* BPatch_image::findOrCreateVariable

  No implementation
  git has no record of this existing- even with a full pickaxe over
  the entire repo. I'd say it's ancient.

* BPatch_process::PDSEP_updateObservedCostAddr(unsigned long a)

  6293e88a8 in 2009

* BPatch_snippet::PDSEP_astMinCost()

  6293e88a8 in 2009

* CHECK_ALL_CALL_POINTS

  Last usage removed by 62b7d1f21 in 2009

* Remove decodeWaitPidStatus(procWaitpidStatus_t, EventRecord&)

  db6f2d307 in 2010

* Remove checkIfRelocatable(instruction, bool&)

  62b7d1f21 in 2010

* Remove parse_func::parseOMPSectFunc

  dee8900ad in 2011

* image.C

  80834b98d9 in 2005
  6d4e94744a in 2005
  75b6bee6b1 in 2005
  2fc202af93 in 2006
  6c65e3c9a8 in 2007
  74c0f96134 in 2008
  62b7d1f21d in 2010
  d66f3e0dcb in 2012

* dyninstAPI/src/util.h

  openFileWhenNotBusy: 23aaa1c7a in 2006
  waitForFileToExist:  e016bde56 in 2014
  uiHash:              f4613dcfe in 2008
  CThash:              7a737b6a0 in 2010
  intHash:             f8dda5e2d in 2010
  ptrHash4 added by 102d5c674 in 2005, but never implemented
  ptrHash16 added by 102d5c674 in 2005, but never implemented

* IA_aarch64.C

  Added by 0cbe6840935 in 2015, but never used
  0cbe684093 in 2015

* Parser::parse_sbp()

  bdb2cbdc8da in 2017

* Object::parseDwarfTypes(Symtab*)

  Disabled by 9c0aea7f1266d in 2012

* parseDwarf.C

  340799a201 in 2017

* BPatch_module::parseDwarfTypes()

  a3e86c198 in 2009

* Annotatable.C

  dummy_bs: 5eecdfe37 in 2009
  63c8f6a1fb in 2009
  3e890d05d7 in 2009
  'buffer' was added by 3e890d05d74 in 2009
  NON_STATIC_SPARSE_MAP, 3e890d05d74 in 2009

* ParseContainers.h

  d0fb605ef21 in 2012

* Remove emitStorePreviousStackFrameRegister

  usage removed by 4a4b40a24 in 2009,
  disabled by 90f965c1d in 2008

* emitElfStatic-aarch64.C

  AARCH64_WIDTH added by cf24b5261 in 2015, but never used
  OLD_VERSION added by f95525cbd in 2015

* emitElfStatic-ppc64.C

  5bc8d8877 in 2012
  0d6036621 in 2012
  760bfda6e in 2019
  ca68472cf in 2019
  x86 static vars added by aacf9a7c991 in 2012, but never used

* arch-x86.C

  e72838f1bc in 2016
  47b3368940 in 2016

* freebsdHeaders.h

  6647c9baa in 2010

* freebsdKludges.C

  ebd68e1b9 in 2012

* linuxHeaders.h

  dccf6451aa1 in 2006
  c51ddd7df17 in 1997

* stats.C

  3520f22bad3 in 2008

* BPatch_process.h

  3ca668c713 in 2012

* Movement-adhoc.C

  dd8f40b7b4 in 2012

* CFWidget.C

  b4d63301d1 in 2012
  758aa22669 in 2016

* Movement-analysis.C

  f891a319b in 2016

* linuxKludges.C

  839b81684 in 2007

* stats.h

  3520f22bad3 in 2008

* CFGWidget.C

  8bb4aa76a in 2011
  7ce20933e in 2011

* CodeBuffer.C

  94bceeffc8d in 2011

* Springboard.C

  fd362a2dff in 2012
  5a88f21a24 in 2018
  fb488fd49b in 2019
  8d9621ae21 in 2011

* inst-aarch64.C

  0cbe6840935 in 2015

* StackModChecker.C

  d0458f210b in 2015

* addressSpace.C

  c3fd2c456 in 2010
  fdc07b07e in 2011
  d0fb605ef in 2012
  5adcaef10 in 2012
  0efd04a78 in 2013
  827ad8e2e in 2015

* ast.C

  20116a1026 in 2006
  21d1427b92 in 2010
  4a4b40a242 in 2009

* BPatch_basicBlock.C

  0f5b6e43c in 2012
  d0fb605ef in 2012
  a91a2b261 in 2009

* BPatch_basicBlockLoop.C

  566ec0894c in 2012

* BPatch_function.C

  b66154964a in 2008

* BPatch_module.C

  d4b6dac19e4 in 2009
  0f2ad9bc29c in 2008

* BPatch_snippet.C

  23d4d4bb2 in 2009
  49ccad8e4 in 2011
  1c2eb3b7a in 2006

* codegen-x86.C

  041bad2f6 in 2015
  07c66053d in 2008
  c3fd2c456 in 2010
  da44e9b22 in 2006
  70328949c in 2011

* codeRange.C

  236581d63e in 2005
  0bce3c156c in 2006
  7a2dcd9df2 in 2010

* dynProcess.C

  9c63b2738d in 2012
  3faa4175c8 in 2012
  0efd04a781 in 2013
  0e791cce8c in 2015
  0f9e277665 in 2018

* emit-x86.C

  3173bd78e7 in 2011
  0cc0b67318 in 2012
  ab24c9bf00 in 2011

* func_instance::add_block_cb

  286b2a90835 in 2012

* instP.h

  8f5d555a082f in 2005

* Patching.h

  23f0550145 in 2011

* inst-x86.C

  f5943138c2 in 2010
  4322603c84 in 2004
  a7264f555f in 2010

* linux-x86.C

  db6f2d3076a in 2010

* mapped_module.C

  70328949c in 2011
  d2412c4d1 in 2011

* pcEventHandler.C

  0088b1285c in 2012
  4e1b40d005 in 2014
  0e791cce8c in 2015

* RTcommon.C

  127dfc766 in 2010
  bd5874eef in 2010
  3717c253e in 2011
  1e2389977 in 2011

* RTfreebsd.C

  d915f03b32 in 2012

* Dereference.h

  48f8d7b67b in 2016

* dominator.C

  ae9230394c in 2014

* IA_IAPI.C

  8cbd0fee4 in 2011
  f5e3d0030 in 2011

* IA_power.C

  641f99f4e in 2010
  5274e3bb2 in 2011
  2e0f15515 in 2011
  b0d83c42f in 2012

* PatchBlock.C

  f8842b40f6 in 2011

* freebsd.C

  9b1e7b5a2 in 2010
  d6399d41e in 2010

* int_thread_db.C

  f5e3492a81 in 2011

* linux.C

  579ba55f71 in 2011
  b0ced1cb30 in 2015
  bc243bcb9e in 2018

* pcerrors.C

  b0ced1cb30 in 2015

* emitElf.C

  5bc8d8877 in 2012
  00098a1bb in 2016
  91bdb5e73 in 2016
  8c333ece5 in 2019
  4e14b3ebc in 2020

* symtabAPI/Function.C

  e1ed71e36c in 2009
  2ce1f7662c in 2015

* Object-elf.C

  a382e03ffa in 2012
  758aa22669 in 2016
  3a7d20c3f2 in 2017
  0600a498fd in 2017

* Symtab-lookup.C

  b82201865c in 2008
  dc7c82aa91 in 2012
  2d4c889dbb in 2018

* Type.C

  b9ee0a524 in 2007
  6a792a92a in 2008
  349d38cea in 2008
  3e890d05d in 2009
  d2e866379 in 2009

5 months agoRemove LivenessAnalyzer::query(ParseAPI::Location,Type,OutputIterator) (#1718)
Tim Haines [Fri, 22 Mar 2024 19:57:42 +0000 (14:57 -0500)]
Remove LivenessAnalyzer::query(ParseAPI::Location,Type,OutputIterator) (#1718)

It has never worked because it doesn't dereference the output
iterator.

5 months agoRemove unused annotations (#1717)
Tim Haines [Fri, 22 Mar 2024 16:25:20 +0000 (11:25 -0500)]
Remove unused annotations (#1717)

* CommonBlockUpPtr

This was added by d4b6dac19 in 2009, but was never written to. The
check on line 243 would always pass and getCblocks would return an
empty vector.

* FunctionLocalVariablesAnno

Its usage was removed by 5ed068167 in 2013.

* Remove FunctionParametersAnno

Its usage was removed by 5ed068167 in 2013.

* Remove IdToSymMap

Its usage was remove dby c42859c30 in 2016.

* Remove ImageFuncUpPtrAnno

Its usage was removed by 5ed068167 in 2013.

* Remove LocalVarUpPtrAnno

It was added by d2e866379 in 2009, but has always been write-only.

* Remove ModuleLineInfoAnno

Its usage was remove by 186761951 in 2014.

* Remove ModuleTypeInfoAnno

Its usage was removed by 186761951 in 2014.

* Remove UserFuncsAnno

Its usage was removed by 74c0f9613 in 2008.

* Remove UserSymbolsAnno

Its usage was removed by 74c0f9613 in 2008.

5 months agoUse fix-width type for MachRegister format (#1716)
Tim Haines [Fri, 22 Mar 2024 06:30:31 +0000 (01:30 -0500)]
Use fix-width type for MachRegister format (#1716)

This ensures the same number of bits is available on all platforms.

Fix comments: the fields are 8 bits wide, not 16.

5 months agoGitHub CI: only run tests when source code changes (#1714)
Tim Haines [Thu, 21 Mar 2024 16:03:20 +0000 (11:03 -0500)]
GitHub CI: only run tests when source code changes (#1714)

5 months agoGitHub CI: use stronger error reporting in 'system-libs' action (#1715)
Tim Haines [Thu, 21 Mar 2024 16:03:07 +0000 (11:03 -0500)]
GitHub CI: use stronger error reporting in 'system-libs' action (#1715)

5 months agoFix definition of MachRegister::getAllRegistersForArch (#1709)
Tim Haines [Mon, 11 Mar 2024 21:55:30 +0000 (16:55 -0500)]
Fix definition of MachRegister::getAllRegistersForArch (#1709)

It's defined in the wrong scope, so it's not accessible outside of MachRegister.C.

Introduced by 88ad81c14 in 2024.

5 months agoMachRegister: Add interface for collecting and retrieving all registers (#1703)
Tim Haines [Mon, 11 Mar 2024 18:18:29 +0000 (13:18 -0500)]
MachRegister: Add interface for collecting and retrieving all registers (#1703)

This makes writing ABI rules much simpler. It could also be useful for
some power users. The registers returned are in the order they are
declared in common/h/registers/<arch>_regs.h.

Names are only save the register when a name is given because
the other constructor is used to convert registers (e.g., getBaseRegister)
and would create duplicates entries since the name isn't changed.

5 months agoFix duplicate base ID in x86_64 GPRs (#1702)
Tim Haines [Mon, 11 Mar 2024 17:21:43 +0000 (12:21 -0500)]
Fix duplicate base ID in x86_64 GPRs (#1702)

FLAGS and BASEA should be unique.

This was introduced by 30f08e7b in 2023.

5 months agoGithubCI: don't run tests for draft PRs (#1704)
Tim Haines [Mon, 11 Mar 2024 17:15:06 +0000 (12:15 -0500)]
GithubCI: don't run tests for draft PRs (#1704)

5 months agoDo not kill caller-saved registers when slicing backward (#1705)
Tim Haines [Mon, 11 Mar 2024 17:14:44 +0000 (12:14 -0500)]
Do not kill caller-saved registers when slicing backward (#1705)

This check was added by 578ff24aa 2017, but the logic is inverted. From
the commit message:

  Currently when backward slicing, a absloc that is written by call
  defined by abi will be killed, however, caller saved registers
  can/should survive

It's also unclear why r11 was excluded as it's not saved across
function calls (i.e., not callee-saved).

5 months agoGithubCI: use verbose output with ctest (#1706)
Tim Haines [Mon, 11 Mar 2024 17:14:01 +0000 (12:14 -0500)]
GithubCI: use verbose output with ctest (#1706)

This will help with debugging test failures.

5 months agoRemove dead byte-swapping code in dyninstAPI codegen (#1697)
Tim Haines [Mon, 4 Mar 2024 13:46:49 +0000 (07:46 -0600)]
Remove dead byte-swapping code in dyninstAPI codegen (#1697)

* Remove insnCodeGen::ptrAndInc

It was added by 311466419 in 2015 as commented-out code.

* Remove use of endian_mismatch macro

Its use was removed by 44507e6b0 in 2013.

* Remove insnPtr

It was only used by ptrAndInc.

5 months agoAdd CodeObject::parse overloads to accept multiple targets
Kirill Batuzov [Fri, 1 Mar 2024 20:27:22 +0000 (23:27 +0300)]
Add CodeObject::parse overloads to accept multiple targets

Parser::parse_at takes only one target at a time. This has two repercussions:

  1) It can't take full advantage of parallel parsing when there are multiple targets in need of it.

 2)  It still enters and exits OMP parallel loop. This operation has its own performance overhead that
    depends on the host system (number of processors and OMP configuration). This overhead can be very significant.

This change introduces Parser::parse_vec that takes a vector of targets and parses them in parallel.

When there are significant number of parse_at calls, performance gains from migrating to parse_vec can be huge. Parsing what initial parse() missed in libLLVM-12.so.1 with parse_at took nearly 20 minutes on 4-core hyper-threaded
CPU. Doing the same with parse_vec took less than 4 minutes. On 128-bit ARM64 server we've seen even bigger gains
(from around 40 minutes to less than 3).

Co-authored-by: Kirill Batuzov <kirill.batuzov1@huawei.com>
5 months agoRemove bitArray SPEC_*_BIT macros (#1696)
Tim Haines [Fri, 1 Mar 2024 17:33:52 +0000 (11:33 -0600)]
Remove bitArray SPEC_*_BIT macros (#1696)

They were added by 3a70928cc in 2007, but never used.

5 months agorelease 13.0.0 versions & docs (#1695) v13.0.0
kupsch [Thu, 29 Feb 2024 23:12:39 +0000 (17:12 -0600)]
release 13.0.0 versions & docs (#1695)

- update dyninst version

- update CHANGELOG.md

- produce manuals with updated release dates and versions

- fix .tex files to eliminate latex errors:
  - invalid char in symtabAPI/doc/API/Types/Type.tex
  - invalid char in parseAPI/doc/API/Function.tex
  - invalid char in patchAPI/doc/section/4_api_public.tex
  - invlide line break in parseAPI/doc/API/CodeObject.tex

- restore parseAPI example code needed by docs removed in 6c2e31c0

Co-authored-by: James Kupsch <kupsch@vmbp15.local>
5 months agoGithub CI: add unit tests (#1694)
Tim Haines [Thu, 29 Feb 2024 22:26:31 +0000 (16:26 -0600)]
Github CI: add unit tests (#1694)

6 months agoUnify software interrupt instruction detection (#1693)
Tim Haines [Wed, 28 Feb 2024 06:12:32 +0000 (00:12 -0600)]
Unify software interrupt instruction detection (#1693)

* Move isInterrupt to InstructionAPI

* Use InstructionAPI::isInterrupt in IA_IAPI::isInterruptOrSyscall

* Use InstructionAPI::isInterrupt in LivenessAnalyzer::calcRWSets

* Remove IA_IAPI::isInterrupt

It is replaced by InstructionAPI::isInterrupt

6 months agoUnify system call detection (#1692)
Tim Haines [Tue, 27 Feb 2024 23:00:01 +0000 (17:00 -0600)]
Unify system call detection (#1692)

* Move isSyscall to instructionAPI

* Use InstructionAPI::isSystemCall in LivenessAnalyzer::calcRWSets

* Use InstructionAPI::isSystemCall in PCSensitiveTransformer::process

* Use InstructionAPI::isSystemCall in Parse::parse_frame_one_iteration

* Use InstructionAPI::isSystemCall in IA_IAPI::getNewEdges

* Remove IA_IAPI::isSyscall

It is replaced by InstructionAPI::isSystemCall.

6 months agoRemove explicit check for system calls in parse_frame_one_iteration (#1691)
Tim Haines [Tue, 27 Feb 2024 20:41:36 +0000 (14:41 -0600)]
Remove explicit check for system calls in parse_frame_one_iteration (#1691)

165f19cd and 091929d6 changed the parsing semantics of system calls
such that software interrupts (e.g., `int` on x86) are always
interpreted as system calls. The `hasCFT()` check on line 1824 now
covers all of the system call cases because it considers those
instructions to have a control flow target (CFT).

Its non-use was verified against /usr/libx32/libc.so.6,
/usr/lib/i386-linux-gnu/libc.so.6, /usr/lib/x86_64-linux-gnu/libc.so.6,
and /usr/lib32/libc.so.6 on Ubuntu 22.04.

6 months agoupdate copyright header and date (#1689)
kupsch [Tue, 27 Feb 2024 17:56:45 +0000 (11:56 -0600)]
update copyright header and date (#1689)

- update COPYRIGHT files's notice to include 2024

- update copyright header in source files to reference COPYRIGHT

6 months agoFix logic error in IA_IAPI::isInterruptOrSyscall (#1683)
Tim Haines [Tue, 27 Feb 2024 17:54:27 +0000 (11:54 -0600)]
Fix logic error in IA_IAPI::isInterruptOrSyscall (#1683)

This was broken by e7db16f5 in 2010.

6 months agoAdd CMake option to control symbol visibility (#1688)
Tim Haines [Mon, 26 Feb 2024 20:16:44 +0000 (14:16 -0600)]
Add CMake option to control symbol visibility (#1688)

Currently, all symbols are hidden by default and
then explicitly made visible. This is the behavior
we want for publishing Dyninst libraries, but unit
testing the internal functionality requires access
to these symbols. This option allows that.

6 months agoImprove syscall and interrupt instruction detection (#1686)
Tim Haines [Mon, 26 Feb 2024 16:38:05 +0000 (10:38 -0600)]
Improve syscall and interrupt instruction detection (#1686)

* Treat x86 software interrupts as system calls

* Correct detection of Linux vsyscall for 32-bit code

The existing code did not work because the Operand formatter uses AT&T
syntax and doesn't convert hex to decimal, so the '== "16"' check
always failed.

The convoluted logic in the visitor is needed because Dyninst does not
generate AST for segment registers. Yet, it _does_ record if they are
read/written.

The AST for the 'gs' register was made a file scope static because its
initialization would cause some glibc's to throw a
__gnu_cxx::recursive_init_error when using multiple threads.

* aarch64 - add svc

Supervisor Call

* ppc - add system call

* Add int1, into to IA_x86::isInterrupt

6 months agoRemove unreachable code in BPatch_addressSpace::getRegisters (#1687)
Tim Haines [Mon, 26 Feb 2024 16:35:35 +0000 (10:35 -0600)]
Remove unreachable code in BPatch_addressSpace::getRegisters (#1687)

6 months agoRefactor IA_IAPI::isSyscall,isInterrupt into arch-specific files (#1684)
Tim Haines [Mon, 19 Feb 2024 18:20:15 +0000 (12:20 -0600)]
Refactor IA_IAPI::isSyscall,isInterrupt into arch-specific files (#1684)

* Refactor IA_IAPI::isSyscall,isInterrupt into arch-specific files

This also requires those members be defined for all classes derived
from IA_IAPI.

6 months agoRemove dyninstAPI/Relocation/Transformers/Defensive.C (#1685)
Tim Haines [Mon, 19 Feb 2024 17:28:18 +0000 (11:28 -0600)]
Remove dyninstAPI/Relocation/Transformers/Defensive.C (#1685)

File deleted by 8bb4aa76a on 2011-02-08
Reintroduced by 976099e5d on 2011-03-18
Removed from dyninstAPI.vcproj by 78e8ab184 on 2011-04-29
Refers to header files renamed by 91246b9ca on 2011-05-12

6 months agoIndirectAnalyzer: fix potential segfault (#1672)
Илья [Mon, 19 Feb 2024 17:13:40 +0000 (20:13 +0300)]
IndirectAnalyzer: fix potential segfault (#1672)

Co-authored-by: Ilya Shlyapin <ilya.shlyapin@huawei.com>
6 months agocorrectly detect x86 LEA instructions as NOP (#1681)
kupsch [Mon, 19 Feb 2024 15:22:46 +0000 (09:22 -0600)]
correctly detect x86 LEA instructions as NOP (#1681)

LEA is a NOP if and only if the two operands refer to the same
register after simplifying binary expressions with identity
operands.

6 months agofix operator<< for Module* (#1682)
kupsch [Thu, 15 Feb 2024 19:30:10 +0000 (13:30 -0600)]
fix operator<< for Module* (#1682)

fix nullptr dereference if Module* is nullptr; print "null" instead

6 months agoRemove unprintable characters from common/src/Timer.C (#1679)
Tim Haines [Tue, 13 Feb 2024 19:03:14 +0000 (13:03 -0600)]
Remove unprintable characters from common/src/Timer.C (#1679)

6 months agoUse code region boundaries for ParseAPI::Function::less comparator (#1668)
Kirill Batuzov [Mon, 5 Feb 2024 17:52:26 +0000 (20:52 +0300)]
Use code region boundaries for ParseAPI::Function::less comparator (#1668)

Co-authored-by: Kirill Batuzov <kirill.batuzov1@huawei.com>
7 months agoGithubCI: update systemtap weekly test build (#1676)
Tim Haines [Thu, 18 Jan 2024 21:10:09 +0000 (15:10 -0600)]
GithubCI: update systemtap weekly test build (#1676)

* Use newer autoconf

2.71 is now the minimum

* Run autoreconf before build

The provided configure seems to only be updated on releases.

* Don't build python/java probes

They don't currently work with out-of-source builds.

7 months agoGithubCI: don't fail fast for PR tests (#1666)
Tim Haines [Wed, 10 Jan 2024 20:35:01 +0000 (14:35 -0600)]
GithubCI: don't fail fast for PR tests (#1666)

This will make re-running the failed actions cheaper.

7 months agoGithubCI: only build hpctoolkit@develop (#1667)
Tim Haines [Wed, 10 Jan 2024 20:34:44 +0000 (14:34 -0600)]
GithubCI: only build hpctoolkit@develop (#1667)

Building the HEAD of dynininst against the last release of HPCToolkit
is a good idea for tracking breaking changes, but it ultimately
produced more noise than signal. Making sure that HPCToolkit's latest
source will compile with Dyninst's latest source is likely a better
measure.

7 months agoGithubCI: Add weekly test for parsing all system libs in containers (#1665)
Tim Haines [Wed, 10 Jan 2024 17:58:51 +0000 (11:58 -0600)]
GithubCI: Add weekly test for parsing all system libs in containers (#1665)

7 months agoGithub CI: Use gcc-13 for c++2{0,3} (#1664)
Tim Haines [Wed, 10 Jan 2024 16:28:29 +0000 (10:28 -0600)]
Github CI: Use gcc-13 for c++2{0,3} (#1664)

gcc-12 has some STL bugs for these standards.

7 months agoSuppress -Wframe-larger-than in power_opcode_table in clang-1{3,7} (#1662)
Tim Haines [Tue, 9 Jan 2024 23:28:24 +0000 (17:28 -0600)]
Suppress -Wframe-larger-than in power_opcode_table in clang-1{3,7} (#1662)

Debug builds with clang-13 now have stack frame consumption of 37512
bytes. I think this is due to upstream patch version bumps in Ubuntu.

7 months agoFix libstdc++ noexcept requirement for Operand ctor (#1663)
Tim Haines [Tue, 9 Jan 2024 22:39:36 +0000 (16:39 -0600)]
Fix libstdc++ noexcept requirement for Operand ctor (#1663)

As you can see below, std::constuct_at is requiring that Operand be
noexcept constructible. I _think_ this is a QoI item in libstdc++.

1. The offending call to std::vector::resize(size_type) at
   RoseInsnFactory.C:152 is covered by the note in
   (https://en.cppreference.com/w/cpp/container/vector/resize):

  In overload (1), if T's move constructor is not noexcept and T is not
  CopyInsertable into *this, vector will use the throwing move
  constructor. If it throws, the guarantee is waived and the effects
  are unspecified.

2. Operand's ctor is _not_ noexcept, but it _is_ CopyInsertable
   (https://en.cppreference.com/w/cpp/named_req/CopyInsertable), so we
   get the second part and encounter UB.

3. A note on CopyInsertable says that a CopyInsertable must use
   std::construct_at (see cppref page above), and std::construct_at has
   a caveat of behavior (https://en.cppreference.com/w/cpp/memory/construct_at):

  Specialization of this function template participates in overload
  resolution only if
  ::new(std::declval<void*>()) T(std::declval<Args>()...) is well-formed
  in an unevaluated context.

From (1), we would get UB in constexpr context, but
RoseInsnFactory.C:152 isn't in a constexpr context... We have to use
std::construct_at by (2). I think the QoI issue is that (3) gets
enforced even though we aren't in a constexpr context.

In file included from /usr/include/c++/12/bits/char_traits.h:46,
                 from /usr/include/c++/12/string:40,
                 from /dyninst/src/common/h/entryIDs.h:34,
                 from /dyninst/src/dataflowAPI/src/RoseInsnFactory.h:34,
                 from /dyninst/src/dataflowAPI/src/RoseInsnFactory.C:30:
/usr/include/c++/12/bits/stl_construct.h: In instantiation of 'constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...) [with _Tp = Dyninst::InstructionAPI::Operand; _Args = {}; decltype (::new(void*(0)) _Tp) = Dyninst::InstructionAPI::Operand*]':
/usr/include/c++/12/bits/stl_construct.h:115:21:   required from 'constexpr void std::_Construct(_Tp*, _Args&& ...) [with _Tp = Dyninst::InstructionAPI::Operand; _Args = {}]'
/usr/include/c++/12/bits/stl_uninitialized.h:638:18:   required from 'static constexpr _ForwardIterator std::__uninitialized_default_n_1<_TrivialValueType>::__uninit_default_n(_ForwardIterator, _Size) [with _ForwardIterator = Dyninst::InstructionAPI::Operand*; _Size = long unsigned int; bool _TrivialValueType = false]'
/usr/include/c++/12/bits/stl_uninitialized.h:701:20:   required from 'constexpr _ForwardIterator std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = Dyninst::InstructionAPI::Operand*; _Size = long unsigned int]'
/usr/include/c++/12/bits/stl_uninitialized.h:766:44:   required from 'constexpr _ForwardIterator std::__uninitialized_default_n_a(_ForwardIterator, _Size, allocator<_Tp>&) [with _ForwardIterator = Dyninst::InstructionAPI::Operand*; _Size = long unsigned int; _Tp = Dyninst::InstructionAPI::Operand]'
/usr/include/c++/12/bits/vector.tcc:644:35:   required from 'constexpr void std::vector<_Tp, _Alloc>::_M_default_append(size_type) [with _Tp = Dyninst::InstructionAPI::Operand; _Alloc = std::allocator<Dyninst::InstructionAPI::Operand>; size_type = long unsigned int]'
/usr/include/c++/12/bits/stl_vector.h:1011:4:   required from 'constexpr void std::vector<_Tp, _Alloc>::resize(size_type) [with _Tp = Dyninst::InstructionAPI::Operand; _Alloc = std::allocator<Dyninst::InstructionAPI::Operand>; size_type = long unsigned int]'
/dyninst/src/dataflowAPI/src/RoseInsnFactory.C:152:20:   required from here
/usr/include/c++/12/bits/stl_construct.h:95:14: error: noexcept-expression evaluates to 'false' because of a call to 'Dyninst::InstructionAPI::Operand::Operand(Dyninst::InstructionAPI::Expression::Ptr, bool, bool, bool, bool, bool)' [-Werror=noexcept]
   95 |     noexcept(noexcept(::new((void*)0) _Tp(std::declval<_Args>()...)))
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /dyninst/src/instructionAPI/h/Instruction.h:43,
                 from /dyninst/src/dataflowAPI/src/RoseInsnFactory.h:40:
/dyninst/src/instructionAPI/h/Operand.h:69:16: note: but 'Dyninst::InstructionAPI::Operand::Operand(Dyninst::InstructionAPI::Expression::Ptr, bool, bool, bool, bool, bool)' does not throw; perhaps it should be declared 'noexcept'
   69 |       explicit Operand(Expression::Ptr val = {}, bool read = false, bool written = false, bool implicit = false,
      |                ^~~~~~~
cc1plus: all warnings being treated as errors
gmake[2]: *** [parseAPI/CMakeFiles/parseAPI.dir/build.make:678: parseAPI/CMakeFiles/parseAPI.dir/__/dataflowAPI/src/RoseInsnFactory.C.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[1]: *** [CMakeFiles/Makefile2:471: parseAPI/CMakeFiles/parseAPI.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
Error: Process completed with exit code 2.

7 months agoGithub CI: Pass '-y' to apt when removing libomp (#1661)
Tim Haines [Tue, 9 Jan 2024 21:59:59 +0000 (15:59 -0600)]
Github CI: Pass '-y' to apt when removing libomp (#1661)

Should have been part of 39899e55bf.

7 months agoDocker: only build base images in build_base_images.sh (#1660)
Tim Haines [Tue, 9 Jan 2024 20:56:29 +0000 (14:56 -0600)]
Docker: only build base images in build_base_images.sh (#1660)

Should probably only do what's written on the tin.

7 months agoGithubCI: Add gcc-13, clang-16,17 to multicompiler builds (#1659)
Tim Haines [Tue, 9 Jan 2024 20:47:01 +0000 (14:47 -0600)]
GithubCI: Add gcc-13, clang-16,17 to multicompiler builds (#1659)

* Remove libomp before installing clang

* GithubCI: Add gcc-13, clang-16,17 to multicompiler builds

7 months agoDon't use capture lambda in ParseAPI::parsing_printf_int (#1658)
Tim Haines [Tue, 9 Jan 2024 20:27:45 +0000 (14:27 -0600)]
Don't use capture lambda in ParseAPI::parsing_printf_int (#1658)

This trips a clang-12 ICE.

https://github.com/llvm/llvm-project/issues/49904

7 months agoRemove common/machineType.h (#1657)
Tim Haines [Sun, 31 Dec 2023 18:41:34 +0000 (12:41 -0600)]
Remove common/machineType.h (#1657)

Its usage was removed by b57a84ce3f in 1995.

7 months agoRemove non-printable characters from common/lprintf.h (#1656)
Tim Haines [Sat, 30 Dec 2023 16:11:07 +0000 (10:11 -0600)]
Remove non-printable characters from common/lprintf.h (#1656)

8 months agoMove addrRange.h into stackwalk (#1655)
Tim Haines [Fri, 29 Dec 2023 15:07:52 +0000 (09:07 -0600)]
Move addrRange.h into stackwalk (#1655)

It's the only placed it's used.

8 months agoWrite to stderr in ParseAPI::parsing_printf (#1650)
Tim Haines [Wed, 27 Dec 2023 18:31:53 +0000 (12:31 -0600)]
Write to stderr in ParseAPI::parsing_printf (#1650)

Using a per-thread file here is cumbersome. Including the thread id in
the message and synchronizing the writes makes this work for multiple
threads.

8 months agoRemove dataflowAPI/src/templates.C (#1654)
Tim Haines [Wed, 27 Dec 2023 17:46:53 +0000 (11:46 -0600)]
Remove dataflowAPI/src/templates.C (#1654)

It was added by 8d6626c1 in 2010, but never touched.

8 months agoGithubCI : Add more Ubuntu and Fedora versions (#1652)
Tim Haines [Tue, 26 Dec 2023 19:51:33 +0000 (13:51 -0600)]
GithubCI : Add more Ubuntu and Fedora versions (#1652)

8 months agoRemove proccontrol/dumplibpthread.asm (#1651)
Tim Haines [Tue, 26 Dec 2023 18:04:35 +0000 (12:04 -0600)]
Remove proccontrol/dumplibpthread.asm (#1651)

It's an objdump of libpthread from aarch64. It was added by bb8c30c81
in 2015, but never touched.

8 months agoDocker: Use named arguments in build scripts (#1648)
Tim Haines [Tue, 26 Dec 2023 17:34:45 +0000 (11:34 -0600)]
Docker: Use named arguments in build scripts (#1648)

8 months agoDocker: add script to build all base images (#1649)
Tim Haines [Tue, 26 Dec 2023 17:34:05 +0000 (11:34 -0600)]
Docker: add script to build all base images (#1649)

8 months agoFix register check in LivenessAnalyzer::isMMX (#1644)
Tim Haines [Fri, 22 Dec 2023 16:39:15 +0000 (10:39 -0600)]
Fix register check in LivenessAnalyzer::isMMX (#1644)

There is no requirement that the two values for MMX be the same
between the two architectures.

8 months agoRemove unused debug code from AMD 908,90a instruction decoder (#1645)
Tim Haines [Wed, 13 Dec 2023 17:26:06 +0000 (11:26 -0600)]
Remove unused debug code from AMD 908,90a instruction decoder (#1645)

8 months agoClean up InstructionAPI::Operation (#1643)
Tim Haines [Wed, 13 Dec 2023 17:25:42 +0000 (11:25 -0600)]
Clean up InstructionAPI::Operation (#1643)

* Merge InstructionAPI::Operation and InstructionAPI::Operation_impl

The only place the impl is used is by Operation, so there's no need to
have them separate. This makes it easier to look up member functions
for Operation.

* Remove operator==

It's neither used nor documented. 'hash_value' is only used here, so
remove it, as well.

8 months agoSet new CMake policy for upper-case <NAME>_ROOT variables (#1642)
Tim Haines [Tue, 5 Dec 2023 18:05:48 +0000 (12:05 -0600)]
Set new CMake policy for upper-case <NAME>_ROOT variables (#1642)

In CMake 3.27 and above the find_package(<PackageName>) command now
searches prefixes specified by the upper-case <PACKAGENAME>_ROOT CMake
variable and the <PACKAGENAME>_ROOT environment variable in addition to
the case-preserved <PackageName>_ROOT and <PackageName>_ROOT variables
used since policy CMP0074. This policy provides compatibility with
projects that have not been updated to avoid using <PACKAGENAME>_ROOT
variables for other purposes.

The OLD behavior for this policy is to ignore <PACKAGENAME>_ROOT
variables if the original <PackageName> has lower-case characters. The
NEW behavior for this policy is to use <PACKAGENAME>_ROOT variables.

8 months agoClean up includes in instructionAPI/Result.h (#1641)
Tim Haines [Fri, 1 Dec 2023 20:42:13 +0000 (14:42 -0600)]
Clean up includes in instructionAPI/Result.h (#1641)

* Remove unused stringstream include

* Use cstdint instead of custom defines

* Use cassert instead of assert.h

* Include common/util.h for INSTRUCTION_EXPORT

8 months agoAdd debugging functions for instructionAPI (#1640)
Tim Haines [Fri, 1 Dec 2023 19:15:00 +0000 (13:15 -0600)]
Add debugging functions for instructionAPI (#1640)

9 months agoAdd DWARF mappings for cr8-15 and dr8-15 (#1639)
Tim Haines [Wed, 29 Nov 2023 21:41:58 +0000 (15:41 -0600)]
Add DWARF mappings for cr8-15 and dr8-15 (#1639)

9 months agoAdd missing x86_64 control and debug registers (#1638)
Tim Haines [Wed, 29 Nov 2023 12:12:01 +0000 (06:12 -0600)]
Add missing x86_64 control and debug registers (#1638)

9 months agoSynchronize x86 mnemonics with Capstone (#1634)
Tim Haines [Wed, 29 Nov 2023 01:00:07 +0000 (19:00 -0600)]
Synchronize x86 mnemonics with Capstone (#1634)

* Create Capstone import script

This currently only supports x86, but can be readily expanded to the
other architectures.

* Remove invalid opcodes

Some of these are used to label subtypes of the general
instruction and some are just madeup mnemonics that were never
used in Dyninst.

* Move pseudo-mnemonics to top of file

This makes them easier to see.

* Remove AT&T aliases

* Replace fstcw with fnstcw
* Replace fstenv with fnstenv
* Replace fstsw with fnstsw
* Replace fsave with fnsave

The fstX instructions are actually aliases for 'waitf' followed by
the fnstX variant. There's no need to have both.

* Rename loopn -> loopne

loopn isn't a valid mnemonic for 0xE0.

* Remove e_jmpe

The opcode 0x0FB8 is decoded as popcnt unless the preceeding byte is
0xF3. However, not even Xed decodes this instruction. From Table A-3 of
the June 2021 Intel SDM:

  JMPE (reserved for emulator on IPF)

* Rename cmpxch -> cmpxchg
* Rename e_cmpxch -> e_cmpxchg
* Rename cmpxch8b -> cmpxchg8b
* Rename e_prefetchNTA -> e_prefetchnta
* Rename e_prefetchT0 -> e_prefetcht0
* Rename e_prefetchT1 -> e_prefetcht1
* Rename e_prefetchT2 -> e_prefetcht2
* Rename e_punpcklqld -> e_punpcklqdq

* Rename e_shl_sal -> e_shl

There's no real concensus, but Capstone and Xed use shl.

* Rename e_ud -> e_ud0

* Make cmovnbe an alias of cmova
* Make cmovnb an alias of cmovae
* Make cmovnae an alias of cmovb
* Make cmovng an alias of cmovle
* Make cmovnge an alias of cmovl
* Make cmovnl an alias of cmovge
* Make cmovpe an alias of cmovp
* Make cmovpo an alias of cmovnp
* Make cwd an alias of cdq
* Make fcomip an alias of fcompi
* Make fucomip an alias of fucompi
* Make jnb an alias of jae
* Make jnbe an alias of ja
* Make jnl an alias of jge
* Make jnle an alias of jg
* Make jnz an alias of jne
* Make jz an alias of je
* Make jrcxz an alias of jcxz
* Make lods an alias of lodsb

* Make popa an alias of popal

popal isn't a valid mnemonic, but it's what Capstone uses.

* Make popad an alias of popaw

popaw isn't a valid mnemonic, but it's what Capstone uses.

* Make pushad, pusha, and pushaw aliases of pushal

pushal isn't a valid mnemonic, but it's what Capstone uses.

* Make pushfd an alias of pushf
* Make setnb an alias of setae
* Make setnbe an alias of seta
* Make setnl an alias of setge
* Make setnle an alias of setg
* Make setnz an alias of setne
* Make setz an alias of sete
* Make xlat an alias of xlatb

* Add new mnemonics

9 months agoAdd x86_{i386,64} memory-management and x87 control/status registers (#1636)
Tim Haines [Tue, 28 Nov 2023 18:49:09 +0000 (12:49 -0600)]
Add x86_{i386,64} memory-management and x87 control/status registers (#1636)

* Add the memory-management registers

The processor provides four memory-management registers (GDTR, LDTR,
IDTR, and TR) that specify the locations of the data structures which
control segmented memory management. See Section 2.4 in Volume 3 of
the Intel 64 and IA-32 Architectures Software Developer’s Manual from
June 2021 for details.

* Add mxcsr

This is the SSE Control Status Word register. The AMD64
ABI doc says it's 128 bits, but it's actually 32.

* Add x87/SSE/AVX control and status word registers

Without these, getBaseRegister will convert fcw, fsw, and mxcsr to a
register with category '<id> | W_REG | ST | Arch_x86_64' which is
incorrect. getBaseRegister should return the register unmodified.

9 months agoUpdate x86 DWARF registers maps (#1633)
Tim Haines [Mon, 27 Nov 2023 20:39:49 +0000 (14:39 -0600)]
Update x86 DWARF registers maps (#1633)

* Update x86_64 DWARF registers to 2022 AMD64 standard

* Update x86_i386 DWARF registers to 2015 Intel386 standard

9 months agoRemove deleted x86 RegisterDictionary functions (#1632)
Tim Haines [Fri, 24 Nov 2023 16:38:34 +0000 (10:38 -0600)]
Remove deleted x86 RegisterDictionary functions (#1632)

These were commented out by 558227822 in 2016.

9 months agoClean up and improve documentation of x86_64 registers (#1630)
Tim Haines [Tue, 21 Nov 2023 21:52:49 +0000 (15:52 -0600)]
Clean up and improve documentation of x86_64 registers (#1630)

* Improve comments for register lengths

* Separate MMX/3DNow! and x87 register lengths and categories

The MMX* registers are only the lower 64 bits of the st* ones.

* Fix x86_64 subrange mappings in MachRegister::getROSERegister

The values in the two namespaces are not the same.

* Improve comments for EFLAGS fields

* Use symbolic names for the segment register base IDs

* Add missing flag1 from RFLAGS

* Add missing flag3 from RFLAGS

* Add missing flag5 from RFLAGS

* Add missing flagc from RFLAGS

FLAGC is the lower bit of the I/O Permission Level field.

* Add missing flagd from RFLAGS

FLAGC is the upper bit of the I/O Permission Level field.

* Add missing flagf from RFLAGS

* Add missing Virtual-8086 mode (VM) rFLAGS field

* Add conversion to ROSE register for Resume Flag

* Add conversion to ROSE register for Nested Task flag

* Add missing Alignment Check/Access Control (AC) RFLAGS field

* Add missing Virtual Interrupt Flag (VIF) RFLAGS field

* Add missing Virtual Interrupt Pending (VIP) RFLAGS field

* Add missing ID Flag (ID) RFLAGS field

* Fix avx-512 opmask size.

It's 64 bits, not 128.

From Intel(R) 64 and IA-32 Architectures Software Developer’s Manual
June 2021

15.6.1 OPMASK Register to Predicate Vector Data Processing
  The opmask is a set of eight architectural registers of size
  MAX_KL (64-bit).

* Rename OCT to XMMS

This makes it consistent with the names used for the other vector
extensions.

* Add missing subranges in MachRegister::getROSERegister

* Preserve register number in getBaseRegister

* Clear whole subrange byte for GPRs in getBaseRegister

9 months agoClean up and improve documentation of x86_32 registers (#1629)
Tim Haines [Tue, 21 Nov 2023 20:59:06 +0000 (14:59 -0600)]
Clean up and improve documentation of x86_32 registers (#1629)

* Improve comments for register lengths

* Separate MMX/3DNow! and x87 register lengths and categories

The MMX* registers are only the lower 64 bits of the st* ones.

* Improve comments for EFLAGS fields

* Add conversion to ROSE register for FLAGC

FLAGC is the lower bit of the I/O Permission Level field in EFIELD.

* Add conversion to ROSE register for FLAGD

FLAGC is the upper bit of the I/O Permission Level field in EFIELD.

* Add conversion to ROSE register for Nested Task flag

* Add conversion to ROSE register for Resume Flag

* Add missing Virtual-8086 mode (VM) EFLAGS field

* Add missing Alignment Check/Access Control (AC) EFLAGS field

* Add missing Virtual Interrupt Flag (VIF) EFLAGS field

* Add missing Virtual Interrupt Pending (VIP) EFLAGS field

* Add missing ID Flag (ID) EFLAGS field

* Remove registers xmm8-xmm31 and aliases

These registers are only available in 64-bit mode.

From Intel(r) 64 and IA-32 Architectures Software Developer’s Manual
June 2021:

11.2.1 SSE2 in 64-Bit Mode and Compatibility Mode
  In compatibility mode, SSE2 extensions function like they do in
  protected mode. In 64-bit mode, eight additional XMM registers are
  accessible. Registers XMM8-XMM15 are accessed by using REX prefixes.

14.1.1 256-Bit Wide SIMD Register Support
  Intel AVX introduces support for 256-bit wide SIMD registers
  (YMM0-YMM7 in operating modes that are 32-bit or less, YMM0-YMM15 in
  64-bit mode).

15.1.2 32 SIMD Register Support
  Intel AVX-512 instructions also support 32 SIMD registers in 64-bit
  mode (XMM0-XMM31, YMM0-YMM31 and ZMM0-ZMM31). The number of available
  vector registers in 32-bit mode is still 8.

* Fix avx-512 opmask size.

It's 64 bits, not 128.

From Intel(R) 64 and IA-32 Architectures Software Developer’s Manual
June 2021

15.6.1 OPMASK Register to Predicate Vector Data Processing
  The opmask is a set of eight architectural registers of size
  MAX_KL (64-bit).

* Rename OCT to XMMS

This makes it consistent with the names used for the other vector
extensions.

* Use symbolic names for the segment register base IDs

* Add missing ROSE category conversions

* Add missing ROSE subrange conversions

* Preserve register number in getBaseRegister

* Clear whole subrange byte for GPRs in getBaseRegister

9 months agoRemove MachineRegister::getSubRegValue (#1631)
Tim Haines [Tue, 21 Nov 2023 19:13:36 +0000 (13:13 -0600)]
Remove MachineRegister::getSubRegValue (#1631)

It's neither documented nor used.

This page took 0.128605 seconds and 5 git commands to generate.