Skip to content

Commit

Permalink
Refactor to be a real api.
Browse files Browse the repository at this point in the history
  • Loading branch information
Russell Harmon committed Jul 4, 2013
1 parent 7a9f456 commit d999825
Show file tree
Hide file tree
Showing 23 changed files with 170 additions and 576 deletions.
2 changes: 2 additions & 0 deletions .syntastic_cpp_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-I ice
-std=c++11
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ SRCDIR := $(TOPDIR)/src
ICEDIR := $(TOPDIR)/ice

CPPFLAGS := $(CPPFLAGS) -ggdb -fno-omit-frame-pointer -O1 -fno-optimize-sibling-calls
CFLAGS := $(CFLAGS) -fPIC -Wall -Wnonnull -std=c11 -ferror-limit=3 -Werror
CXXFLAGS := $(CXXFLAGS) -std=c++11 -Wall -Wnonnull -fPIC -ferror-limit=3 -Werror
CFLAGS := $(CFLAGS) -fPIC -Wall -Wnonnull -std=c11 -ferror-limit=3 -Werror -std=gnu11
CXXFLAGS := $(CXXFLAGS) -std=gnu++11 -Wall -Wnonnull -fPIC -ferror-limit=3 -Werror
LIBRARIES := $(LIBRARIES) -lIce -lIceUtil

GTHREAD_CPPFLAGS ?= $(shell $(PKG_CONFIG) --cflags gthread-2.0)
Expand Down
3 changes: 1 addition & 2 deletions ice/debugger.ice
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#ifndef _DEBUGGER_ICE_
#define _DEBUGGER_ICE_

#include <type_inspector.ice>
#include <exceptions.ice>
#include <type.ice>

module Ruminate {
interface Debugger {
//TypeInspector *getTypeInspector( long address ) throws RuminateException;
Type *getTypeByVariableName( string variable, long tid ) throws RuminateException;
};
};
Expand Down
15 changes: 0 additions & 15 deletions ice/type_inspector.ice

This file was deleted.

4 changes: 2 additions & 2 deletions ice/variables.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ICE_SOURCES := debugger.ice type.ice debugger_factory.ice exceptions.ice type_inspector.ice
ICE_SOURCES := debugger.ice type.ice debugger_factory.ice exceptions.ice
ICE_SOURCES := $(ICE_SOURCES:%=$(CURDIR)/%)

ICE_DEPS := $(ICE_DEPS:.ice=.cpp.d) $(ICE_DEPS:.ice=.py.d)
Expand All @@ -8,7 +8,7 @@ ICE_PY_SOURCES := $(ICE_SOURCES:%.ice=%_ice.py)
ICE_HEADERS := $(ICE_SOURCES:.ice=.h)
ICE_OBJECTS := $(ICE_SOURCES:.ice=.o)

CPPFLAGS := $(CPPFLAGS) -I$(ICEDIR)
CPPFLAGS := $(CPPFLAGS) -I$(TOPDIR) -I$(ICEDIR)

ALL_OBJECTS := $(ALL_OBJECTS) $(ICE_OBJECTS)

Expand Down
8 changes: 0 additions & 8 deletions include/private/command.h

This file was deleted.

25 changes: 0 additions & 25 deletions include/private/protocol.h

This file was deleted.

6 changes: 6 additions & 0 deletions include/private/rdebugger.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "ruminate/rdebugger.h"

#include <Ice/Ice.h>
#include "ice/debugger_factory.h"

Ruminate::DebuggerFactoryPrx &rdebugger_get_factory( RDebugger *debugger );
10 changes: 4 additions & 6 deletions include/private/type.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include <lldb/API/LLDB.h>
#include <glib.h>
#include "ruminate/type.h"

G_BEGIN_DECLS
#include <Ice/Ice.h>
#include "ice/type.h"

Type *type_new( lldb::SBType &type, GError **err );

G_END_DECLS
Type *type_new( Ruminate::TypePrx &type, GError **err );
2 changes: 1 addition & 1 deletion include/ruminate.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
G_BEGIN_DECLS

