ChrisZim / edb-debugger

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

Port to Mac OS/X #58

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I installed qt-mac-opensource-4.5.2, but when I run "qmake" in the edb source 
root I get: 

WARNING: Ignored (not found) '/Users/ronaaron/src/debugger/core/core.xcodeproj'
WARNING: Ignored (not found) '/Users/ronaaron/src/debugger/src/edb.xcodeproj'
WARNING: Ignored (not found) 
'/Users/ronaaron/src/debugger/plugins/SessionManager/SessionManager.xcodeproj'
... etc ...

and "make" then fails (so does xcodebuild...)

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

GoogleCodeExporter commented 9 years ago
OK; I was able to get much farther by doing:

qmake -project -recursive
qmake
xcodebuild debugger.xcodeproj

But I need to install 'boost' (the Mac port didn't install the 'boost' header 
files for some reason).

More when boost finally finishes building and installing (by hand)...

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

GoogleCodeExporter commented 9 years ago
Lots of non-os-specific compile errorrs:

Building target “debugger” of project “debugger” with configuration 
“Release” — (512 errors, 47 warnings)
        cd /Users/ronaaron/src/debugger
    /Developer/usr/bin/gcc-4.0 -x c++ -arch i386 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -Os -mdynamic-no-pic -isysroot /Developer/SDKs/MacOSX10.5.sdk -fvisibility=hidden -fvisibility-inlines-hidden -mmacosx-version-min=10.3 -I/Users/ronaaron/src/debugger/build/debugger.build/Release/debugger.build/debugger.hmap -F/Users/ronaaron/src/debugger/build/Release -I/Users/ronaaron/src/debugger/build/Release/include -I/Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -I. -Iinclude -Iinclude/arch/i386 -Iinclude/os/unix -Isrc -Isrc/edisassm -Isrc/arch/i386 -Isrc/widgets -Iplugins/Analyzer -Iplugins/BinarySearcher -Iplugins/Bookmarks -Iplugins/BreakpointManager -Iplugins/CheckVersion -Iplugins/DebuggerCore -Iplugins/DumpState -Iplugins/ELFBinaryInfo -Iplugins/Environment -Iplugins/
FunctionDB -Iplugins/FunctionFinder -Iplugins/HardwareBreakpoints 
-Iplugins/HeapAnalyzer -Iplugins/OpcodeSearcher -Iplugins/OpenFiles 
-Iplugins/References -Iplugins/SessionManager -Iplugins/StringSearcher 
-Iplugins/SymbolViewer -I. -I. -I/usr/local/include 
-I/System/Library/Frameworks/CarbonCore.framework/Headers 
-I/usr/local/Qt4.5/mkspecs/macx-xcode 
-I/Users/ronaaron/src/debugger/build/debugger.build/Release/debugger.build/Deriv
edSources -pipe -g -Wall -W -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -c 
/Users/ronaaron/src/debugger/core/BinaryString.cpp -o 
/Users/ronaaron/src/debugger/build/debugger.build/Release/debugger.build/Objects
-normal/i386/BinaryString.o
/Users/ronaaron/src/debugger/core/BinaryString.cpp: In member function 'virtual 
void HexStringValidator::fixup(QString&) const':
/Users/ronaaron/src/debugger/core/BinaryString.cpp:38: error: 'std::isxdigit' 
is not a valid template argument for type 'int ()(int)' because function 'int 
isxdigit(int)' has not external linkage
/Users/ronaaron/src/debugger/core/BinaryString.cpp:38: error: no matching 
function for call to 'safe_ctype(char)'
        /Users/ronaaron/src/debugger/core/BinaryString.cpp:38: error: 'std::isxdigit' is not a valid template argument for type 'int ()(int)' because function 'int isxdigit(int)' has not external linkage
        /Users/ronaaron/src/debugger/core/BinaryString.cpp:38: error: no matching function for call to 'safe_ctype(char)'
        cd /Users/ronaaron/src/debugger
    /Developer/usr/bin/gcc-4.0 -x c++ -arch i386 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -Os -mdynamic-no-pic -isysroot /Developer/SDKs/MacOSX10.5.sdk -fvisibility=hidden -fvisibility-inlines-hidden -mmacosx-version-min=10.3 -I/Users/ronaaron/src/debugger/build/debugger.build/Release/debugger.build/debugger.hmap -F/Users/ronaaron/src/debugger/build/Release -I/Users/ronaaron/src/debugger/build/Release/include -I/Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -I. -Iinclude -Iinclude/arch/i386 -Iinclude/os/unix -Isrc -Isrc/edisassm -Isrc/arch/i386 -Isrc/widgets -Iplugins/Analyzer -Iplugins/BinarySearcher -Iplugins/Bookmarks -Iplugins/BreakpointManager -Iplugins/CheckVersion -Iplugins/DebuggerCore -Iplugins/DumpState -Iplugins/ELFBinaryInfo -Iplugins/Environment -Iplugins/
