11 # find_global_symbol.sh options symbol. See help message below for details.
17 # o Search through all .so files in all directories defined
18 # in LD_LIBRARY path for supplied symbol.
20 # o If located, attempt to demangle or mangle as appropriate..
42 -u)
textonly=0;; # show U undefined as well (other than T W
V )
50 if [ $print_types = 1 ] ; then
53 echo
' Symbol types are a single character from the following list:-'
56 echo
' The symbols value is absolute, and will not be changed by'
57 echo
' further linking.'
60 echo
' The symbol is in the uninitialized data section (known as'
64 echo
' The symbol is common. Common symbols are uninitialized data.'
65 echo
' When linking, multiple common symbols may appear with the'
66 echo
' same name. If the symbol is defined anywhere, the common'
67 echo
' symbols are treated as undefined references. For more'
68 echo
' details on common symbols, see the discussion of -warn-common'
69 echo
' in *Note Linker options: (ld.info)Options.'
70 echo
' details on common symbols, see the discussion of -warn-common'
71 echo
' in *Note Linker options: (ld.info)Options.'
74 echo
' The symbol is in the initialized data section.'
77 echo
' The symbol is in an initialized data section for small'
78 echo
' objects. Some object file formats permit more efficient'
79 echo
' access to small data objects, such as a global int variable'
80 echo
' as opposed to a large global array.'
83 echo
' The symbol is an indirect reference to another symbol. This'
84 echo
' is a GNU extension to the a.out object file format which is'
88 echo
' The symbol is a debugging symbol.'
91 echo
' The symbol is in a read only data section.'
94 echo
' The symbol is in an uninitialized data section for small'
98 echo
' The symbol is in the text (code) section.'
101 echo
' The symbol is undefined.'
104 echo
' The symbol is a weak object. When a weak defined symbol is'
105 echo
' linked with a normal defined symbol, the normal defined'
106 echo
' symbol is used with no error. When a weak undefined symbol'
107 echo
' is linked and the symbol is not defined, the value of the'
108 echo
' weak symbol becomes zero with no error.'
111 echo
' The symbol is a weak symbol that has not been specifically'
112 echo
' tagged as a weak object symbol. When a weak defined symbol'
113 echo
' is linked with a normal defined symbol, the normal defined'
114 echo
' symbol is used with no error. When a weak undefined symbol'
115 echo
' is linked and the symbol is not defined, the value of the'
116 echo
' weak symbol becomes zero with no error.'
119 echo
' The symbol is a stabs symbol in an a.out object file. In'
120 echo
' this case, the next values printed are the stabs other field,'
121 echo
' the stabs desc field, and the stab type. Stabs symbols are'
122 echo
' used to hold debugging information. For more information,'
123 echo
' see *Note Stabs: (stabs.info)Top.'
126 echo
' The symbol type is unknown, or object file format specific.'
129 echo
' U (undefined)'
131 echo
' T (text section symbol)'
132 echo
' D (data section symbol)'
133 echo
' B (bss section symbol)'
134 echo
' C (common symbol)'
135 echo
' - (for debugger symbol table entries; see -a below)'
136 echo
' S (symbol in a section other than those above), or'
137 echo
' I (indirect symbol).'
138 echo
" If the symbol is local (non-external), the symbol's type is instead"
139 echo
' represented by the corresponding lowercase letter. A lower case u'
140 echo
' in a dynamic shared library indicates a undefined reference to a'
141 echo
' private external in another module in the same library.'
145 if [
"$symbol" =
"" -o $print_help -ne 0 ] ; then
146 echo
" find_global_symbol finds mangled or demangled symbols in libraries"
147 echo
" within LD_LIBRARY_PATH. Invocation:-"
149 echo
" find_global_symbol.sh options name"
151 echo
" where options are none or more of the following:-"
153 echo
" -a All libs: search all libs."
154 echo
" Default: exclude /usr/lib"
156 echo
" -d Demangled: Force name to be treated as demangled"
157 echo
" Default: treat name as mangled unless it contains a ("
159 echo
" -f Fragment search: name is a fragment, match any symbol that"
160 echo
" contains name."
161 echo
" Default: symbol must exactly match name."
163 echo
" -u Print all references, including undefined symbols."
164 echo
" Default: only print symbol types T, W or V"
166 echo
" -v Increase verbosity."
167 echo
" -v prints each directory path as searched."
168 echo
" -v -v for debugging."
170 echo
" -t Print list of symbol types (may not exactly match nm)"
172 echo
" -h Print this help message."
177 # Escape puntuation characters.
181 while (loc <= length($0)) { \
182 c = substr($0,loc,1); \
183 if ( c < "0" || c == "[" || c == "]") print "\\\\"; \
191 if [ $demangled -eq 0 ]; then
192 demangled=`echo $symbol | awk
'{ print index($0,"(") }'`
196 if [ $sysname ==
"Darwin" ]; then
197 #DEMANGLEFLG="--defined-only -g"
207 echo
"Searching for demangled symbol '$symbol'"
222 #opt2="${DEMANGLEFLG}"
223 echo
"Searching for mangled symbol '$symbol'"
238 list=`echo ${LD_LIBRARY_PATH}:${DYLD_LIBRARY_PATH} | \
239 awk
' { num_elem = split($1,list,":"); \
241 while (i_elem <= num_elem) { \
242 print list[i_elem]; \
250 # Skip unwanted directories.
252 -o ! -d
$path ]; then echo
"Skipping $path";
continue;
fi
253 if [ $all_libs -eq 0 -
a "$path" =
"/usr/lib" ]; then echo
"Skipping $path";
continue;
fi
257 if [ $tried_before -ne 0 ]; then
continue;
fi
261 if [ $verbose -gt 0 ]; then
262 echo
"Checking libraries in $path..."
267 # echo "nm $opt1 $file | $tranform1 | egrep -n \"$search_string\""
271 if [
"$resultmulti" !=
"" ]
273 if [ $verbose -gt 1 ]; then
274 echo
"-->>> start resultmulti"
276 echo
"--<<< end resultmulti"
278 while read -
r result;
do
279 if [ $textonly -ne 0 ]; then
280 # S = Mac OS X "other section" (where typeinfo might be found)
281 nmatch=`echo $result | egrep -c -v
' U ' `
282 if [ $nmatch -eq 0 ]; then
continue;
fi
284 if [ $verbose -eq 0 -
a $printpath -eq 0 ]; then
285 echo
"Found in path $path/..."
289 echo
" Found in $file"
290 echo
" Entry: $result"
291 line=`echo $result | awk
' { loc = index($1,":");\
292 print substr($1,1,loc-1) }'`
293 if [ $verbose -gt 1 ]; then
294 echo
"awk returned $line"
296 result=`nm $opt2 $file | $transform2 | head -
$line | tail -1`
297 echo
" Translates to $result"
298 done <<<
"$resultmulti"
304 echo
"Note that U <symbol> means the symbol is undefined (required) here"
305 echo
" T, W, V <symbol> is defined here"
307 echo
"For a full list of codes type"
309 echo
" find_global_symbol.sh -h"
then cvmfs grid cern ch util cvmfs uptodate cvmfs uboone opensciencegrid org products fi source cvmfs uboone opensciencegrid org products setup_uboone sh exit else echo No setup file found exit fi if!uname grep q Darwin
then echo Invalid dCache scratch not copying back else ifdh ls
BEGIN_PROLOG triggeremu_data_config_icarus settings PMTADCthresholds sequence::icarus_stage0_multiTPC_TPC physics sequence::icarus_stage0_EastHits_TPC physics sequence::icarus_stage0_WestHits_TPC physics producers purityana0 caloskimCalorimetryCryoE physics caloskimCalorimetryCryoW physics path
then echo Checking libraries in $path fi for file in ls *so *dylib dev null do resultmulti
if &&[-z"$BASH_VERSION"] then echo Attempting to switch to bash bash shellSwitch exit fi &&["$1"= 'shellSwitch'] shift declare a IncludeDirectives for Dir in
then echo File list $list not found else cat $list while read file do echo $file sed s
do case $arg in a all_libs