[Lldb-commits] [PATCH] D54460: Don't keep a global ABI plugin per architecture

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 12 17:57:29 PST 2018


jingham created this revision.
jingham added reviewers: clayborg, jasonmolenda.
Herald added subscribers: lldb-commits, abidh, atanasyan, kbarton, javed.absar, nemanjai.

For reasons that are unclear to me, when the ABIXXX::CreateInstance function is called to make a new ABI for a given process and ArchSpec, we would only make the plugin once, with the initial process and architecture.  Then if we got called with a different process, we would check to see if we already made one and if we did, hand back the one we had made - even though that was for a different process.

If there were ever anything per-process that effected the ABI plugin's behavior (for instance if it relied on a Process property) you could very well use the wrong processes setting.  Even worse, since the ABI's hold onto a process through a weak pointer, if the initial process had gone away, you would not be able to get to any process at all, and silently fall back on some default behavior.

This caching goes back to prehistoric days in lldb, but I can't think of any reason why we would do this.  It seems clearly wrong, and ABI plugins are really cheap to make - they pretty much just copy the process SP to a weak pointer and that's about all.  So this also seems like an unnecessary optimization.

Greg or Jason, do you remember why we did this?


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D54460

Files:
  source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
  source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
  source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
  source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp
  source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
  source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
  source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
  source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
  source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
  source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
  source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
  source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54460.173802.patch
Type: text/x-patch
Size: 8404 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20181113/a4656de9/attachment-0001.bin>


More information about the lldb-commits mailing list