ChrisZim / edb-debugger

Automatically exported from code.google.com/p/edb-debugger
GNU General Public License v2.0
0 stars 0 forks source link

edb fails to start - missing symbols while loading plugins #72

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

edb 0.9.11 fails to start and I cannot find a fix by myself.
I already verified as far as I could that I am not doing anything stupid
and another user have confirmed the problem as well
please take a look at http://aur.archlinux.org/packages.php?ID=10660

build commands:
qmake -makefile DEFAULT_PLUGIN_PATH="/usr/lib/edb/" || return 1
make || return 1
make INSTALL_ROOT=$pkgdir/usr install || return 1
# correct /usr/lib64 -> /usr/lib on x86_64
[ "$CARCH" = "x86_64" ] && (mv $pkgdir/usr/lib64 $pkgdir/usr/lib || return 1)

$ edb
Starting EDB Version: 0.9.11 
Please Report Bugs & Requests At: http://bugs.codef00.com/
[loadPlugins] Cannot load library /usr/lib64/edb/libAnalyzer.so: 
(/usr/lib64/edb/libAnalyzer.so: undefined symbol: _ZTV9MemRegion) 
[loadPlugins] Cannot load library /usr/lib64/edb/libBinarySearcher.so: 
(/usr/lib64/edb/libBinarySearcher.so: undefined symbol: _ZTV9MemRegion) 
[loadPlugins] Cannot load library /usr/lib64/edb/libBookmarks.so: 
(/usr/lib64/edb/libBookmarks.so: undefined symbol: 
_ZN3edb2v111getVariableERK7QStringRbR15ExpressionErrorPv) 
[loadPlugins] Cannot load library /usr/lib64/edb/libBreakpointManager.so: 
(/usr/lib64/edb/libBreakpointManager.so: undefined symbol: 
_ZN3edb2v111getVariableERK7QStringRbR15ExpressionErrorPv) 
[loadPlugins] Loading Plugin: libCheckVersion.so             : 0x22cd2a0
[loadPlugins] Cannot load library /usr/lib64/edb/libDebuggerCore.so: 
(/usr/lib64/edb/libDebuggerCore.so: undefined symbol: 
_ZN3edb2v112debuggerBaseE) 
[loadPlugins] Cannot load library /usr/lib64/edb/libDumpState.so: 
(/usr/lib64/edb/libDumpState.so: undefined symbol: _ZN3edb2v112debuggerBaseE) 
[loadPlugins] Cannot load library /usr/lib64/edb/libELFBinaryInfo.so: 
(/usr/lib64/edb/libELFBinaryInfo.so: undefined symbol: 
_ZN3edb2v112debuggerBaseE) 
[loadPlugins] Cannot load library /usr/lib64/edb/libEnvironment.so: 
(/usr/lib64/edb/libEnvironment.so: undefined symbol: _ZN3edb2v112debuggerBaseE) 
[loadPlugins] Loading Plugin: libFunctionDB.so               : 0x2479880
[loadPlugins] Cannot load library /usr/lib64/edb/libFunctionFinder.so: 
(/usr/lib64/edb/libFunctionFinder.so: undefined symbol: _ZTV9MemRegion) 
[loadPlugins] Cannot load library /usr/lib64/edb/libHardwareBreakpoints.so: 
(/usr/lib64/edb/libHardwareBreakpoints.so: undefined symbol: 
_ZN3edb2v112debuggerBaseE) 
[loadPlugins] Cannot load library /usr/lib64/edb/libHeapAnalyzer.so: 
(/usr/lib64/edb/libHeapAnalyzer.so: undefined symbol: 
_ZN3edb2v112debuggerBaseE) 
[loadPlugins] Cannot load library /usr/lib64/edb/libOpcodeSearcher.so: 
(/usr/lib64/edb/libOpcodeSearcher.so: undefined symbol: 
_ZN3edb2v112debuggerBaseE) 
[loadPlugins] Cannot load library /usr/lib64/edb/libOpenFiles.so: 
(/usr/lib64/edb/libOpenFiles.so: undefined symbol: _ZN3edb2v112debuggerBaseE) 
[loadPlugins] Cannot load library /usr/lib64/edb/libReferences.so: 
(/usr/lib64/edb/libReferences.so: undefined symbol: _ZTV9MemRegion) 
[loadPlugins] Loading Plugin: libSessionManager.so           : 0x24213b0
[loadPlugins] Cannot load library /usr/lib64/edb/libStringSearcher.so: 
(/usr/lib64/edb/libStringSearcher.so: undefined symbol: 
_ZN3edb2v110debuggerUIE) 
[loadPlugins] Cannot load library /usr/lib64/edb/libSymbolViewer.so: 
(/usr/lib64/edb/libSymbolViewer.so: undefined symbol: _ZN3edb2v110debuggerUIE) 
edb: symbol lookup error: /usr/lib64/edb/libFunctionDB.so: undefined symbol: 
_ZN3edb2v113setFunctionDBEP10FunctionDB

$ gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr --enable-shared 
--enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-threads=posix 
--mandir=/usr/share/man --infodir=/usr/share/info --enable-__cxa_atexit 
--disable-multilib --libdir=/usr/lib --libexecdir=/usr/lib --enable-clocale=gnu 
--disable-libstdcxx-pch --with-tune=generic
Thread model: posix
gcc version 4.4.2 20091208 (prerelease) (GCC) 

If I could help somehow resolving this issue please let me know.

Thanks!

Original issue reported on code.google.com by evan.teran on 3 Oct 2012 at 3:21

GoogleCodeExporter commented 9 years ago
interesting. One thing I'm noticing is that you've built with 
DEFAULT_PLUGIN_PATH="/usr/lib/edb/" yet the runtime error mentions 
/usr/lib64/edb/. Is it at all possible that it is loading plugins from another 
build?

Original comment by evan.teran on 3 Oct 2012 at 4:44

GoogleCodeExporter commented 9 years ago
Thanks for your answer Evan!
You are right, I mixed the output. It comes from the default build options I 
tried out recently. The one relevant to build options I submitted with this bug 
report is as follows:

$ edb
Starting EDB Version: 0.9.11
Please Report Bugs & Requests At: http://bugs.codef00.com/
[loadPlugins] Cannot load library /usr/lib/edb/libAnalyzer.so: 
(/usr/lib/edb/libAnalyzer.so: undefined symbol: _ZTV9MemRegion)
[loadPlugins] Cannot load library /usr/lib/edb/libBinarySearcher.so: 
(/usr/lib/edb/libBinarySearcher.so: undefined symbol: _ZTV9MemRegion)
[loadPlugins] Cannot load library /usr/lib/edb/libBookmarks.so: 
(/usr/lib/edb/libBookmarks.so: undefined symbol: 
_ZN3edb2v111getVariableERK7QStringRbR15ExpressionErrorPv)
[loadPlugins] Cannot load library /usr/lib/edb/libBreakpointManager.so: 
(/usr/lib/edb/libBreakpointManager.so: undefined symbol: 
_ZN3edb2v111getVariableERK7QStringRbR15ExpressionErrorPv)
[loadPlugins] Loading Plugin: libCheckVersion.so : 0xfc1df0
[loadPlugins] Cannot load library /usr/lib/edb/libDebuggerCore.so: 
(/usr/lib/edb/libDebuggerCore.so: undefined symbol: _ZN3edb2v112debuggerBaseE)
[loadPlugins] Cannot load library /usr/lib/edb/libDumpState.so: 
(/usr/lib/edb/libDumpState.so: undefined symbol: _ZN3edb2v112debuggerBaseE)
[loadPlugins] Cannot load library /usr/lib/edb/libELFBinaryInfo.so: 
(/usr/lib/edb/libELFBinaryInfo.so: undefined symbol: _ZN3edb2v112debuggerBaseE)
[loadPlugins] Cannot load library /usr/lib/edb/libEnvironment.so: 
(/usr/lib/edb/libEnvironment.so: undefined symbol: _ZN3edb2v112debuggerBaseE)
[loadPlugins] Loading Plugin: libFunctionDB.so : 0xfd3520
[loadPlugins] Cannot load library /usr/lib/edb/libFunctionFinder.so: 
(/usr/lib/edb/libFunctionFinder.so: undefined symbol: _ZTV9MemRegion)
[loadPlugins] Cannot load library /usr/lib/edb/libHardwareBreakpoints.so: 
(/usr/lib/edb/libHardwareBreakpoints.so: undefined symbol: 
_ZN3edb2v112debuggerBaseE)
[loadPlugins] Cannot load library /usr/lib/edb/libHeapAnalyzer.so: 
(/usr/lib/edb/libHeapAnalyzer.so: undefined symbol: _ZN3edb2v112debuggerBaseE)
[loadPlugins] Cannot load library /usr/lib/edb/libOpcodeSearcher.so: 
(/usr/lib/edb/libOpcodeSearcher.so: undefined symbol: _ZN3edb2v112debuggerBaseE)
[loadPlugins] Cannot load library /usr/lib/edb/libOpenFiles.so: 
(/usr/lib/edb/libOpenFiles.so: undefined symbol: _ZN3edb2v112debuggerBaseE)
[loadPlugins] Cannot load library /usr/lib/edb/libReferences.so: 
(/usr/lib/edb/libReferences.so: undefined symbol: _ZTV9MemRegion)
[loadPlugins] Loading Plugin: libSessionManager.so : 0xf85660
[loadPlugins] Cannot load library /usr/lib/edb/libStringSearcher.so: 
(/usr/lib/edb/libStringSearcher.so: undefined symbol: _ZN3edb2v110debuggerUIE)
[loadPlugins] Cannot load library /usr/lib/edb/libSymbolViewer.so: 
(/usr/lib/edb/libSymbolViewer.so: undefined symbol: _ZN3edb2v110debuggerUIE)
edb: symbol lookup error: /usr/lib/edb/libFunctionDB.so: undefined symbol: 
_ZN3edb2v113setFunctionDBEP10FunctionDB

