File: text_offset.sh

package info (click to toggle)
dmtcp 2.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,496 kB
  • sloc: cpp: 33,592; ansic: 28,099; sh: 6,735; makefile: 1,950; perl: 1,690; python: 1,241; asm: 138; java: 13
file content (13 lines) | stat: -rwxr-xr-x 296 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh

if test "$1" = ""; then
  echo Usage:  $0 BINARY_FILE
  exit 1
fi

if test `uname -m` = x86_64; then
  echo 0x`readelf -S $1 | grep '\.text' | sed -e 's^.* 0*^^'`
else
  echo 0x`readelf -S $1 | grep '\.text' | \
             sed -e 's^.*PROGBITS * [0-9]* *0*^^' | sed -e 's^ .*^^'`
fi