[Lldb-commits] [lldb] 2bbc4fd - Add a testcase for .dSYM path remapping dictionaries.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 8 18:17:49 PST 2019


This is failing on GreenDragon, so I've reverted it. Can you please
have a look on Monday?

On Fri, Nov 8, 2019 at 2:07 PM Adrian Prantl via lldb-commits
<lldb-commits at lists.llvm.org> wrote:
>
>
> Author: Adrian Prantl
> Date: 2019-11-08T14:07:35-08:00
> New Revision: 2bbc4fdd8fa0ed58d610ab6260cb664c7cfef204
>
> URL: https://github.com/llvm/llvm-project/commit/2bbc4fdd8fa0ed58d610ab6260cb664c7cfef204
> DIFF: https://github.com/llvm/llvm-project/commit/2bbc4fdd8fa0ed58d610ab6260cb664c7cfef204.diff
>
> LOG: Add a testcase for .dSYM path remapping dictionaries.
>
> rdar://problem/56924558
>
> Added:
>     lldb/packages/Python/lldbsuite/test/macosx/DBGSourcePathRemapping/Inputs/main.c
>     lldb/packages/Python/lldbsuite/test/macosx/DBGSourcePathRemapping/Makefile
>     lldb/packages/Python/lldbsuite/test/macosx/DBGSourcePathRemapping/TestDSYMSourcePathRemapping.py
>
> Modified:
>
>
> Removed:
>
>
>
> ################################################################################
> diff  --git a/lldb/packages/Python/lldbsuite/test/macosx/DBGSourcePathRemapping/Inputs/main.c b/lldb/packages/Python/lldbsuite/test/macosx/DBGSourcePathRemapping/Inputs/main.c
> new file mode 100644
> index 000000000000..556bda3c17d1
> --- /dev/null
> +++ b/lldb/packages/Python/lldbsuite/test/macosx/DBGSourcePathRemapping/Inputs/main.c
> @@ -0,0 +1,8 @@
> +void stop() {}
> +
> +int main()
> +{
> +  stop();
> +  // Hello World!
> +  return 0;
> +}
>
> diff  --git a/lldb/packages/Python/lldbsuite/test/macosx/DBGSourcePathRemapping/Makefile b/lldb/packages/Python/lldbsuite/test/macosx/DBGSourcePathRemapping/Makefile
> new file mode 100644
> index 000000000000..f36a8dc1e671
> --- /dev/null
> +++ b/lldb/packages/Python/lldbsuite/test/macosx/DBGSourcePathRemapping/Makefile
> @@ -0,0 +1,5 @@
> +BOTDIR = $(BUILDDIR)/buildbot
> +USERDIR = $(BUILDDIR)/user
> +C_SOURCES = $(BOTDIR)/main.c
> +
> +include Makefile.rules
>
> diff  --git a/lldb/packages/Python/lldbsuite/test/macosx/DBGSourcePathRemapping/TestDSYMSourcePathRemapping.py b/lldb/packages/Python/lldbsuite/test/macosx/DBGSourcePathRemapping/TestDSYMSourcePathRemapping.py
> new file mode 100644
> index 000000000000..d13a04748672
> --- /dev/null
> +++ b/lldb/packages/Python/lldbsuite/test/macosx/DBGSourcePathRemapping/TestDSYMSourcePathRemapping.py
> @@ -0,0 +1,56 @@
> +import lldb
> +from lldbsuite.test.decorators import *
> +import lldbsuite.test.lldbtest as lldbtest
> +import lldbsuite.test.lldbutil as lldbutil
> +import os
> +import unittest2
> +
> +
> +class TestDSYMSourcePathRemapping(lldbtest.TestBase):
> +
> +    mydir = lldbtest.TestBase.compute_mydir(__file__)
> +
> +    def build(self):
> +        botdir = self.getBuildArtifact('buildbot')
> +        userdir = self.getBuildArtifact('user')
> +        inputs = self.getSourcePath('Inputs')
> +        lldbutil.mkdir_p(botdir)
> +        lldbutil.mkdir_p(userdir)
> +        import shutil
> +        for f in ['main.c']:
> +            shutil.copyfile(os.path.join(inputs, f), os.path.join(botdir, f))
> +            shutil.copyfile(os.path.join(inputs, f), os.path.join(userdir, f))
> +
> +        super(TestDSYMSourcePathRemapping, self).build()
> +
> +        # Remove the build sources.
> +        self.assertTrue(os.path.isdir(botdir))
> +        shutil.rmtree(botdir)
> +
> +        # Create a plist.
> +        import subprocess
> +        dsym = self.getBuildArtifact('a.out.dSYM')
> +        uuid = subprocess.check_output(["/usr/bin/dwarfdump", "--uuid", dsym]
> +                                      ).decode("utf-8").split(" ")[1]
> +        import re
> +        self.assertTrue(re.match(r'[0-9a-fA-F-]+', uuid))
> +        plist = os.path.join(dsym, 'Contents', 'Resources', uuid + '.plist')
> +       with open(plist, 'w') as f:
> +            f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
> +            f.write('<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n')
> +           f.write('<plist version="1.0">\n')
> +           f.write('<dict>\n')
> +           f.write('  <key>DBGSourcePathRemapping</key>\n')
> +           f.write('  <dict>\n')
> +           f.write('    <key>' + botdir + '</key>\n')
> +           f.write('    <string>' + userdir + '</string>\n')
> +           f.write('  </dict>\n')
> +           f.write('</dict>\n')
> +           f.write('</plist>\n')
> +
> +
> +    @skipIf(debug_info=no_match("dsym"))
> +    def test(self):
> +        self.build()
> +        lldbutil.run_to_name_breakpoint(self, 'main')
> +        self.expect("source list", substrs=["Hello World"])
>
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


More information about the lldb-commits mailing list