Skip to content

Commit 6a9f42b

Browse files
committed
fix(release): ensure debuginfo file contain debugging info
Seems recently Cargo defaulted to use `strip=debuginfo`. This inadvertently made our debuginfo files much smaller Fix the issue by using `strip=none` and add a test so that it breaks if this somehow changes again. Signed-off-by: Pablo Barbáchano <[email protected]>
1 parent 2914d5a commit 6a9f42b

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@ panic = "abort"
2727
[profile.release]
2828
panic = "abort"
2929
lto = true
30+
strip = "none"
31+
32+
[profile.bench]
33+
strip = "debuginfo"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
"""Tests to check several aspects of the build"""
5+
6+
import re
7+
import subprocess
8+
9+
10+
def test_release_debuginfo(microvm_factory):
11+
"""Ensure the debuginfo file has the right ELF sections"""
12+
fc_binary = microvm_factory.fc_binary_path
13+
debuginfo = fc_binary.with_suffix(".debug")
14+
stdout = subprocess.check_output(
15+
["readelf", "-S", str(debuginfo)],
16+
encoding="ascii",
17+
)
18+
matches = {
19+
match[0]
20+
for match in re.findall(r"\[..] (\.(\w|\.)+)", stdout, re.MULTILINE)
21+
}
22+
needed_sections = {
23+
".debug_aranges",
24+
".debug_info",
25+
".debug_abbrev",
26+
".debug_line",
27+
".debug_frame",
28+
".debug_str",
29+
".debug_ranges",
30+
}
31+
missing_sections = needed_sections - matches
32+
assert missing_sections == set()

0 commit comments

Comments
 (0)