Can I use lldb to debug Mac OSX remotely from linux machine

Hi, all
  I want to debug kernel extension for Mac OSX. However, I have only one Mac system currently, is it possible to use Linux as host machine remotely?


It should be after doing a bit of work.

The first thing is to make sure that all needed plug-ins are actually compiled into the linux version. Go to lldb.cpp and you will see code:

#if defined (__APPLE__)
#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h"
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h"
#include "Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h"
#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
#include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
#include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
#include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h"
#include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h"

Start by getting rid of this #define and building all of these plug-ins for all system (they should compile).

Next modify lldb_private::Initialize () to also remove the "#if defined (__APPLE__)" so the static ::Initialize method is called for all plug-ins.

Do the same for lldb_private::Terminate().

That should be all you need to do! Then you should be able to do:

% lldb
(lldb) platform select remote-macosx
(lldb) file ...
(lldb) kdp-remote

And you will need to update the CMakelists.txt and any Makefile files to also build these for all builds.

Greg, thanks for your kindly reply.