Skip to content

Commit 9c5807f

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 0f8b59d commit 9c5807f

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,25 @@ $ strings libumf.so | grep "@(#)"
239239
@(#) Intel(R) UMF CMake variables: "CMAKE_BUILD_TYPE:Debug,...
240240
```
241241
242+
or using the dedicated `scripts/get_umf_debug_info.sh` script with any user binary:
243+
244+
```bash
245+
$ scripts/get_umf_debug_info.sh ./build/test/umf_test-base
246+
./build/test/umf_test-base is not linked with the UMF library.
247+
248+
$ scripts/get_umf_debug_info.sh ./build/test/umf_test-ipc
249+
./build/test/umf_test-ipc is statically linked with the UMF library.
250+
Strings:
251+
@(#) Intel(R) UMF version: 0.10.0-git4.gbf701ee8
252+
@(#) Intel(R) UMF CMake variables: "CMAKE_BUILD_TYPE:Debug,UMF_BUILD_BENCHMARKS:OFF, ..."
253+
254+
$ scripts/get_umf_debug_info.sh ./build/test/umf_test-c_api_disjoint_pool
255+
./build/test/umf_test-c_api_disjoint_pool is dynamically linked with the UMF library.
256+
Strings:
257+
@(#) Intel(R) UMF version: 0.10.0-git4.gbf701ee8
258+
@(#) Intel(R) UMF CMake variables: "CMAKE_BUILD_TYPE:Debug,UMF_BUILD_BENCHMARKS:OFF, ..."
259+
```
260+
242261
#### Requirements
243262
244263
- binutils package (Linux)

scripts/get_umf_debug_info.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
# Copyright (C) 2024 Intel Corporation
3+
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
6+
BINARY=$1
7+
8+
if ! which stringss >/dev/null; then
9+
echo "strings command not found. Please install the binutils package."
10+
exit 1
11+
fi
12+
13+
if [ "$BINARY" = "" ]; then
14+
echo "Usage: $(basename $0) <binary_name>"
15+
exit 1
16+
fi
17+
18+
# check if the binary is statically linked with libumf
19+
if [ $(strings $BINARY | grep "@(#) Intel(R) UMF" | wc -l) -gt 0 ]; then
20+
echo "$BINARY is statically linked with the UMF library."
21+
echo "Strings:"
22+
strings $BINARY | grep "@(#) Intel(R) UMF"
23+
exit 0
24+
fi
25+
26+
# check if the binary is dynamically linked with libumf
27+
if [ $(ldd $BINARY | grep libumf.so | wc -l) -gt 0 ]; then
28+
echo "$BINARY is dynamically linked with the UMF library."
29+
echo "Strings:"
30+
strings $(ldd $BINARY | grep libumf.so | awk '{ print $3 }') | grep "@(#) Intel(R) UMF"
31+
exit 0
32+
fi
33+
34+
echo "$BINARY is not linked with the UMF library."
35+

0 commit comments

Comments
 (0)