1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-25 22:12:57 +02:00
llvm-mirror/test/DebugInfo/Inputs/dwarfdump-test.cc
Alexey Samsonov 5c64f0995b [DWARF parser] Add basic support for DWZ DWARF multifile extensions.
This change implements basic support for DWARF alternate sections
proposal: http://www.dwarfstd.org/ShowIssue.php?issue=120604.1&type=open

LLVM tools now understand new forms: DW_FORM_GNU_ref_alt and
DW_FORM_GNU_strp_alt, which are used as references to .debug_info and
.debug_str sections respectively, stored in a separate file, and
possibly shared between different executables / shared objects.

llvm-dwarfdump and llvm-symbolizer don't yet know how to access this
alternate debug file (usually pointed by .gnu_debugaltlink section),
but they can at lease properly parse and dump regular files, which
refer to it.

This change should fix crashes of llvm-dwarfdump and llvm-symbolizer on
files produced by running "dwz" tool. Such files are already installed
on some modern Linux distributions.

llvm-svn: 237721
2015-05-19 20:29:28 +00:00

30 lines
552 B
C++

class DummyClass {
int a_;
public:
DummyClass(int a) : a_(a) {}
int add(int b) {
return a_ + b;
}
};
int f(int a, int b) {
DummyClass c(a);
return c.add(b);
}
int main() {
return f(2, 3);
}
// Built with Clang 3.2:
// $ mkdir -p /tmp/dbginfo
// $ cp dwarfdump-test.cc /tmp/dbginfo
// $ cd /tmp/dbginfo
// $ clang++ -g dwarfdump-test.cc -o <output>
// The result is also used as an input to .dwz tool:
// $ cp <output> output1.dwz
// $ cp <output> output2.dwz
// $ dwz -m output.dwz -r output1.dwz output2.dwz
// $ rm output2.dwz