FunctionDB -Iplugins/FunctionFinder -Iplugins/HardwareBreakpoints 
-Iplugins/HeapAnalyzer -Iplugins/OpcodeSearcher -Iplugins/OpenFiles 
-Iplugins/References -Iplugins/SessionManager -Iplugins/StringSearcher 
-Iplugins/SymbolViewer -I. -I. -I/usr/local/include 
-I/System/Library/Frameworks/CarbonCore.framework/Headers 
-I/usr/local/Qt4.5/mkspecs/macx-xcode 
-I/Users/ronaaron/src/debugger/build/debugger.build/Release/debugger.build/Deriv
edSources -pipe -g -Wall -W -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -c 
/Users/ronaaron/src/debugger/src/Debugger.cpp -o 
/Users/ronaaron/src/debugger/build/debugger.build/Release/debugger.build/Objects
-normal/i386/Debugger.o
/Users/ronaaron/src/debugger/src/Debugger.cpp: In function 'bool 
edb::v1::getASCIIStringAtAddress(edb::address_t, QString&, int, int, int&)':
/Users/ronaaron/src/debugger/src/Debugger.cpp:407: error: 'std::isprint' is not 
a valid template argument for type 'int ()(int)' because function 'int 
isprint(int)' has not external linkage
/Users/ronaaron/src/debugger/src/Debugger.cpp:407: error: no matching function 
for call to 'safe_ctype(char&)'
/Users/ronaaron/src/debugger/src/Debugger.cpp:407: error: 'std::isspace' is not 
a valid template argument for type 'int ()(int)' because function 'int 
isspace(int)' has not external linkage
/Users/ronaaron/src/debugger/src/Debugger.cpp:407: error: no matching function 
for call to 'safe_ctype(char&)'
        /Users/ronaaron/src/debugger/src/Debugger.cpp:407: error: 'std::isprint' is not a valid template argument for type 'int ()(int)' because function 'int isprint(int)' has not external linkage
        /Users/ronaaron/src/debugger/src/Debugger.cpp:407: error: no matching function for call to 'safe_ctype(char&)'
        /Users/ronaaron/src/debugger/src/Debugger.cpp:407: error: 'std::isspace' is not a valid template argument for type 'int ()(int)' because function 'int isspace(int)' has not external linkage
        /Users/ronaaron/src/debugger/src/Debugger.cpp:407: error: no matching function for call to 'safe_ctype(char&)'
        cd /Users/ronaaron/src/debugger
    /Developer/usr/bin/gcc-4.0 -x c++ -arch i386 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -Os -mdynamic-no-pic -isysroot /Developer/SDKs/MacOSX10.5.sdk -fvisibility=hidden -fvisibility-inlines-hidden -mmacosx-version-min=10.3 -I/Users/ronaaron/src/debugger/build/debugger.build/Release/debugger.build/debugger.hmap -F/Users/ronaaron/src/debugger/build/Release -I/Users/ronaaron/src/debugger/build/Release/include -I/Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -I. -Iinclude -Iinclude/arch/i386 -Iinclude/os/unix -Isrc -Isrc/edisassm -Isrc/arch/i386 -Isrc/widgets -Iplugins/Analyzer -Iplugins/BinarySearcher -Iplugins/Bookmarks -Iplugins/BreakpointManager -Iplugins/CheckVersion -Iplugins/DebuggerCore -Iplugins/DumpState -Iplugins/ELFBinaryInfo -Iplugins/Environment -Iplugins/