Moreover, there is no such problem occurring while using previous edb versions, 
I verified this in the same build environment.

Original comment by evan.teran on 3 Oct 2012 at 4:45

GoogleCodeExporter commented 9 years ago
OK, it seems that for some reason the plugins can't access the main 
application's symbols. Any chance that you could do a fresh make and get all of 
the output (including any warnings) into a file. I am curious if certain build 
flags are being passed during specific parts of the build process.

If all else fails, I'll set up an arch linux 64-bit VM and try to reproduce the 
bug locally. Is there any particular version I should use to recreate the 
problem?

Original comment by evan.teran on 3 Oct 2012 at 4:45

GoogleCodeExporter commented 9 years ago
build log

$ LC_ALL=en_US.UTF8 makepkg -f 2>&1 |bzip2 -c > build.log.bz2

Please find attached build.log.bz2 generated by the command above :)

Arch is based on a rolling-release model, just fetch current release and update 
the system: http://www.archlinux.org/download/

Thanks for your effort Evan, I would just give you access to my machine in 
order to save you the trouble but unfortunately I'm behind a router and have no 
access to its configuration.

Best regards!

Original comment by evan.teran on 3 Oct 2012 at 4:46

Attachments:

GoogleCodeExporter commented 9 years ago
OK, i believe I know the problem :-). Basically i "improved" the build system 
to make it more versatile with non-linux/gcc builds.

edb **needs** -rdynamic in its flags to work (this makes it so plugins can see 
the symbols which are exported by the primary executable), which I tied to 
"linux-g++"... But it is nowhere to be found in your linker command.

Can you test something for me:

try changing in (src/src.pro) the following lines:

    linux-g++:      QMAKE_CXXFLAGS += -fvisibility=hidden
    linux-g++:      QMAKE_LFLAGS += -rdynamic

to

    linux-g++*:     QMAKE_CXXFLAGS += -fvisibility=hidden
    linux-g++*:     QMAKE_LFLAGS += -rdynamic

If this works, I'll do a version bump with a patch.

Original comment by evan.teran on 3 Oct 2012 at 4:46

GoogleCodeExporter commented 9 years ago
build log after patching

unfortunately it did not help

Original comment by evan.teran on 3 Oct 2012 at 4:48

Attachments:

GoogleCodeExporter commented 9 years ago
Evan, looks like I got it working!
Your patch + edb binary not stripped!

Original comment by evan.teran on 3 Oct 2012 at 4:48

GoogleCodeExporter commented 9 years ago
Looks like there is still some problem. I will investigate further tomorrow, 
but I can see the light already :)
Thanks for your help, I will get back to you, hopefully with working solution.

Original comment by evan.teran on 3 Oct 2012 at 4:48

GoogleCodeExporter commented 9 years ago
Great to hear that the patch made a difference. and yea, stripping the binaries 
can lead to problems (most likely debugging symbols can be stripped just fine 
though).

You mentioned that there is still something which is a problem. Is the runtime 
error the same or different now?

Considering that previous versions ran just fine I am inclined to assume that 
some part of the compile/link flags is at fault. But without knowing the 
current errors you are getting I have no way of verifying that.

Original comment by evan.teran on 3 Oct 2012 at 4:49

GoogleCodeExporter commented 9 years ago
The problems I mentioned in the previous post were related to a different 
version of edb, sorry, it must have been too late for me yesterday :)
I just verified everything again and it works now! The patch you suggested is 
enough and needed indeed.
Many thanks Evan!
I will wait for an updated release of yours if that offer is still valid ;)

Original comment by evan.teran on 3 Oct 2012 at 4:49

GoogleCodeExporter commented 9 years ago
fixed in the newly release 0.9.12. Glad that we could figure this out.

Original comment by evan.teran on 3 Oct 2012 at 4:49

GoogleCodeExporter commented 9 years ago

Original comment by evan.teran on 3 Oct 2012 at 4:49