3 # Copyright (C) 2000 Free Software Foundation
5 # This file is part of libgcj.
7 # This software is copyrighted work licensed under the terms of the
8 # Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
11 # This script emulates a little of the functionality of addr2line for
12 # those systems that don't have it. The only command line argument is
13 # an executable name. The script reads hexadecimal addresses from
14 # stdin and prints the corresponding symbol names to stdout. The
15 # addresses must begin with "0x" and be fully zero filled or this
22 while ("nm " object "| sort" | getline) {
23 if ($2 == "t" || $2 == "T") {
24 address[i] = "0x" $1; name[i] = $3;
37 try = int ((hi + lo) / 2);
38 if ($0 < address[try])
40 else if ($0 >= address[try])
43 print name[lo] "\n"; fflush();