FunctionDB -Iplugins/FunctionFinder -Iplugins/HardwareBreakpoints 
-Iplugins/HeapAnalyzer -Iplugins/OpcodeSearcher -Iplugins/OpenFiles 
-Iplugins/References -Iplugins/SessionManager -Iplugins/StringSearcher 
-Iplugins/SymbolViewer -I. -I. -I/usr/local/include 
-I/System/Library/Frameworks/CarbonCore.framework/Headers 
-I/usr/local/Qt4.5/mkspecs/macx-xcode 
-I/Users/ronaaron/src/debugger/build/debugger.build/Release/debugger.build/Deriv
edSources -pipe -g -Wall -W -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -c 
/Users/ronaaron/src/debugger/src/DebuggerMain.cpp -o 
/Users/ronaaron/src/debugger/build/debugger.build/Release/debugger.build/Objects
-normal/i386/DebuggerMain.o
/Users/ronaaron/src/debugger/src/DebuggerMain.cpp: In member function 'void 
DebuggerMain::on_registerList_itemDoubleClicked(QTreeWidgetItem*)':
/Users/ronaaron/src/debugger/src/DebuggerMain.cpp:428: warning: passing 
negative value 'REG_ANY' for argument 2 to 'virtual edb::reg_t* 
ArchProcessorInterface::valueFromItem(const QTreeWidgetItem&, unsigned int)'
        /Users/ronaaron/src/debugger/src/DebuggerMain.cpp:428: warning: passing negative value 'REG_ANY' for argument 2 to 'virtual edb::reg_t* ArchProcessorInterface::valueFromItem(const QTreeWidgetItem&, unsigned int)'
        cd /Users/ronaaron/src/debugger
    /Developer/usr/bin/gcc-4.0 -x c++ -arch i386 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -Os -mdynamic-no-pic -isysroot /Developer/SDKs/MacOSX10.5.sdk -fvisibility=hidden -fvisibility-inlines-hidden -mmacosx-version-min=10.3 -I/Users/ronaaron/src/debugger/build/debugger.build/Release/debugger.build/debugger.hmap -F/Users/ronaaron/src/debugger/build/Release -I/Users/ronaaron/src/debugger/build/Release/include -I/Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -I. -Iinclude -Iinclude/arch/i386 -Iinclude/os/unix -Isrc -Isrc/edisassm -Isrc/arch/i386 -Isrc/widgets -Iplugins/Analyzer -Iplugins/BinarySearcher -Iplugins/Bookmarks -Iplugins/BreakpointManager -Iplugins/CheckVersion -Iplugins/DebuggerCore -Iplugins/DumpState -Iplugins/ELFBinaryInfo -Iplugins/Environment -Iplugins/
FunctionDB -Iplugins/FunctionFinder -Iplugins/HardwareBreakpoints 
-Iplugins/HeapAnalyzer -Iplugins/OpcodeSearcher -Iplugins/OpenFiles 
-Iplugins/References -Iplugins/SessionManager -Iplugins/StringSearcher 
-Iplugins/SymbolViewer -I. -I. -I/usr/local/include 
-I/System/Library/Frameworks/CarbonCore.framework/Headers 
-I/usr/local/Qt4.5/mkspecs/macx-xcode 
-I/Users/ronaaron/src/debugger/build/debugger.build/Release/debugger.build/Deriv
edSources -pipe -g -Wall -W -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -c 
/Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.cpp -o 
/Users/ronaaron/src/debugger/build/debugger.build/Release/debugger.build/Objects
-normal/i386/CheckVersion.o
/Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.cpp:23:18: 
error: QHttp: No such file or directory
/Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.cpp: In member 
function 'void CheckVersion::doCheck()':
/Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.cpp:86: error: 
invalid use of undefined type 'struct QHttp'
/Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.h:26: error: 
forward declaration of 'struct QHttp'
/Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.cpp:87: error: 
no matching function for call to 'CheckVersion::connect(QHttp*&, const char*, 
CheckVersion* const, const char*)'
/Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks/QtCore.framework/Headers/qobje
ct.h:202: note: candidates are: static bool QObject::connect(const QObject*, 
const char*, const QObject*, const char*, Qt::ConnectionType)
/Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks/QtCore.framework/Headers/qobje
ct.h:307: note:                 bool QObject::connect(const QObject*, const 
char*, const char*, Qt::ConnectionType) const
/Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.cpp:90: error: 
invalid use of undefined type 'struct QHttp'
/Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.h:26: error: 
forward declaration of 'struct QHttp'
/Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.cpp:99: error: 
invalid use of undefined type 'struct QHttp'
/Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.h:26: error: 
forward declaration of 'struct QHttp'
/Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.cpp:102: error: 
invalid use of undefined type 'struct QHttp'
/Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.h:26: error: 
forward declaration of 'struct QHttp'
/Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.cpp:103: error: 
invalid use of undefined type 'struct QHttp'
/Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.h:26: error: 
forward declaration of 'struct QHttp'
/Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.cpp: In member 
function 'void CheckVersion::requestDone(bool)':
/Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.cpp:122: error: 
invalid use of undefined type 'struct QHttp'
/Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.h:26: error: 
forward declaration of 'struct QHttp'
/Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.cpp:125: error: 
invalid use of undefined type 'struct QHttp'
/Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.h:26: error: 
forward declaration of 'struct QHttp'
        /Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.cpp:23:18: error: QHttp: No such file or directory
        /Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.cpp:86: error: invalid use of undefined type 'struct QHttp'
        /Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.h:26: error: forward declaration of 'struct QHttp'
        /Users/ronaaron/src/debugger/plugins/CheckVersion/CheckVersion.cpp:87: error: no matching function for call to 'CheckVersion::connect(QHttp*&, const char*, CheckVersion* const, const char*)'
        /Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks/QtCore.framework/Headers/qobject.h:202: note: candidates are: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)

