-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The dwp tests are currently skipped because I haven't implemented dwp handling yet.
- Loading branch information
Showing
29 changed files
with
352 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
mkdir -p out/dwp-debuglink | ||
|
||
# Compile source files into object files | ||
g++ -c -g -Os -Wall -Wextra -gsplit-dwarf src/main.cpp -o out/dwp-debuglink/main.o | ||
g++ -c -g -Os -Wall -Wextra -gsplit-dwarf src/file1.cpp -o out/dwp-debuglink/file1.o | ||
g++ -c -g -Os -Wall -Wextra -gsplit-dwarf src/file2.cpp -o out/dwp-debuglink/file2.o | ||
g++ -c -g -Os -Wall -Wextra -gsplit-dwarf src/file3.cpp -o out/dwp-debuglink/file3.o | ||
|
||
# Create libfile23.a from file2.o and file3.o | ||
ar rcs out/dwp-debuglink/libfile23.a out/dwp-debuglink/file2.o out/dwp-debuglink/file3.o | ||
|
||
# Link libraries into executable | ||
g++ out/dwp-debuglink/main.o out/dwp-debuglink/file1.o out/dwp-debuglink/libfile23.a -o out/dwp-debuglink/main | ||
|
||
# Make dwp file | ||
dwp -e out/dwp-debuglink/main | ||
|
||
# Extract dwp sections into individual files | ||
objcopy --dump-section .debug_abbrev.dwo=out/dwp-debuglink/dwp-debug_abbrev.dwo.bin \ | ||
--dump-section .debug_line.dwo=out/dwp-debuglink/dwp-debug_line.dwo.bin \ | ||
--dump-section .debug_loc.dwo=out/dwp-debuglink/dwp-debug_loc.dwo.bin \ | ||
--dump-section .debug_str_offsets.dwo=out/dwp-debuglink/dwp-debug_str_offsets.dwo.bin \ | ||
--dump-section .debug_info.dwo=out/dwp-debuglink/dwp-debug_info.dwo.bin \ | ||
--dump-section .debug_str.dwo=out/dwp-debuglink/dwp-debug_str.dwo.bin \ | ||
--dump-section .debug_cu_index=out/dwp-debuglink/dwp-debug_cu_index.bin \ | ||
--dump-section .debug_tu_index=out/dwp-debuglink/dwp-debug_tu_index.bin \ | ||
out/dwp-debuglink/main.dwp | ||
|
||
# Create main.dbg with debug sections from main and from dwp | ||
objcopy --only-keep-debug \ | ||
--add-section .debug_abbrev.dwo=out/dwp-debuglink/dwp-debug_abbrev.dwo.bin \ | ||
--add-section .debug_line.dwo=out/dwp-debuglink/dwp-debug_line.dwo.bin \ | ||
--add-section .debug_loc.dwo=out/dwp-debuglink/dwp-debug_loc.dwo.bin \ | ||
--add-section .debug_str_offsets.dwo=out/dwp-debuglink/dwp-debug_str_offsets.dwo.bin \ | ||
--add-section .debug_info.dwo=out/dwp-debuglink/dwp-debug_info.dwo.bin \ | ||
--add-section .debug_str.dwo=out/dwp-debuglink/dwp-debug_str.dwo.bin \ | ||
--add-section .debug_cu_index=out/dwp-debuglink/dwp-debug_cu_index.bin \ | ||
--add-section .debug_tu_index=out/dwp-debuglink/dwp-debug_tu_index.bin \ | ||
out/dwp-debuglink/main out/dwp-debuglink/main.dbg | ||
strip -g out/dwp-debuglink/main | ||
objcopy --add-gnu-debuglink=out/dwp-debuglink/main.dbg out/dwp-debuglink/main | ||
|
||
# Remove .dwo, .dwp, .bin, .o, .a files | ||
rm out/dwp-debuglink/*.dwo out/dwp-debuglink/*.dwp out/dwp-debuglink/*.bin out/dwp-debuglink/*.o out/dwp-debuglink/*.a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
mkdir -p out/regular-debuglink | ||
|
||
# Compile source files into object files | ||
g++ -c -g -Os -Wall -Wextra src/main.cpp -o out/regular-debuglink/main.o | ||
g++ -c -g -Os -Wall -Wextra src/file1.cpp -o out/regular-debuglink/file1.o | ||
g++ -c -g -Os -Wall -Wextra src/file2.cpp -o out/regular-debuglink/file2.o | ||
g++ -c -g -Os -Wall -Wextra src/file3.cpp -o out/regular-debuglink/file3.o | ||
|
||
# Create libfile23.a from file2.o and file3.o | ||
ar rcs out/regular-debuglink/libfile23.a out/regular-debuglink/file2.o out/regular-debuglink/file3.o | ||
|
||
# Link libraries into executable | ||
g++ out/regular-debuglink/main.o out/regular-debuglink/file1.o out/regular-debuglink/libfile23.a -o out/regular-debuglink/main | ||
|
||
# Create main.dbg with debug sections | ||
objcopy --only-keep-debug out/regular-debuglink/main out/regular-debuglink/main.dbg | ||
strip -g out/regular-debuglink/main | ||
objcopy --add-gnu-debuglink=out/regular-debuglink/main.dbg out/regular-debuglink/main | ||
|
||
# Remove .o, .a files | ||
rm out/regular-debuglink/*.o out/regular-debuglink/*.a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
mkdir -p out/with-dwo | ||
|
||
# Compile source files into object files | ||
g++ -c -g -Os -Wall -Wextra -gsplit-dwarf src/main.cpp -o out/with-dwo/main.o | ||
g++ -c -g -Os -Wall -Wextra -gsplit-dwarf src/file1.cpp -o out/with-dwo/file1.o | ||
g++ -c -g -Os -Wall -Wextra -gsplit-dwarf src/file2.cpp -o out/with-dwo/file2.o | ||
g++ -c -g -Os -Wall -Wextra -gsplit-dwarf src/file3.cpp -o out/with-dwo/file3.o | ||
|
||
# Create libfile23.a from file2.o and file3.o | ||
ar rcs out/with-dwo/libfile23.a out/with-dwo/file2.o out/with-dwo/file3.o | ||
|
||
# Link libraries into executable | ||
g++ out/with-dwo/main.o out/with-dwo/file1.o out/with-dwo/libfile23.a -o out/with-dwo/main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
mkdir -p out/with-dwp | ||
|
||
# Compile source files into object files | ||
g++ -c -g -Os -Wall -Wextra -gsplit-dwarf src/main.cpp -o out/with-dwp/main.o | ||
g++ -c -g -Os -Wall -Wextra -gsplit-dwarf src/file1.cpp -o out/with-dwp/file1.o | ||
g++ -c -g -Os -Wall -Wextra -gsplit-dwarf src/file2.cpp -o out/with-dwp/file2.o | ||
g++ -c -g -Os -Wall -Wextra -gsplit-dwarf src/file3.cpp -o out/with-dwp/file3.o | ||
|
||
# Create libfile23.a from file2.o and file3.o | ||
ar rcs out/with-dwp/libfile23.a out/with-dwp/file2.o out/with-dwp/file3.o | ||
|
||
# Link libraries into executable | ||
g++ out/with-dwp/main.o out/with-dwp/file1.o out/with-dwp/libfile23.a -o out/with-dwp/main | ||
|
||
# Make dwp file | ||
dwp -e out/with-dwp/main | ||
|
||
# Remove .dwo, .o, .a files | ||
rm out/with-dwp/*.dwo out/with-dwp/*.o out/with-dwp/*.a |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <iostream> | ||
|
||
#include "file1.h" | ||
#include "file2.h" | ||
#include "file3.h" | ||
|
||
int file1_func1(int x) { | ||
std::cout << "Hello from file1.cpp file1_func1().\n"; | ||
return (file1_func2(x + 2) + file2_func1(x + 4)) << 2; | ||
} | ||
|
||
int file1_func2(int y) { | ||
return file1_func3(y, file3_func1(y + 3)) + 5; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
int file1_func1(int x); | ||
int file1_func2(int y); | ||
|
||
inline int file1_func3(int z, int w) { | ||
return z * w + 5; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <iostream> | ||
|
||
#include "file2.h" | ||
|
||
int file2_func1(int x) { | ||
std::cout << "Hello from file2.cpp file2_func1().\n"; | ||
return file2_func2(x + 2); | ||
} | ||
|
||
int file2_func2(int y) { | ||
return file2_func3(y, 4) + 5; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
int file2_func1(int x); | ||
int file2_func2(int y); | ||
|
||
inline int file2_func3(int z, int w) { | ||
return z * w + 5; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <iostream> | ||
|
||
#include "file3.h" | ||
|
||
int file3_func1(int x) { | ||
std::cout << "Hello from file3.cpp file3_func1().\n"; | ||
return file3_func2(x + 2); | ||
} | ||
|
||
int file3_func2(int y) { | ||
return file3_func3(y, 4) + 5; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
int file3_func1(int x); | ||
int file3_func2(int y); | ||
|
||
inline int file3_func3(int z, int w) { | ||
return z * w + 5; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <iostream> | ||
|
||
#include "file1.h" | ||
|
||
int main() { | ||
std::cout << "Hello from main()\n"; | ||
int r = file1_func1(15); | ||
std::cout << "Number: " << r << "\n"; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.