Skip to content

Commit 19f847b

Browse files
committed
Add get_umf_debug_info.sh to print saved strings
Add the `get_umf_debug_info.sh` script to print saved strings. It can be used with any user binary: $ scripts/get_umf_debug_info.sh ./build/test/umf_test-base ./build/test/umf_test-base is not linked with the UMF library. $ scripts/get_umf_debug_info.sh ./build/test/umf_test-ipc ./build/test/umf_test-ipc is statically linked with the UMF library. Strings: @(#) Intel(R) UMF version: 0.10.0-git4.gbf701ee8 @(#) Intel(R) UMF CMake variables: "CMAKE_BUILD_TYPE:Debug, ..." $ scripts/get_umf_debug_info.sh ./build/test/umf_test-c_api_disjoint_pool ./build/test/umf_test-c_api_disjoint_pool is dynamically linked with the UMF library. Strings: @(#) Intel(R) UMF version: 0.10.0-git4.gbf701ee8 @(#) Intel(R) UMF CMake variables: "CMAKE_BUILD_TYPE:Debug, ..." Signed-off-by: Lukasz Dorau <[email protected]>
1 parent bf701ee commit 19f847b

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,3 +234,22 @@ $ strings libumf.so | grep "@(#)"
234234
@(#) Intel(R) UMF version: 0.11.0-dev.git66.g89e3831d
235235
@(#) Intel(R) UMF CMake variables: "CMAKE_BUILD_TYPE:Debug,...
236236
```
237+
238+
or using the dedicated `scripts/get_umf_debug_info.sh` script with any user binary:
239+
240+
```bash
241+
$ scripts/get_umf_debug_info.sh ./build/test/umf_test-base
242+
./build/test/umf_test-base is not linked with the UMF library.
243+
244+
$ scripts/get_umf_debug_info.sh ./build/test/umf_test-ipc
245+
./build/test/umf_test-ipc is statically linked with the UMF library.
246+
Strings:
247+
@(#) Intel(R) UMF version: 0.10.0-git4.gbf701ee8
248+
@(#) Intel(R) UMF CMake variables: "CMAKE_BUILD_TYPE:Debug,UMF_BUILD_BENCHMARKS:OFF, ..."
249+
250+
$ scripts/get_umf_debug_info.sh ./build/test/umf_test-c_api_disjoint_pool
251+
./build/test/umf_test-c_api_disjoint_pool is dynamically linked with the UMF library.
252+
Strings:
253+
@(#) Intel(R) UMF version: 0.10.0-git4.gbf701ee8
254+
@(#) Intel(R) UMF CMake variables: "CMAKE_BUILD_TYPE:Debug,UMF_BUILD_BENCHMARKS:OFF, ..."
255+
```

scripts/get_umf_debug_info.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#/bin/bash
2+
3+
BINARY=$1
4+
5+
if [ "$BINARY" = "" ]; then
6+
echo "Usage: $(basename $0) <binary_name>"
7+
exit 1
8+
fi
9+
10+
# check if the binary is statically linked with libumf
11+
if [ $(strings $BINARY | grep "@(#) Intel(R) UMF" | wc -l) -gt 0 ]; then
12+
echo "$BINARY is statically linked with the UMF library."
13+
echo "Strings:"
14+
strings $BINARY | grep "@(#) Intel(R) UMF"
15+
exit 0
16+
fi
17+
18+
if [ $(ldd $BINARY | grep libumf.so | wc -l) -gt 0 ]; then
19+
echo "$BINARY is dynamically linked with the UMF library."
20+
echo "Strings:"
21+
strings $(ldd $BINARY | grep libumf.so | awk '{ print $3 }') | grep "@(#) Intel(R) UMF"
22+
exit 0
23+
fi
24+
25+
echo "$BINARY is not linked with the UMF library."
26+

0 commit comments

Comments
 (0)