etc ...

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

GoogleCodeExporter commented 9 years ago
Issue 101 has been merged into this issue.

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

GoogleCodeExporter commented 9 years ago
I've posted because I had different error and I've used different compiler, so 
it's not a duplicate bug. If you need help with testing on a Mac, I test you 
your code up to a twice a day every day(90% of the time I'm near my computer 
every day), since it's the only disassembler for a Mac which looks promising, 
also can it assemble modified code back to a binary state?

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

GoogleCodeExporter commented 9 years ago
@a2077497@nepwk.com:

You make a good point about it being a different error. The reason I marked it 
as a duplicate is because the OSX port is very much a work in progress. So at 
any point in time (until it is more complete), it may or may not build :-/.

Are you building on OSX Lion? If so, I am guessing that apple changed some of 
the structures in that version.

To answer your question, it cannot currently assemble code, but that is 
definitely a feature I plan to implement at some point, hopefully soon.

Evan

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

GoogleCodeExporter commented 9 years ago
@Evan Teran no, I've tried on OS X 10.6.8 using Mac Ports 2.0.1

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

GoogleCodeExporter commented 9 years ago
Interesting, I'll build it with the latest snow leopard and see what the issue 
is.

Thanks for the report.

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

GoogleCodeExporter commented 9 years ago
Would really love to see it on Mac. With my experience, so far everything for 
Linux worked just fine on Mac. I don't think Mac is very different from Linux.
As far as I understand what edb does is just reads binary file contents, then 
just parses it and emulates CPU and Memory actions, and finally displays 
everything using QT4(which is 100% cross platform)... how can it not work in 
first place everywhere where QT4 works? it should compile even on Windows.
The only thing what should require custom cross platform modification is 
hooking to the process, R/W memory of that process, pause/quit/resume process.

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

GoogleCodeExporter commented 9 years ago
EDB actually doesn't do any emulation at all. The code is executed natively 
using the OS specific debugging API. It is this debugging API that is very much 
non-cross-platform.

Every OS implements it differently, even though the UNIX family named the 
functions similarly (ptrace), they act very differently. So it gets complicated 
to port to new OSes. Once the core pieces are in place, the rest is easy ;-).

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

GoogleCodeExporter commented 9 years ago
Wait, so it means what any program can intercept other just like that? that it 
something new... So how does famous IDA analyse Mac, Win, and Linux executables 
on all platforms(e.g. Mac executable on Windows)?

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

GoogleCodeExporter commented 9 years ago
Any program that uses the OS's debugging API, yes, it can "intercept" other 
programs. This is actually a common feature in OSes because otherwise it would 
be very difficult to know what caused a misbehaved program to crash (or 
otherwise malfunction).

There are privilege issues that need to be addressed. For example on OSX, the 
code that uses the debug API needs to run with elevated privileges.

IDA is an **analyzer** first and debugger second. IDA's analysis engine works 
on all platforms, however, it can probably only natively debug OSX binaries on 
OSX, Linux binaries on Linux, etc.

EDB on the other hand is a debugger first, analyzer second.

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

Attachments:

GoogleCodeExporter commented 9 years ago
Issue 101 has been merged into this issue.

Original comment by evan.teran on 16 Dec 2013 at 4:31

GoogleCodeExporter commented 9 years ago
I am marking this task as done. The code as far as I know compiles on OSX and 
has basic functionality. Improving support for the OSX and other platforms will 
of course be an ongoing task.

Original comment by evan.teran on 16 Dec 2013 at 4:32