diff mbox series

[dwarves,02/11] btf_encoder: detect BTF encoding errors and exit

Message ID 20200930042742.2525310-3-andriin@fb.com (mailing list archive)
State Not Applicable
Headers show
Series Switch BTF loading and encoding to libbpf APIs | expand

Commit Message

Andrii Nakryiko Sept. 30, 2020, 4:27 a.m. UTC
Don't silently swallow BTF encoding errors and continue onto next CU. If any
of CU fails to properly encode BTF, exit with an error message.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
 pahole.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/pahole.c b/pahole.c
index ee5f2f7f76b0..ed87529ce65d 100644
--- a/pahole.c
+++ b/pahole.c
@@ -2363,8 +2363,11 @@  static enum load_steal_kind pahole_stealer(struct cu *cu,
 		goto filter_it;
 
 	if (btf_encode) {
-		cu__encode_btf(cu, global_verbose, btf_encode_force,
-			       skip_encoding_btf_vars);
+		if (cu__encode_btf(cu, global_verbose, btf_encode_force,
+				   skip_encoding_btf_vars)) {
+			fprintf(stderr, "Encountered error while encoding BTF.\n");
+			exit(1);
+		}
 		return LSK__KEEPIT;
 	}