#include <ruminate/rumination.h>
#include <ruminate/init.h>
#include <ruminate/rdebugger.h>
#include <ruminate/errors.h>
#include <ruminate/type.h>

Expand Down
6 changes: 4 additions & 2 deletions include/ruminate/init.h → include/ruminate/rdebugger.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _RUMINATE_INIT_H_
#define _RUMINATE_INIT_H_
#ifndef _RUMINATE_RDEBUGGER_H_
#define _RUMINATE_RDEBUGGER_H_

#include <glib.h>

Expand All @@ -11,6 +11,8 @@ G_BEGIN_DECLS
RDebugger *r_debugger_new( GError **err );
void r_debugger_delete( RDebugger *rum );

void r_debugger_get_type_by_variable_name( const char *name );

G_END_DECLS

#endif
9 changes: 7 additions & 2 deletions include/ruminate/rumination.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ G_BEGIN_DECLS
void rumination_delete( Rumination **rum );
Rumination *rumination_new( const char *exename, GError **err );

Type *rumination_find_type( Rumination *rum, const char *type_name, GError **err );
Type *rumination_get_type( Rumination *rum, void *obj, GError **err );
Type *rumination_get_type_by_local_variable( Rumination *rum, const char *varname, GError **err );

G_END_DECLS

#define rumination_get_type(rum, expr, err) ({ \
typeof(expr) _expr = (expr); \
(void) _expr; \
rumination_get_type_by_local_variable(rum, "_expr", err); \
})

#endif
28 changes: 0 additions & 28 deletions src/controller.cpp

This file was deleted.

30 changes: 23 additions & 7 deletions src/debugger_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,43 @@ def procgen(listener):
err
))
validate(err)
unix_signals = validate(self.process.GetUnixSignals())
for sig in unix_signals.signals:
unix_signals.SetShouldSuppress(sig, False)
unix_signals.SetShouldStop(sig, False)
unix_signals.SetShouldNotify(sig, False)
return self.process

self.em = LLDBEventMachine(procgen)

running = threading.Event()
def onRunning(event):
print("onRunning")
self.em.removeCallback(lldb.eStateRunning, onRunning)
running.set()
self.em.addCallback(lldb.eStateRunning, onRunning)

def onStopped(event):
print("onStopped")
self.em.removeCallback(lldb.eStateStopped, onStopped)
SBProcess.GetProcessFromEvent(event).Continue()

process = SBProcess.GetProcessFromEvent(event)

unix_signals = validate(process.GetUnixSignals())
# This may not need to be here, we might be able to put it
# outside the onStopped func
for sig in unix_signals.signals:
unix_signals.SetShouldSuppress(sig, False)
unix_signals.SetShouldStop(sig, False)
unix_signals.SetShouldNotify(sig, False)

process.Continue()
self.em.addCallback(lldb.eStateStopped, onStopped)

def doShutdown(event):
print("doShutdown(" + str(event) + ")")
print("doShutdown(" + getDescription(event) + ")")
shutdown()
self.em.addCallback(lldb.eStateCrashed, doShutdown)
self.em.addCallback(lldb.eStateExited, doShutdown)

self.em.begin()
running.wait()
print("__init__: end")

def shutdown(self):
self.em.shutdown()
Expand Down
8 changes: 7 additions & 1 deletion src/gettid.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@
#include "private/gettid.h"

#include <unistd.h>

#ifdef __linux__
#include <sys/syscall.h>
#else
//#error Don't know how to get tid on this platform
#endif

pid_t gettid() {
return syscall(SYS_gettid);
// return syscall(SYS_gettid);
return 0;
}
88 changes: 0 additions & 88 deletions src/init.cpp

This file was deleted.

3 changes: 2 additions & 1 deletion src/lldb_em.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def begin(self):

def shutdown(self):
self.shutdownRequested = True
self.join()
if threading.currentThread() != self:
self.join()

def getProcess(self):
return self.process
Expand Down
19 changes: 0 additions & 19 deletions src/protocol.cpp

This file was deleted.

Loading

0 comments on commit d999825

Please sign in to comment.