From b61642867ed92894dc00157746bdef326081ff09 Mon Sep 17 00:00:00 2001 From: Rot127 Date: Fri, 9 Feb 2024 02:23:19 -0500 Subject: [PATCH] Add CFG test with more node details. --- elf/analysis/x86_cfg_node_details_test | Bin 0 -> 16144 bytes src/graphs/cfg_node_details_test.c | 39 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100755 elf/analysis/x86_cfg_node_details_test create mode 100644 src/graphs/cfg_node_details_test.c diff --git a/elf/analysis/x86_cfg_node_details_test b/elf/analysis/x86_cfg_node_details_test new file mode 100755 index 0000000000000000000000000000000000000000..0630029e4fdbde36c26cc4528b04c67ca6abc967 GIT binary patch literal 16144 zcmeHOU2Ggz6~5~vjYE@olP1(oO1zX-Bt_oXiDN?BH0$4tt^Bx-Q<92yGWL$`Mf>CK zj$1n_;E;l1MS;KrR24$ug+5f3`hXCMkm{1sCj7~%5b{HdEYu)JE%_0pDiE@qbMN`q zv(t4SKq?Q+wRXOH&pF?{XU@GdbH{V<*E;uhRYf8SX^DDBacMMaBneUUeqJ&J3AIzL zqGP?#50I7(s7FEqf$ZMVc`X_L+pXv2B(9Uz2tw=Ua#bABEDIIOJyZrzhVzR$YR*caXN=hv@&D|M>p#qFqrIc&p;?J*>{%z5rB zwlU{_oN^2Ocgg)-Mhg}>FlTKAU3?Kadl9Q(|Jg8|_T;5Y`%RSYi_U!F$Yqz(> zx5amq^4pu0-QB;>PP%z_I92f6eE+`obS~@mI|FH#Djv?{veJ}oOe-34-z=ei;U6E( z1r#A^Go1v+-`IxK3hvd1MD~;Ke2==MO7+Nz;=X|Ev3HG8%*u5Sc~s=FgwaEe^7L*a z=lop`nSe94L8j$e_g zc<*oMSW};%9G6E}e`T&n>E2&(nWvmrW_0-+mw769Wm=byQF-VL6F4>frF-hqzDqi;v{{bE~S%|oj1ws0`aV=&N<4SH`)2) zU%C0>AIXy4zc!xV_f#w8E%w^#o56TMz6o+Rug ze2MTV;bFq=8^z)U!UKeF6MmU+seE+eZ=ReY$N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O){kDy%*2nTO>sJMrrd>2KTdph=tcVCo= zRlG2f@tgrdFK=)JIog8Z=0{aLoAccGaCR&{n$L~8d2hle8W>B_o|;rrM6GSz4LsJg z`G`{(QSszNmYOi=<&EY^H(yBQvSkIEba^-JFhO#oX-~y@%&0hJvtgMXXL!hFu09^IYJx z7^3~)`F~&dZDNOcGtlz!Ic7ork4VOTq5jhIN1j8Nk4rV$SL7LgKtDe}COlw*jeH4@ zH{kQ6^Yf320tkOm10_e0Y-aRk;#uC$Hzysb!WIrGC*jgdNPgDaQ$}5S?GWd^qZ%ldc{fM#WH?^d~X>sgRq~v=c{K5T~uMha{=U2-=Fg6D&N4v0Hvk1SD NA8eF11PFnm`ZrE#HwFLz literal 0 HcmV?d00001 diff --git a/src/graphs/cfg_node_details_test.c b/src/graphs/cfg_node_details_test.c new file mode 100644 index 0000000..01be0a9 --- /dev/null +++ b/src/graphs/cfg_node_details_test.c @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2023 Rot127 +// SPDX-License-Identifier: LGPL-3.0-only + +/** + * \file Tests for CFG generation. + */ + +#include +#include +#include + +typedef struct { + void (*fcn_a)(); + void (*fcn_b)(); +} Dummy; + +void endless() { +endless: + goto endless; +} + +void print_something() { printf("something"); } + +int main() { + unsigned int a = rand(); + Dummy d = { + .fcn_a = endless, + .fcn_b = print_something, + }; + if (a == 0xdead) { + // Bad luck + d.fcn_a(); + } else if (a == 0xc0ffee) { + abort(); + } else { + d.fcn_b(); + } + return a; +}