安装 GDB 破坏了 LLDB,我该如何修复 LLDB?

Installing GDB broke LLDB, how do I fix LLDB?

在Ubuntu18.04.1,我一直在使用lldbllnode调试node。我很好奇 gdb 是否会更好,所以我安装了它。在那之后,lldb 无法再加载 core 个文件。

这有效:

~$ lldb /usr/bin/node -c core
(lldb) target create "/usr/bin/node" --core "/home/ubuntu/core"
Core file '/home/ubuntu/core' (x86_64) was loaded.'

然后我安装了gdb:

~$ sudo apt install gdb
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  gdbserver libbabeltrace1 libc6-dbg libdw1
Suggested packages:
  gdb-doc
The following NEW packages will be installed:
  gdb gdbserver libbabeltrace1 libc6-dbg libdw1
0 upgraded, 5 newly installed, 0 to remove and 19 not upgraded.
Need to get 8737 kB of archives.
After this operation, 51.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libdw1 amd64 0.170-0.4 [203 kB]
Get:2 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libbabeltrace1 amd64 1.5.5-1 [154 kB]
Get:3 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 gdb amd64 8.1-0ubuntu3 [2937 kB]
Get:4 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 gdbserver amd64 8.1-0ubuntu3 [282 kB]
Get:5 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libc6-dbg amd64 2.27-3ubuntu1 [5161 kB]
Fetched 8737 kB in 1s (10.8 MB/s)   
Selecting previously unselected package libdw1:amd64.
(Reading database ... 125740 files and directories currently installed.)
Preparing to unpack .../libdw1_0.170-0.4_amd64.deb ...
Unpacking libdw1:amd64 (0.170-0.4) ...
Selecting previously unselected package libbabeltrace1:amd64.
Preparing to unpack .../libbabeltrace1_1.5.5-1_amd64.deb ...
Unpacking libbabeltrace1:amd64 (1.5.5-1) ...
Selecting previously unselected package gdb.
Preparing to unpack .../gdb_8.1-0ubuntu3_amd64.deb ...
Unpacking gdb (8.1-0ubuntu3) ...
Selecting previously unselected package gdbserver.
Preparing to unpack .../gdbserver_8.1-0ubuntu3_amd64.deb ...
Unpacking gdbserver (8.1-0ubuntu3) ...
Selecting previously unselected package libc6-dbg:amd64.
Preparing to unpack .../libc6-dbg_2.27-3ubuntu1_amd64.deb ...
Unpacking libc6-dbg:amd64 (2.27-3ubuntu1) ...
Setting up libc6-dbg:amd64 (2.27-3ubuntu1) ...
Setting up libdw1:amd64 (0.170-0.4) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2) ...
Setting up gdbserver (8.1-0ubuntu3) ...
Setting up libbabeltrace1:amd64 (1.5.5-1) ...
Setting up gdb (8.1-0ubuntu3) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...

现在lldb无法再加载核心文件:

~$ lldb /usr/bin/node -c core
(lldb) target create "/usr/bin/node" --core "core"
error: core failed to load objfile for /home/ubuntu/core
error: Unable to find process plug-in for core file '/home/ubuntu/core'

我该如何解决这个问题?我更喜欢 lldb 因为我现在正在做的事情并且想要它回来。我尝试清除 gdb 及其附加包,然后清除并重新安装 lldb,但这并没有解决任何问题。

事实证明 lldb 在诊断和报告自身问题方面很糟糕。 Unable to find process plug-in 错误是 failed to load objfile 错误的直接后果。

failed to load objfile 可能由任何原因引起。在某些版本中,它可能是由使核心文件不可读的权限引起的。在我的 post hoc 的情况下,ergo propter hocgdb 安装是一个转移注意力的问题。问题的实际原因是其他进程消耗了足够的内存,以至于没有足够的可用内存来加载核心映像。通过停止占用大量内存的进程释放机器上的内存解决了这个问题。