diff options
| author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-05-19 17:55:34 +0000 |
|---|---|---|
| committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-05-19 17:55:34 +0000 |
| commit | 51acace4cce1255942e3e3bd3a7ecbff7f5b9377 (patch) | |
| tree | 88cf0d32aea197ea8e8198e1206b04c820308615 /libjava/addr2name.awk | |
| parent | 6e95df84d1be816955443d07c4935189b0341c63 (diff) | |
| download | ppe42-gcc-51acace4cce1255942e3e3bd3a7ecbff7f5b9377.tar.gz ppe42-gcc-51acace4cce1255942e3e3bd3a7ecbff7f5b9377.zip | |
Jumbo patch:
* Imported beans and serialization
* Updated IA-64 port
* Miscellaneous bug fixes
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34028 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/addr2name.awk')
| -rwxr-xr-x | libjava/addr2name.awk | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/libjava/addr2name.awk b/libjava/addr2name.awk new file mode 100755 index 00000000000..f31befd526d --- /dev/null +++ b/libjava/addr2name.awk @@ -0,0 +1,46 @@ +#!/bin/awk -f + +# Copyright (C) 2000 Free Software Foundation + +# This file is part of libgcj. + +# This software is copyrighted work licensed under the terms of the +# Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +# details. + +# This script emulates a little of the functionality of addr2line for +# those systems that don't have it. The only command line argument is +# an executable name. The script reads hexadecimal addresses from +# stdin and prints the corresponding symbol names to stdout. The +# addresses must begin with "0x" and be fully zero filled or this +# won't work. + +BEGIN { + object = ARGV[1]; + ARGV[1] = ""; + + while ("nm " object "| sort" | getline) { + if ($2 == "t" || $2 == "T") { + address[i] = "0x" $1; name[i] = $3; + i++; + } + } + syms = i; +} + +{ + lo = 0; + hi = syms - 1; + + while ((hi-1) > lo) + { + try = int ((hi + lo) / 2); + if ($0 < address[try]) + hi = try; + else if ($0 >= address[try]) + lo = try; + } + print name[lo] "\n"; fflush(); +} + + |

