Revision: 2510
Updated Code
at March 8, 2007 16:49 by gtcaz
Updated Code
#! /bin/bash
# Checks for conflicts between all dll's that are loaded by the programs or dlls given as arguments.
# cygcheck searches PATH to find arguments that are not absolute pathnames.
final_dec=0
final_guard_dec=0
guard=0x10000
#set -x
cygcheck "$@" |
while read -r file
do
[ -n "$file" ] && [ "$file" = "${file#Found:}" ] && objdump -p "$file" |
sed -n -e '2 {s:\\:/:g; s/^/ /; s/: .*$//; h}' -e '/ImageBase/ {s/ImageBase/ /; G; h}' -e '/SizeOfImage/ {s/SizeOfImage//; G; s/[\t\n]//gp; Q}'
done |
sort -f -u -k 2 |
while read size base name
do
conflict=""
base_dec=$(( 0x$base ))
if [ "$final_dec" -ge "$base_dec" ]
then
conflict="CONFLICT End: $final_dec Start:$base_dec"
else
[ "$final_guard_dec" -ge "$base_dec" ] && conflict="GUARD CONFLICT End: $final_dec Start:$base_dec"
fi
echo $name $base $size $conflict
final_dec=$(( 0x$base + 0x$size ))
final_guard_dec=$(( $final_dec + $guard ))
done
Revision: 2509
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 8, 2007 16:42 by gtcaz
Initial Code
#! /bin/bash
final_dec=0
final_guard_dec=0
guard=0x10000
#set -x
cygcheck "$1" |
while read -r file
do
/usr/bin/objdump -p "$file" |
sed -n -e '2 {s/^/ /; s/: .*$//; h}' -e '/ImageBase/ {s/ImageBase/ /; G; h}' -e '/SizeOfImage/ {s/SizeOfImage//; G; s/[\t\n]//gp; Q}'
done |
sort -k 2 |
while read -r size base name
do
conflict=""
base_dec=$(( 0x$base ))
if [ "$final_dec" -ge "$base_dec" ]
then
conflict="CONFLICT End: $final_dec Start:$base_dec"
else
[ "$final_guard_dec" -ge "$base_dec" ] && conflict="GUARD CONFLICT End: $final_dec Start:$base_dec"
fi
echo $name $base $size $conflict
final_dec=$(( 0x$base + 0x$size ))
final_guard_dec=$(( $final_dec + $guard ))
done
Initial URL
Initial Description
From: "Pierre A. Humblet" The attached script takes the name of a .exe or .dll, uses cygcheck to find the dll dependence and checks for conflicts. This will allow you to check your favorite applications or dlls, seeing if --enable-auto-image-base works for you. A "conflict" is when the end of a dll overlaps the start of the next one. A "guard conflict" includes the extra 0x10000 mentioned by Jason in this thread. They occur with Windows dlls, not sure if that's a real issue. I have extended the tool (attached) so that it takes a variable number of arguments. You can check a program and all the dll's it might ever load dynamically, or all the dll's in /bin, or whatever. cygcheck will search the PATH if necessary.
Initial Title
Check cygwin apps for base conflicts
Initial Tags
Initial Language
Bash