Open GoogleCodeExporter opened 9 years ago
Yea, the *BSD ports are very much a work in progress. I actually have made a
lot of progress with the OpenBSD port lately (it doesn't quite debug yet, but
it builds which is a huge improvement).
Thank you for the bug report, hopefully I'll be able to get the FreeBSD and
OpenBSD (which should help with the OSX ports as well) ports up and running
sometime soon.
Original comment by evan.teran
on 3 Oct 2012 at 4:34
Great to hear its a work in progress. The BSD platform is devoid of a nice
binary based debugger.
Original comment by evan.teran
on 3 Oct 2012 at 4:34
After few fixes i've managed to build edb 0.9.13 on FREEBSD-8-STABLE, but got
this at runtime:
arr: ~/debugger> ./edb
Starting EDB Version: 0.9.13
Please Report Bugs & Requests At: http://bugs.codef00.com/
[loadPlugins] Cannot load library /usr/home/arr/debugger/libAnalyzer.so:
(/usr/home/arr/debugger/libAnalyzer.so: Undefined symbol
"_ZN3edb2v112debuggerBaseE")
[loadPlugins] Cannot load library /usr/home/arr/debugger/libBinarySearcher.so:
(/usr/home/arr/debugger/libBinarySearcher.so: Undefined symbol "_ZTV9MemRegion")
[loadPlugins] Cannot load library /usr/home/arr/debugger/libBookmarks.so:
(/usr/home/arr/debugger/libBookmarks.so: Undefined symbol
"_ZN3edb2v18getDWORDEyRbR15ExpressionErrorPv")
[loadPlugins] Cannot load library
/usr/home/arr/debugger/libBreakpointManager.so:
(/usr/home/arr/debugger/libBreakpointManager.so: Undefined symbol
"_ZN3edb2v18getDWORDEyRbR15ExpressionErrorPv")
[loadPlugins] Loading Plugin: libCheckVersion.so : 0x803bcde50
[loadPlugins] Plugin verification data mismatch in
'/usr/home/arr/debugger/libDebuggerCore.so'
[loadPlugins] Cannot load library /usr/home/arr/debugger/libDumpState.so:
(/usr/home/arr/debugger/libDumpState.so: Undefined symbol
"_ZN3edb2v112debuggerBaseE")
[loadPlugins] Cannot load library /usr/home/arr/debugger/libELFBinaryInfo.so:
(/usr/home/arr/debugger/libELFBinaryInfo.so: Undefined symbol
"_ZN3edb2v112debuggerBaseE")
[loadPlugins] Cannot load library /usr/home/arr/debugger/libEnvironment.so:
(/usr/home/arr/debugger/libEnvironment.so: Undefined symbol
"_ZN3edb2v112debuggerBaseE")
[loadPlugins] Loading Plugin: libFunctionDB.so : 0x803b7aa80
[loadPlugins] Cannot load library /usr/home/arr/debugger/libFunctionFinder.so:
(/usr/home/arr/debugger/libFunctionFinder.so: Undefined symbol "_ZTV9MemRegion")
[loadPlugins] Cannot load library
/usr/home/arr/debugger/libHardwareBreakpoints.so:
(/usr/home/arr/debugger/libHardwareBreakpoints.so: Undefined symbol
"_ZN3edb2v112debuggerBaseE")
[loadPlugins] Cannot load library /usr/home/arr/debugger/libHeapAnalyzer.so:
(/usr/home/arr/debugger/libHeapAnalyzer.so: Undefined symbol
"_ZN3edb2v112debuggerBaseE")
[loadPlugins] Cannot load library /usr/home/arr/debugger/libOpcodeSearcher.so:
(/usr/home/arr/debugger/libOpcodeSearcher.so: Undefined symbol
"_ZN3edb2v112debuggerBaseE")
[loadPlugins] Cannot load library /usr/home/arr/debugger/libReferences.so:
(/usr/home/arr/debugger/libReferences.so: Undefined symbol
"_ZN3edb2v112debuggerBaseE")
[loadPlugins] Loading Plugin: libSessionManager.so : 0x803b7ca20
[loadPlugins] Cannot load library /usr/home/arr/debugger/libStringSearcher.so:
(/usr/home/arr/debugger/libStringSearcher.so: Undefined symbol
"_ZN3edb2v110debuggerUIE")
[loadPlugins] Cannot load library /usr/home/arr/debugger/libSymbolViewer.so:
(/usr/home/arr/debugger/libSymbolViewer.so: Undefined symbol
"_ZN3edb2v110debuggerUIE")
/libexec/ld-elf.so.1: /usr/home/arr/debugger/libFunctionDB.so: Undefined symbol
"_ZN3edb2v113setFunctionDBEP10FunctionDB"</thetext>
Original comment by evan.teran
on 3 Oct 2012 at 4:35
For unix and related OSes there is often a flag to enable shared libs seeing
symbols in the application that loads them. This is almost certainly the issue.
For OpenBSD it is "-Wl,--export-dynamic"
For Linux it is "-rdynamic"
I would guess that the OpenBSD flags would work for FreeBSD too.
Could you please send me a patch so I can include your fixes? I am fairly close
to doing my next release, it would be wonderful if I could get things just one
step closer to working on other platforms besides Linux ;).
Original comment by evan.teran
on 3 Oct 2012 at 4:35
Ok, in os/unix/freebsd/DialogAttach.cpp i made following changes:
line
#include <kvm.h>
replaced with
#include <fcntl.h>
#include <kvm.h>
#include <paths.h>
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/user.h>
then at line 64
procInfo.pid = kprocaccess[i]->ki_pid;
procInfo.uid = kprocaccess[i]->ki_uid;
procInfo.name = kprocaccess[i]->ki_comm;
changed to
procInfo.pid = (kprocaccess+i)->ki_pid;
procInfo.uid = (kprocaccess+i)->ki_uid;
procInfo.name = (kprocaccess+i)->ki_comm;
because kprocaccess is struct kinfo_proc pointer, not array.
Then, in os/unix/freebsd/MemRegion.cpp i removed #include "SmartPointer.h",
because it was not found.
After that i tried to pass this flags you told me, but since im not familiar
with qt at all, i just did
gmake CXXFLAGS="-Wl,--export-dynamic -fPIC" CFLAGS="-Wl,--export-dynamic -fPIC"
I've added -fPIC because of linker complaining about it at link stage.
Finally running edb gave me this:
Starting EDB Version: 0.9.13
Please Report Bugs & Requests At: http://bugs.codef00.com/
[loadPlugins] Loading Plugin: libAnalyzer.so : 0x803bc9580
[loadPlugins] Loading Plugin: libBinarySearcher.so : 0x803b7aa60
[loadPlugins] Loading Plugin: libBookmarks.so : 0x803bcb470
[loadPlugins] Loading Plugin: libBreakpointManager.so : 0x803bfdeb0
[loadPlugins] Loading Plugin: libCheckVersion.so : 0x803bcd070
[loadPlugins] Plugin verification data mismatch in
'/usr/home/arr/debugger/libDebuggerCore.so'
[loadPlugins] Loading Plugin: libDumpState.so : 0x803b7ac20
[loadPlugins] Loading Plugin: libELFBinaryInfo.so : 0x803b7ac80
[loadPlugins] Loading Plugin: libEnvironment.so : 0x803bcd430
[loadPlugins] Loading Plugin: libFunctionDB.so : 0x803b7ae00
[loadPlugins] Loading Plugin: libFunctionFinder.so : 0x803bcd580
[loadPlugins] Loading Plugin: libHardwareBreakpoints.so : 0x80992c140
[loadPlugins] Loading Plugin: libHeapAnalyzer.so : 0x803bcd640
[loadPlugins] Loading Plugin: libOpcodeSearcher.so : 0x803bcd6d0
[loadPlugins] Loading Plugin: libReferences.so : 0x803bcd760
[loadPlugins] Loading Plugin: libSessionManager.so : 0x803b7cd80
[loadPlugins] Loading Plugin: libStringSearcher.so : 0x803bcd850
[loadPlugins] Loading Plugin: libSymbolViewer.so : 0x803bcd910
[loadPlugins] The file '/usr/home/arr/debugger/libDebuggerCore.so' is not a
valid Qt plugin.
/libexec/ld-elf.so.1: /usr/home/arr/debugger/libAnalyzer.so: Undefined symbol
"_ZN3edb2v111setAnalyzerEP17AnalyzerInterface"</thetext>
Original comment by evan.teran
on 3 Oct 2012 at 4:36
[deleted comment]
Definitely getting closer to a functional version :-).
I've made the changes you suggested. I imagine that (kprocaccess+i)->ki_pid;
could just as easily be kprocaccess[i].->ki_pid; But same difference.
Anyway, at some point I'll setup a freebsd VM and see if I can get the
finishing touches in there.
Thanks!
Original comment by evan.teran
on 3 Oct 2012 at 4:37
Hello, how it's going? Can't wait to see working version on FreeBSD.
Original comment by evan.teran
on 3 Oct 2012 at 4:37
I've had a little lull in development, but things are moving along. I too would
love to add the BSD family to the list of official supported OSes :-).
(In reply to comment #7)
> Hello, how it's going? Can't wait to see working version on FreeBSD.
Original comment by evan.teran
on 3 Oct 2012 at 4:37
Hello!
I created FreeBSD port for edb:
http://aldis.git.bsdroot.lv/devel/edb/
I marked it BROKE, because currently it doesn't work
Also I haven't send pr to FreeBSD to create new port
dekstop.pc $ edb
Starting EDB Version: 0.9.15
Please Report Bugs & Requests At: http://bugs.codef00.com/
[loadPlugins] Loading Plugin: libAnalyzer.so : 0x29c3a940
[loadPlugins] Loading Plugin: libBinarySearcher.so : 0x29c39720
[loadPlugins] Loading Plugin: libBookmarks.so : 0x29c38d60
[loadPlugins] Loading Plugin: libBreakpointManager.so : 0x29c3aae0
[loadPlugins] Loading Plugin: libCheckVersion.so : 0x29c3aba0
[loadPlugins] The file '/usr/local/lib/edb/libDebuggerCore.so' is not a valid
Qt plugin.
[loadPlugins] Loading Plugin: libDumpState.so : 0x29c39800
[loadPlugins] Loading Plugin: libELFBinaryInfo.so : 0x29c39830
[loadPlugins] Loading Plugin: libEnvironment.so : 0x297d1da0
[loadPlugins] Loading Plugin: libFunctionDB.so : 0x29c39790
[loadPlugins] Loading Plugin: libFunctionFinder.so : 0x29c3adc0
[loadPlugins] Loading Plugin: libHardwareBreakpoints.so : 0x29c3ae80
[loadPlugins] Loading Plugin: libHeapAnalyzer.so : 0x29c3af40
[loadPlugins] Loading Plugin: libOpcodeSearcher.so : 0x29c3c300
[loadPlugins] Loading Plugin: libReferences.so : 0x29c3c360
[loadPlugins] Loading Plugin: libSessionManager.so : 0x29c39940
[loadPlugins] Loading Plugin: libStringSearcher.so : 0x29c3c3c0
[loadPlugins] Loading Plugin: libSymbolViewer.so : 0x29c43080
[Function Database] loaded with 103 function definitions.
I hope that we will get working FreeBSD version soon :D
Original comment by evan.teran
on 3 Oct 2012 at 4:38
Last build was with some bad patched...
here's error, of current build
[loadPlugins] Plugin verification data mismatch in
'/usr/local/lib/edb/libDebuggerCore.so'
Original comment by evan.teran
on 3 Oct 2012 at 4:38
van, it looks you don't have much time to work on edb. How about opening its
source?
Original comment by evan.teran
on 3 Oct 2012 at 4:38
@arrowdodger: edb is open source :-P. However, I am actually actively
developing it, pretty much constantly. Some changes are bigger under the hood
than others so they take longer to get to a point where I feel they are release
worthy.
I do plan to continue to work on this, and am especially working on the
non-linux platforms. So rest assured, it is coming.
Certainly, if you have some patches for this particular issue, please either
post them here or email them to me directly.
Original comment by evan.teran
on 3 Oct 2012 at 4:39
(In reply to comment #12)
> @arrowdodger: edb is open source :-P. However, I am actually actively
> developing it, pretty much constantly. Some changes are bigger under the hood
> than others so they take longer to get to a point where I feel they are
release
> worthy.
>
> I do plan to continue to work on this, and am especially working on the
> non-linux platforms. So rest assured, it is coming.
>
> Certainly, if you have some patches for this particular issue, please either
> post them here or email them to me directly.
Yes, i've put it wrong. I meant that it would be nice, if you create VCS
repository somewhere. It would allow people to track development progress and,
most importantly, easily create patches and send them to you.
Original comment by evan.teran
on 3 Oct 2012 at 4:39
I've made a lot of progress getting things to work on openbsd, to the point
where things actually "debug" :-). I am hoping that this work will help with
the freebsd work. I made a release today (10/20/10) so everyone is welcome to
check out the progress.
NOTE: I have not attempted to compile edb on freebsd in a while. However, both
FreeBSD and OSX are my primary targets for the next version (and I am hoping
that the next version wont take quite as long).
Original comment by evan.teran
on 3 Oct 2012 at 4:39
Changes i've made:
1. In src/os/unix/freebsd/DebugEvent.cpp:188
change
=reinterpret_cast<...>(0);
to simply
=0;
2. In include/os/unix/freebsd/MemRegion.h
added at around line 84
private:
void set_permissions(bool read, bool write, bool execute, edb::address_t
temp_address);
After that i've got some warnings and then finally link error:
obj/release-shared/DebuggerMain.o(.text+0x95f1): In function
`DebuggerMain::attach(int)':
: undefined reference to `edb::v1::get_parent_pid(int)'
Original comment by evan.teran
on 3 Oct 2012 at 4:40
hanks. Those are actually the same things I've needed to get the openbsd port
to work correctly :-). The cast was there because there is supposed to be an
address_t variable representing the fault address which is unknown for now. I
need to look into the structures available through kvm on freebsd.
I'll keep you guys posted and try to get a "functional" version out soon.
Original comment by evan.teran
on 3 Oct 2012 at 4:40
Fix for 0.9.17.
I've built and ran EDB with this patch, however disassembly and stack views are
empty during debugging and all registers contain zeros. But debugee seems to
run perfectly.
Original comment by evan.teran
on 3 Oct 2012 at 4:41
Attachments:
Thanks for the patch! It is applied in my subversion. As for the blank views,
did you try running edb as root?
IIRC, it currently requires privs to access the KVM API for a few things. I am
going to work on removing that need (perhaps the debugging core will be a
standalone app which is SUID root and using IPC with the main app, I dunno).
Original comment by evan.teran
on 3 Oct 2012 at 4:42
Yes, i've tried it. Still same issue. As far as i know there is no KVM on
FreeBSD.
Original comment by evan.teran
on 3 Oct 2012 at 4:42
Original comment by evan.teran
on 3 Oct 2012 at 4:42
Original comment by evan.teran
on 4 Apr 2014 at 3:47
Original issue reported on code.google.com by
evan.teran
on 3 Oct 2012 at 3:21