Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added column number break functionality to hxcpp, hxcpp-debugger #466

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
7 changes: 7 additions & 0 deletions build.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cd tools/hxcpp
haxe compile.hxml
cd ../build
haxe compile.hxml
cd ../../project
neko build.n clean
neko build.n
47 changes: 32 additions & 15 deletions include/hx/Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void __hxcpp_execution_trace(int inLevel);

// Used by debug breakpoints and execution trace
HXCPP_EXTERN_CLASS_ATTRIBUTES
void __hxcpp_set_stack_frame_line(int);
void __hxcpp_set_stack_frame_line(int, int);

HXCPP_EXTERN_CLASS_ATTRIBUTES
void __hxcpp_on_line_changed();
Expand Down Expand Up @@ -105,13 +105,14 @@ class StackFrame

// The constructor automatically adds the StackFrame to the list of
// stack frames for the current thread
//cs116 - modify to take column numbers
inline StackFrame(const char *inClassName, const char *inFunctionName,
#ifdef HXCPP_DEBUG_HASHES
int inClassFunctionHash,
#endif
const char *inFullName, const char *inFileName
#ifdef HXCPP_STACK_LINE
, int inLineNumber
, int inLineNumber, int inColumnNumber
#endif
#ifdef HXCPP_DEBUG_HASHES
, int inFileHash
Expand All @@ -129,6 +130,8 @@ class StackFrame
fullName(inFullName), fileName(inFileName),
#ifdef HXCPP_STACK_LINE
firstLineNumber(inLineNumber),
//CS116
firstColumnNumber(inColumnNumber),
#endif
#ifdef HXCPP_STACK_VARS
variables(0),
Expand All @@ -137,6 +140,7 @@ class StackFrame
{
#ifdef HXCPP_STACK_LINE
lineNumber = firstLineNumber;
columnNumber = firstColumnNumber;
#endif
__hxcpp_register_stack_frame(this);
}
Expand All @@ -154,10 +158,13 @@ class StackFrame
const char *fullName; // this is className.functionName - used for profiler
const char *fileName;
int firstLineNumber;
int firstColumnNumber;

// Current line number, changes during the lifetime of the stack frame.
// Only updated if HXCPP_STACK_LINE is defined.
//cs116 - add coumn numbers (possibly first column number)
int lineNumber;
int columnNumber;

// These are only used if HXCPP_DEBUG_HASHES is defined
int fileHash;
Expand Down Expand Up @@ -347,19 +354,19 @@ extern volatile bool gShouldCallHandleBreakpoints;

#ifdef HXCPP_DEBUG_HASHES
#define HX_STACK_FRAME(className, functionName, classFunctionHash, fullName,fileName, \
lineNumber, fileHash ) \
lineNumber, columnNumber, fileHash ) \
hx::StackFrame __stackframe(className, functionName, classFunctionHash, fullName, \
fileName, lineNumber, fileHash);
fileName, lineNumber, columnNumber, fileHash);
#else
#define HX_STACK_FRAME(className, functionName, classFunctionHash, fullName,fileName, \
lineNumber, fileHash ) \
lineNumber, columnNumber, fileHash ) \
hx::StackFrame __stackframe(className, functionName, fullName, \
fileName, lineNumber);
fileName, lineNumber, columnNumber);
#endif
#else

#define HX_STACK_FRAME(className, functionName, classFunctionHash, fullName,fileName, \
lineNumber, fileHash ) \
lineNumber, columnNumber, fileHash ) \
hx::StackFrame __stackframe(className, functionName, fullName, fileName);

#endif
Expand Down Expand Up @@ -398,16 +405,16 @@ extern volatile bool gShouldCallHandleBreakpoints;
#ifdef HXCPP_STACK_LINE
// If the debugger is enabled, must check for a breakpoint at every line.
#ifdef HXCPP_DEBUGGER
#define HX_STACK_LINE(number) \
__stackframe.lineNumber = number; \
#define HX_STACK_LINE(number, column) \
__stackframe.lineNumber = number; __stackframe.columnNumber = column; \
/* This is incorrect - a read memory barrier is needed here. */ \
/* For now, just live with the exceedingly rare cases where */ \
/* breakpoints are missed */ \
if (hx::gShouldCallHandleBreakpoints) { \
__hxcpp_on_line_changed(); \
}
#else
#define HX_STACK_LINE(number) __stackframe.lineNumber = number;
#define HX_STACK_LINE(number, column) __stackframe.lineNumber = number; __stackframe.columnNumber = column;
#endif // HXCPP_DEBUGGER
#endif // HXCPP_STACK_LINE

Expand Down Expand Up @@ -440,7 +447,7 @@ extern volatile bool gShouldCallHandleBreakpoints;

