Page MenuHomePhabricator

Resolve binary symlinks before finding its separate .debug file

Authored by jankratochvil on Feb 2 2018, 10:16 AM.



I have found LLDB cannot find separate debug info of Fedora /usr/bin/gdb. It is because:

lrwxrwxrwx 1 root root       14 Jan 25 20:41 /usr/bin/gdb -> ../libexec/gdb*
-rwxr-xr-x 1 root root 10180296 Jan 25 20:41 /usr/libexec/gdb*
ls: cannot access '/usr/lib/debug/usr/bin/gdb-8.0.1-35.fc27.x86_64.debug': No such file or directory
-r--r--r-- 1 root root 29200464 Jan 25 20:41 /usr/lib/debug/usr/libexec/gdb-8.0.1-35.fc27.x86_64.debug

FYI that -8.0.1-35.fc27.x86_64.debug may look confusing, it was always just .debug before.
Why is /usr/bin/gdb a symlink is offtopic for this bugreport, Fedora has it so for some reasons.

It is always safest to look at the .debug file only after resolving all symlinks on the binary file. I hope it should not cause any regressions.

Diff Detail


Event Timeline

jankratochvil created this revision.Feb 2 2018, 10:16 AM
clayborg accepted this revision.Feb 2 2018, 10:22 AM

Makes sense for me, but make sure Pavel is ok with this as well before committing.

This revision is now accepted and ready to land.Feb 2 2018, 10:22 AM

Can you fix the test case as mentioned inline. If something doesn't work please just ping me and I'll fix it. I'd like to get off propagating this boiler-plate...

23–37 ↗(On Diff #132621)

You should be able to do all this with the run_to_name_breakpoint. Pass "dirsymlink/stripped.symlink" as exe_name. I just added the ability to limit the breakpoint to a particular module, so you can do that as well.

Having all this duplicated boiler-plate made Adrian's laudable job of building out of tree way more tedious than it should have been. We should centralize this whenever possible.

jankratochvil marked an inline comment as done.

Simplify the testcase by: lldbutil.run_to_name_breakpoint

jankratochvil accepted this revision.Feb 2 2018, 1:56 PM
jankratochvil removed a reviewer: jankratochvil.
labath accepted this revision.Feb 5 2018, 2:02 AM

Looks fine, just a couple of tweaks to the test case. No need to wait for another round of review.

17 ↗(On Diff #132670)

source seems to be unused (and after that you can also remove the setUp function).

20 ↗(On Diff #132670)

Please add something like skipIf(hostoslist=["windows"]) here. (The point being that the symlink creation will not work when doing remote debugging from windows).

jankratochvil marked 2 inline comments as done.Feb 5 2018, 2:51 AM
This revision was automatically updated to reflect the committed changes.