// Define any macros not defined already above
#ifndef HX_STACK_FRAME
#define HX_STACK_FRAME(className, functionName, classFuncHash, fullName, fileName, lineNumber, fileHash )
#define HX_STACK_FRAME(className, functionName, classFuncHash, fullName, fileName, lineNumber, columnNumber, fileHash )
#endif
#ifndef HX_STACK_THIS
#define HX_STACK_THIS(ptr)
Expand All @@ -452,7 +459,7 @@ extern volatile bool gShouldCallHandleBreakpoints;
#define HX_STACK_VAR(cpp_var, haxe_name)
#endif
#ifndef HX_STACK_LINE
#define HX_STACK_LINE(number)
#define HX_STACK_LINE(number, column)
#endif
#ifndef HX_STACK_CATCHABLE
#define HX_STACK_CATCHABLE(T, n)
Expand All @@ -471,8 +478,8 @@ extern volatile bool gShouldCallHandleBreakpoints;
// use debugging, you really should upgrade to a newer haxe compiler.

#undef HX_STACK_PUSH
#define HX_STACK_PUSH(fullName, fileName, lineNumber) \
HX_STACK_FRAME("", fullName, 0, fullName, fileName, lineNumber, 0)
#define HX_STACK_PUSH(fullName, fileName, lineNumber, columnNumber) \
HX_STACK_FRAME("", fullName, 0, fullName, fileName, lineNumber, columnNumber, 0)


#ifdef HXCPP_DEBUGGER
Expand All @@ -487,14 +494,19 @@ Array< ::String> __hxcpp_dbg_getFilesFullPath();
Array< ::String> __hxcpp_dbg_getClasses();
Array<Dynamic> __hxcpp_dbg_getThreadInfos();
Dynamic __hxcpp_dbg_getThreadInfo(int threadNumber, bool unsafe);
int __hxcpp_dbg_addFileLineBreakpoint(String fileName, int lineNumber);
int __hxcpp_dbg_addFileLineBreakpoint(String fileName, int lineNumber, int columnNumber);
int __hxcpp_dbg_addClassFunctionBreakpoint(String className,
String functionName);
void __hxcpp_dbg_deleteAllBreakpoints();
void __hxcpp_dbg_deleteBreakpoint(int number);
void __hxcpp_dbg_breakNow(bool wait);
void __hxcpp_dbg_continueThreads(int threadNumber, int count);
void __hxcpp_dbg_stepThread(int threadNumber, int stepType, int stepCount);
void __hxcpp_dbg_stepThreadLine(int threadNumber, int stepType, int stepCount);
void __hxcpp_dbg_setPrint(bool in);
bool __hxcpp_dbg_getPrintReady();
void __hxcpp_dbg_setPrintReady(bool in);
bool __hxcpp_dbg_getPrint();
Array<Dynamic> __hxcpp_dbg_getStackVariables(int threadNumber,
int stackFrameNumber,
bool unsafe,
Expand Down Expand Up @@ -553,6 +565,11 @@ inline void __hxcpp_dbg_deleteBreakpoint(int) { }
inline void __hxcpp_dbg_breakNow(bool) { }
inline void __hxcpp_dbg_continueThreads(int, int) { }
inline void __hxcpp_dbg_stepThread(int, int, int) { }
inline void __hxcpp_dbg_stepThreadLine(int, int, int) { }
void __hxcpp_dbg_setPrint(bool) { }
void __hxcpp_dbg_setPrintReady(bool) { }
bool __hxcpp_dbg_getPrintReady() { }
bool __hxcpp_dbg_getPrint() { }
inline Array<Dynamic> __hxcpp_dbg_getStackVariables(int, int, bool, Dynamic)
{ return Array_obj< String>::__new(); }
inline Dynamic __hxcpp_dbg_getStackVariableValue(int, int, String, bool,
Expand Down
Binary file modified project/build.n
Binary file not shown.
3 changes: 1 addition & 2 deletions src/hx/Anon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ Anon SourceInfo(String inFile, int inLine, String inClass, String inMethod)
Anon result = Anon_obj::Create();
result->Add(HX_CSTRING("fileName"),inFile);
result->Add(HX_CSTRING("lineNumber"),inLine);
//CS116 result->Add(HX_CSTRING("columnNumber"),inColumn);
result->Add(HX_CSTRING("className"),inClass);
result->Add(HX_CSTRING("methodName"),inMethod);
return result;
Expand All @@ -155,5 +156,3 @@ bool __hxcpp_anon_remove(Dynamic inObj,String inKey)
return __string_hash_remove(*map,inKey);
return false;
}


Loading