diff --git a/build.mod b/build.mod new file mode 100644 index 000000000..5e40bfdad --- /dev/null +++ b/build.mod @@ -0,0 +1,7 @@ +cd tools/hxcpp +haxe compile.hxml +cd ../build +haxe compile.hxml +cd ../../project +neko build.n clean +neko build.n diff --git a/include/hx/Debug.h b/include/hx/Debug.h index 1a9e2bcc7..e86fe18d1 100644 --- a/include/hx/Debug.h +++ b/include/hx/Debug.h @@ -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(); @@ -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 @@ -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), @@ -137,6 +140,7 @@ class StackFrame { #ifdef HXCPP_STACK_LINE lineNumber = firstLineNumber; + columnNumber = firstColumnNumber; #endif __hxcpp_register_stack_frame(this); } @@ -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; @@ -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 @@ -398,8 +405,8 @@ 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 */ \ @@ -407,7 +414,7 @@ extern volatile bool 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 @@ -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) @@ -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) @@ -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 @@ -487,7 +494,7 @@ Array< ::String> __hxcpp_dbg_getFilesFullPath(); Array< ::String> __hxcpp_dbg_getClasses(); Array __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(); @@ -495,6 +502,11 @@ 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 __hxcpp_dbg_getStackVariables(int threadNumber, int stackFrameNumber, bool unsafe, @@ -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 __hxcpp_dbg_getStackVariables(int, int, bool, Dynamic) { return Array_obj< String>::__new(); } inline Dynamic __hxcpp_dbg_getStackVariableValue(int, int, String, bool, diff --git a/project/build.n b/project/build.n index f3e630a53..828a9304d 100644 Binary files a/project/build.n and b/project/build.n differ diff --git a/src/hx/Anon.cpp b/src/hx/Anon.cpp index 9310e1078..c19e79705 100644 --- a/src/hx/Anon.cpp +++ b/src/hx/Anon.cpp @@ -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; @@ -155,5 +156,3 @@ bool __hxcpp_anon_remove(Dynamic inObj,String inKey) return __string_hash_remove(*map,inKey); return false; } - - diff --git a/src/hx/Debug.cpp b/src/hx/Debug.cpp index 9b250e478..a2e834e69 100644 --- a/src/hx/Debug.cpp +++ b/src/hx/Debug.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -38,6 +39,8 @@ using namespace Windows::System::Threading; const char* EXTERN_CLASS_NAME = "extern"; #endif +#define NO_COL_SPEC -1 + // These should implement write and read memory barrier, but since there are // no obvious portable implementations, they are currently left unimplemented static void write_memory_barrier() @@ -121,7 +124,7 @@ static void setStaticHandler(Dynamic &inStore, Dynamic inValue) } // This is the thread number of the debugger thread, extracted from -// information about the thread that called +// information about the thread that called // __hxcpp_dbg_setEventNotificationHandler static unsigned int g_debugThreadNumber = -1; @@ -146,12 +149,12 @@ class Profiler : mT0(0) { mDumpFile = inDumpFile; - + // When a profiler exists, the profiler thread needs to exist gThreadMutex.Lock(); - + gThreadRefCount += 1; - + if (gThreadRefCount == 1) { #if defined(HX_WINDOWS) #ifndef HX_WINRT @@ -209,7 +212,7 @@ class Profiler results.reserve(mProfileStats.size()); int total = 0; - std::map::iterator iter = + std::map::iterator iter = mProfileStats.begin(); while (iter != mProfileStats.end()) { ProfileEntry &pe = iter->second; @@ -309,7 +312,7 @@ struct ProfileEntry return ((total > inRHS.total) || ((total == inRHS.total) && (self < inRHS.self))); } - + const char *fullName; int self; std::vector children; @@ -321,7 +324,7 @@ struct ProfileEntry { int millis = 1; - while (gThreadRefCount > 0) { + while (gThreadRefCount > 0) { #ifdef HX_WINDOWS #ifndef HX_WINRT Sleep(millis); @@ -408,7 +411,7 @@ class Telemetry // When a profiler exists, the profiler thread needs to exist gThreadMutex.Lock(); - + gThreadRefCount += 1; if (gThreadRefCount == 1) { #if defined(HX_WINDOWS) @@ -647,7 +650,7 @@ class Telemetry { int millis = 1; - while (gThreadRefCount > 0) { + while (gThreadRefCount > 0) { #ifdef HX_WINDOWS #ifndef HX_WINRT Sleep(millis); @@ -719,11 +722,14 @@ class CallStack { public: + static void setPrint(bool in) { + } + // Gets the call stack of the calling thread static CallStack *GetCallerCallStack() { CallStack *stack = tlsCallStack; - + if (!stack) { int threadNumber = __hxcpp_GetCurrentThreadNumber(); @@ -741,7 +747,7 @@ class CallStack } static void RemoveCallStack(int threadNumber) -{ +{ gMutex.Lock(); CallStack *stack = gMap[threadNumber]; @@ -796,16 +802,19 @@ class CallStack { StackFrame *frame = mStackFrames[mStackFrames.size()-1]; #ifdef HXCPP_STACK_LINE - DBGLOG("%s::%s : %d\n", frame->className, frame->functionName, frame->lineNumber); + DBGLOG("%s::%s : %d.%d\n", frame->className, frame->functionName, frame->lineNumber, frame->columnNumber); #else DBGLOG("%s::%s\n", frame->className, frame->functionName); #endif } + //cs116 - modify to set column number as well #ifdef HXCPP_STACK_LINE - void SetLine(int inLine) + void SetLine(int inLine, int inColumn) { + printf("Line: %d, Column: %d\n", inLine, inColumn); mStackFrames[mStackFrames.size()-1]->lineNumber = inLine; + mStackFrames[mStackFrames.size()-1]->columnNumber = inColumn; if (gShouldCallHandleBreakpoints) __hxcpp_on_line_changed(); } @@ -850,7 +859,7 @@ class CallStack gMutex.Unlock(); } - + //cs116 static void StepOneThread(int threadNumber, int &stackLevel) { gMutex.Lock(); @@ -864,8 +873,53 @@ class CallStack break; } } + } - gMutex.Unlock(); + static CallStack* getStack() { + std::list::iterator iter = gList.begin(); + CallStack *stack = *iter; + + return stack; + } + + static std::vector getStackFrames(CallStack* stack) { + return stack->mStackFrames; + } + + static void StepOneThreadLine(int threadNumber, int &stackLevel, int start_line, int count) + { + gMutex.Lock(); + + std::list::iterator iter = gList.begin(); + CallStack* stack = *iter++; + int prev_line = start_line; + int c = -1; + int current_line = -1; + + while (iter != gList.end()) { + + if (stack->mThreadNumber == threadNumber) { + stackLevel = stack->mStackFrames.size() - 1; + while(1) { + prev_line = current_line; + current_line = stack->mStackFrames[stackLevel]->lineNumber; + if(current_line != prev_line) { + c++; + } + // != to account for loops and lines not lesser value than + //starting line. + if((current_line != start_line)) { + if(c == count) { + break; + } + } + stack->Continue(1); + } + break; + } + stack = *iter++; + } + gMutex.Unlock(); } static void GetCurrentCallStackAsStrings(Array result, bool skipLast) @@ -873,7 +927,7 @@ class CallStack CallStack *stack = CallStack::GetCallerCallStack(); int n = stack->mStackFrames.size() - (skipLast ? 1 : 0); - + for (int i = 0; i < n; i++) { // Reverse call stack to match exception stack @@ -928,7 +982,7 @@ class CallStack CallStack *stack = *stack_iter++; threadNumbers.push_back(stack->mThreadNumber); } - + gMutex.Unlock(); ::Array ret = Array_obj::__new(); @@ -967,7 +1021,7 @@ class CallStack if (stack->mStackFrames.size() <= stackFrameNumber) { break; } - StackVariable *variable = + StackVariable *variable = stack->mStackFrames[stackFrameNumber]->variables; while (variable) { ret->push(String(variable->mHaxeName)); @@ -1017,7 +1071,7 @@ class CallStack if ((stackFrameNumber < 0) || (stackFrameNumber >= size)) { return markNonexistent; } - + const char *nameToFind = name.c_str(); StackVariable *sv = stack->mStackFrames[stackFrameNumber]->variables; @@ -1083,7 +1137,7 @@ class CallStack } sv = sv->mNext; } - + return markNonexistent; } @@ -1173,7 +1227,7 @@ class CallStack { CallStack *stack = GetCallerCallStack(); - std::vector::reverse_iterator iter = + std::vector::reverse_iterator iter = stack->mStackFrames.rbegin(); while (iter != stack->mStackFrames.rend()) { StackFrame *frame = *iter++; @@ -1254,7 +1308,7 @@ class CallStack CallStack *stack = hx::CallStack::GetCallerCallStack(); Telemetry *telemetry = stack->mTelemetry; if (telemetry) { - //printf("Telemetry %016lx allocating %s at %016lx of size %d\n", telemetry, type, obj, inSize); + //printf("Telemetry %016lx allocating %s at %016lx of size %d\n", telemetry, type, obj, inSize); telemetry->HXTAllocation(stack, obj, inSize, type); } } @@ -1324,7 +1378,7 @@ class CallStack { return mStackFrames[depth]->fullName; } - + // Wait for someone to call Continue() on this call stack. Really only // the thread that owns this call stack should call Wait(). @@ -1401,7 +1455,7 @@ class CallStack #define EXCEPTION_PRINT(...) \ printf(__VA_ARGS__) #endif - + int size = mExceptionStack.size(); for (int i = size - 1; i >= 0; i--) { @@ -1436,12 +1490,13 @@ class CallStack mCanStop = false; // Call the handler to announce the status. + //CS116 - Added column number to status int stackFrame = mStackFrames.size() - 1; StackFrame *frame = mStackFrames[stackFrame]; g_eventNotificationHandler (mThreadNumber, THREAD_STOPPED, stackFrame, String(frame->className), String(frame->functionName), - String(frame->fileName), frame->lineNumber); + String(frame->fileName), frame->lineNumber, frame->columnNumber); // Wait until the debugger thread sets mWaiting to false and signals // the semaphore @@ -1489,8 +1544,9 @@ class CallStack { Dynamic ret = g_newStackFrameFunction (String(frame->fileName), String(frame->lineNumber), + String(frame->columnNumber), String(frame->className), String(frame->functionName)); - + // Don't do parameters for now // xxx figure them out later @@ -1530,6 +1586,8 @@ class CallStack /* static */ MyMutex CallStack::gMutex; /* static */ std::map CallStack::gMap; /* static */ std::list CallStack::gList; +bool printStatus; +bool PrintReady; #ifdef HXCPP_DEBUGGER class Breakpoints @@ -1545,7 +1603,7 @@ class Breakpoints } #endif - static int Add(String inFileName, int lineNumber) + static int Add(String inFileName, int lineNumber, int columnNumber) { // Look up the filename constant const char *fileName = LookupFileName(inFileName); @@ -1557,9 +1615,9 @@ class Breakpoints gMutex.Lock(); int ret = gNextBreakpointNumber++; - - Breakpoints *newBreakpoints = new Breakpoints(gBreakpoints, ret, fileName, lineNumber); - + + Breakpoints *newBreakpoints = new Breakpoints(gBreakpoints, ret, fileName, lineNumber, columnNumber); + gBreakpoints->RemoveRef(); // Write memory barrier ensures that newBreakpoints values are updated @@ -1585,14 +1643,14 @@ class Breakpoints if (!className) { return -1; } - + gMutex.Lock(); int ret = gNextBreakpointNumber++; - + Breakpoints *newBreakpoints = new Breakpoints (gBreakpoints, ret, className, functionName); - + gBreakpoints->RemoveRef(); // Write memory barrier ensures that newBreakpoints values are updated @@ -1613,7 +1671,7 @@ class Breakpoints static void DeleteAll() { gMutex.Lock(); - + Breakpoints *newBreakpoints = new Breakpoints(); gBreakpoints->RemoveRef(); @@ -1634,7 +1692,7 @@ class Breakpoints static void Delete(int number) { gMutex.Lock(); - + if (gBreakpoints->HasBreakpoint(number)) { // Replace mBreakpoints with a copy and remove the breakpoint // from it @@ -1693,10 +1751,23 @@ class Breakpoints gStepThread = threadNumber; gStepType = stepType; gStepCount = stepCount; - + CallStack::StepOneThread(threadNumber, gStepLevel); } + static void StepThreadLine(int threadNumber, StepType stepType, int stepCount) { + gStepThread = threadNumber; + gStepType = stepType; + gStepCount = 1; + + CallStack* stack = CallStack::getStack(); + std::vector frames = CallStack::getStackFrames(stack); + + int start_line = frames[frames.size()-1]->lineNumber; + + CallStack::StepOneThreadLine(threadNumber, gStepLevel, start_line, stepCount); + } + // Note that HandleBreakpoints is called immediately after a read memory // barrier by the HX_STACK_LINE macro static void HandleBreakpoints() @@ -1724,6 +1795,7 @@ class Breakpoints (gStepThread == stack->GetThreadNumber())) { if (gStepType == STEP_OVER) { if (stack->GetDepth() <= gStepLevel) { + //printf("Break immediate: stack->GetDepth=%d, gStepLevel=%d\n", stack->GetDepth(), gStepLevel); breakStatus = STATUS_STOPPED_BREAK_IMMEDIATE; } } @@ -1781,7 +1853,7 @@ class Breakpoints { // Check for class:function breakpoint if this is the // first line of the stack frame - if (frame->lineNumber == frame->firstLineNumber) + if ((frame->lineNumber == frame->firstLineNumber)) breakpointNumber = breakpoints->FindClassFunctionBreakpoint(frame); } @@ -1835,6 +1907,7 @@ class Breakpoints { int number; int lineNumber; + int columnNumber; int hash; bool isFileLine; @@ -1854,7 +1927,7 @@ class Breakpoints // Copies breakpoints from toCopy and adds a new file:line breakpoint Breakpoints(const Breakpoints *toCopy, int number, - const char *fileName, int lineNumber) + const char *fileName, int lineNumber, int columnNumber) : mRefCount(1) { mBreakpointCount = toCopy->mBreakpointCount + 1; @@ -1866,6 +1939,7 @@ class Breakpoints mBreakpoints[toCopy->mBreakpointCount].isFileLine = true; mBreakpoints[toCopy->mBreakpointCount].fileOrClassName = fileName; mBreakpoints[toCopy->mBreakpointCount].lineNumber = lineNumber; + mBreakpoints[toCopy->mBreakpointCount].columnNumber = columnNumber; #ifdef HXCPP_DEBUG_HASHES mBreakpoints[toCopy->mBreakpointCount].hash = Hash(0, fileName); @@ -1902,6 +1976,7 @@ class Breakpoints #endif } + // Copies breakpoints from toCopy except for number Breakpoints(const Breakpoints *toCopy, int number) : mRefCount(1) @@ -1991,15 +2066,23 @@ class Breakpoints return false; } + //CS116 - We added columnNumber conditional. int FindFileLineBreakpoint(StackFrame *inFrame) { for (int i = 0; i < mBreakpointCount; i++) { - Breakpoint &breakpoint = mBreakpoints[i]; - if (breakpoint.isFileLine && breakpoint.hash==inFrame->fileHash && - (breakpoint.lineNumber == inFrame->lineNumber) && - !strcmp(breakpoint.fileOrClassName.c_str(),inFrame->fileName) ) - return breakpoint.number; + Breakpoint &breakpoint = mBreakpoints[i]; + bool hasCol = (breakpoint.columnNumber != NO_COL_SPEC); + //Breakpoint &breakpoint = mBreakpoints[i]; + bool lineCondition = (breakpoint.isFileLine && breakpoint.hash==inFrame->fileHash && + (breakpoint.lineNumber == inFrame->lineNumber) && + !strcmp(breakpoint.fileOrClassName.c_str(),inFrame->fileName) ); + + if(hasCol && lineCondition && (breakpoint.columnNumber == inFrame->columnNumber)) { + return breakpoint.number; + }else if((!hasCol) && lineCondition) { + return breakpoint.number; + } } return -1; } @@ -2064,7 +2147,7 @@ class Breakpoints /* static */ MyMutex Breakpoints::gMutex; /* static */ int Breakpoints::gNextBreakpointNumber; -/* static */ Breakpoints * volatile Breakpoints::gBreakpoints = +/* static */ Breakpoints * volatile Breakpoints::gBreakpoints = new Breakpoints(); /* static */ StepType Breakpoints::gStepType = STEP_NONE; /* static */ int Breakpoints::gStepLevel; @@ -2086,7 +2169,7 @@ void __hxcpp_dbg_setEventNotificationHandler(Dynamic handler) hx::g_eventNotificationHandler = handler; GCAddRoot(&(hx::g_eventNotificationHandler.mPtr)); } - + void __hxcpp_dbg_enableCurrentThreadDebugging(bool enable) { @@ -2098,7 +2181,7 @@ int __hxcpp_dbg_getCurrentThreadNumber() { return __hxcpp_GetCurrentThreadNumber(); } - + Array< ::String> __hxcpp_dbg_getFiles() { @@ -2152,9 +2235,9 @@ 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) { - return hx::Breakpoints::Add(fileName, lineNumber); + return hx::Breakpoints::Add(fileName, lineNumber, columnNumber); } @@ -2195,7 +2278,27 @@ void __hxcpp_dbg_stepThread(int threadNumber, int stepType, int stepCount) stepCount); } +void __hxcpp_dbg_stepThreadLine(int threadNumber, int stepType, int stepCount) { + + hx::Breakpoints::StepThreadLine(threadNumber, (hx::StepType) stepType, + stepCount); +} + +void __hxcpp_dbg_setPrint(bool in) { + hx::printStatus = in; +} +bool __hxcpp_dbg_getPrint() { + return hx::printStatus; +} + +void __hxcpp_dbg_setPrintReady(bool in) { + hx::PrintReady = in; +} + +bool __hxcpp_dbg_getPrintReady() { + return hx::PrintReady; +} Array __hxcpp_dbg_getStackVariables(int threadNumber, int stackFrameNumber, bool unsafe, @@ -2212,7 +2315,7 @@ Dynamic __hxcpp_dbg_getStackVariableValue(int threadNumber, bool unsafe, Dynamic markNonexistent, Dynamic markThreadNotStopped) { - return hx::CallStack::GetVariableValue(threadNumber, stackFrameNumber, + return hx::CallStack::GetVariableValue(threadNumber, stackFrameNumber, name, unsafe, markNonexistent, markThreadNotStopped); } @@ -2296,7 +2399,7 @@ Dynamic __hxcpp_dbg_checkedThrow(Dynamic toThrow) #ifdef HX_WINRT //todo hx::CriticalErrorHandler(HX_CSTRING("Uncatchable Throw: " ), true); - + #else hx::CriticalErrorHandler(HX_CSTRING("Uncatchable Throw: " + toThrow->toString()), true); @@ -2330,7 +2433,7 @@ void hx::__hxcpp_register_stack_frame(hx::StackFrame *inFrame) hx::CallStack::PushCallerStackFrame(inFrame); } - + hx::StackFrame::~StackFrame() { hx::CallStack::PopCallerStackFrame(); @@ -2476,7 +2579,7 @@ int hx::Telemetry::ComputeCallStackId(hx::CallStack *stack) { int name_id = callstack.at(i++); //printf("Finding child with id=%d, asime now %#010x\n", name_id, asime); std::map::iterator lb = asime->children.lower_bound(name_id); - + if (lb != asime->children.end() && !(asime->children.key_comp()(name_id, lb->first))) { // key already exists asime = lb->second; @@ -2829,10 +2932,11 @@ void __hx_stack_set_last_exception() #endif } -void __hxcpp_set_stack_frame_line(int inLine) +void __hxcpp_set_stack_frame_line(int inLine, int inColumn) { +//cs116 - modify to accept column numbers #ifdef HXCPP_STACK_LINE - hx::CallStack::GetCallerCallStack()->SetLine(inLine); + hx::CallStack::GetCallerCallStack()->SetLine(inLine, inColumn); #endif } @@ -2877,4 +2981,3 @@ void __hxcpp_set_debugger_info(const char **inAllClasses, const char **inFullPat __all_classes = inAllClasses; __all_files_fullpath = inFullPaths; } - diff --git a/src/hx/Lib.cpp b/src/hx/Lib.cpp index 9875ffbd7..d774fea72 100644 --- a/src/hx/Lib.cpp +++ b/src/hx/Lib.cpp @@ -71,7 +71,7 @@ Module hxLoadLibrary(String inLib) #else flags |= RTLD_NOW; #endif - + Module result = dlopen(inLib.__CStr(), flags); if (gLoadDebug) { @@ -113,7 +113,7 @@ typedef hx::Object * (*prim_4)(hx::Object *,hx::Object *,hx::Object *,hx::Object typedef hx::Object * (*prim_5)(hx::Object *,hx::Object *,hx::Object *,hx::Object *,hx::Object *); typedef hx::Object * (*prim_mult)(hx::Object **inArray,int inArgs); -typedef void *(*FundFunc)(); +typedef void *(*FundFunc)(); extern const char* EXTERN_CLASS_NAME; @@ -131,42 +131,42 @@ class ExternalPrimitive : public hx::Object Dynamic __run() { - HX_STACK_FRAME(EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__,0); + HX_STACK_FRAME(EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__, 5,0); if (mArgCount!=0) throw HX_INVALID_ARG_COUNT; if (mProc==0) hx::Throw( HX_NULL_FUNCTION_POINTER ); return ((prim_0)mProc)(); } Dynamic __run(D a) { - HX_STACK_FRAME(EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__,0); + HX_STACK_FRAME(EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__, 5, 0); if (mArgCount!=1) throw HX_INVALID_ARG_COUNT; if (mProc==0) hx::Throw( HX_NULL_FUNCTION_POINTER ); return ((prim_1)mProc)(a.GetPtr()); } Dynamic __run(D a,D b) { - HX_STACK_FRAME(EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__,0); + HX_STACK_FRAME(EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__, 5, 0); if (mArgCount!=2) throw HX_INVALID_ARG_COUNT; if (mProc==0) hx::Throw( HX_NULL_FUNCTION_POINTER ); return ((prim_2)mProc)(a.GetPtr(),b.GetPtr()); } Dynamic __run(D a,D b,D c) { - HX_STACK_FRAME(EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__,0); + HX_STACK_FRAME(EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__, 5, 0); if (mArgCount!=3) throw HX_INVALID_ARG_COUNT; if (mProc==0) hx::Throw( HX_NULL_FUNCTION_POINTER ); return ((prim_3)mProc)(a.GetPtr(),b.GetPtr(),c.GetPtr()); } Dynamic __run(D a,D b,D c,D d) { - HX_STACK_FRAME(EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__,0); + HX_STACK_FRAME(EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__, 5, 0); if (mArgCount!=4) throw HX_INVALID_ARG_COUNT; if (mProc==0) hx::Throw( HX_NULL_FUNCTION_POINTER ); return ((prim_4)mProc)(a.GetPtr(),b.GetPtr(),c.GetPtr(),d.GetPtr()); } Dynamic __run(D a,D b,D c,D d,D e) { - HX_STACK_FRAME(EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__,0); + HX_STACK_FRAME(EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__, 5, 0); if (mArgCount!=5) throw HX_INVALID_ARG_COUNT; if (mProc==0) hx::Throw( HX_NULL_FUNCTION_POINTER ); return ((prim_5)mProc)(a.GetPtr(),b.GetPtr(),c.GetPtr(),d.GetPtr(),e.GetPtr()); @@ -174,7 +174,7 @@ class ExternalPrimitive : public hx::Object Dynamic __Run(const Array &inArgs) { - HX_STACK_FRAME(EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__,0); + HX_STACK_FRAME(EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__, 5, 0); if (mArgCount!=-1 && mArgCount!=inArgs->length) throw HX_INVALID_ARG_COUNT; if (mProc==0) hx::Throw( HX_NULL_FUNCTION_POINTER ); @@ -502,7 +502,7 @@ void *__hxcpp_get_proc_address(String inLib, String full_name,bool inNdllProc,bo #endif #if defined(HX_WINRT) && defined(HXCPP_DEBUG_LINK) - gLoadDebug = true; + gLoadDebug = true; #elif defined(IPHONE) || defined(APPLETV) gLoadDebug = true; setenv("DYLD_PRINT_APIS","1",true); @@ -514,7 +514,7 @@ void *__hxcpp_get_proc_address(String inLib, String full_name,bool inNdllProc,bo if (!sgLibPathIsInit) { sgLibPathIsInit = true; - #ifndef HX_WINRT + #ifndef HX_WINRT sgLibPath.push_back("./"); #endif #ifdef HX_MACOS @@ -754,4 +754,3 @@ int __hxcpp_register_prim(const char *inName,void *inProc) proc = inProc; return 0; } - diff --git a/src/hx/cppia/Cppia.cpp b/src/hx/cppia/Cppia.cpp index c92ae61a3..46f45c015 100644 --- a/src/hx/cppia/Cppia.cpp +++ b/src/hx/cppia/Cppia.cpp @@ -260,7 +260,7 @@ struct CppiaDynamicExpr : public CppiaExpr compiler.move( inDest.offset(4), StarAddr(TempReg(),(4)) ); } break; - + default: genObject(compiler, inDest); } @@ -423,7 +423,7 @@ struct ScriptCallable : public CppiaDynamicExpr ExprType returnType; int argCount; int stackSize; - + std::vector args; std::vector hasDefault; std::vector initVals; @@ -576,7 +576,7 @@ struct ScriptCallable : public CppiaDynamicExpr } } } - + void genArgs(CppiaCompiler &compiler, CppiaExpr *inThis, Expressions &inArgs) { @@ -910,7 +910,7 @@ struct ScriptCallable : public CppiaDynamicExpr default: ctx->pushObject(0); } - + } } } @@ -958,7 +958,7 @@ struct ScriptCallable : public CppiaDynamicExpr } } - + bool pushDefault(CppiaCtx *ctx,int arg) { if (!hasDefault[arg]) @@ -1098,7 +1098,7 @@ void CppiaFunction::compile() class CppiaEnumBase : public EnumBase_obj { public: - CppiaClassInfo *classInfo; + CppiaClassInfo *classInfo; CppiaEnumBase(CppiaClassInfo *inInfo) : classInfo(inInfo) { } @@ -1117,7 +1117,7 @@ struct CppiaEnumConstructor int nameId; int typeId; }; - + std::vector args; CppiaClassInfo *classInfo; int nameId; @@ -1138,7 +1138,7 @@ struct CppiaEnumConstructor int typeId = inStream.getInt(); args.push_back( Arg(nameId,typeId) ); } - + } hx::Object *create( Array inArgs ) { @@ -1703,7 +1703,7 @@ struct CppiaClassInfo if (strcmp(f->name,"toString")) vtable.push_back( findInterfaceFunction(f->name) ); } - + } CppiaClassInfo *cls = cppia.types[inTypeId]->cppiaClass; @@ -1923,7 +1923,7 @@ struct CppiaClassInfo DBGLOG(" script member vars size = %d\n", extraData); - + for(int i=0;inameId)); @@ -1989,7 +1989,7 @@ struct CppiaClassInfo { TypeData *interface = cppia.types[id]; interfaceVTables[ interface->name.__s ] = vtable; - + CppiaClassInfo *cppiaInterface = interface->cppiaClass; if (!cppiaInterface) break; @@ -2151,7 +2151,7 @@ struct CppiaClassInfo nativeProperties.insert( var.name ); } } - + for(int i=0;ipointer; ctx->push( (hx::Object *) 0 ); // this AutoStack save(ctx,pointer); - + if (inPhase==0) { for(int i=0;i GetClassFields() { Array result = Array_obj::__new(); @@ -2530,7 +2530,7 @@ class CppiaClass : public hx::Class_obj Expressions none; return info->createInstance(CppiaCtx::getCurrent(),none,false); - } + } Dynamic ConstructArgs(hx::DynamicArray inArgs) { @@ -3241,7 +3241,7 @@ void convertResult(CppiaCompiler &compiler, const Addr &dest, ExprType destType, } compiler.move( dest, returnVal ); break; - + case etString: @@ -3263,7 +3263,7 @@ void convertResult(CppiaCompiler &compiler, const Addr &dest, ExprType destType, compiler.move32( dest,returnVal ); compiler.move( dest.offset(4),returnVal.offset(4) ); break; - + default: ; } } @@ -3354,7 +3354,7 @@ struct CallFunExpr : public CppiaExpr // AutoStack compiler.move(pointer, CtxMemberVal(offsetof(CppiaCtx,pointer) ) ); compiler.move(frame, CtxMemberVal(offsetof(CppiaCtx,frame) ) ); - + compiler.trace("gen args..."); // Push args function->genArgs(compiler,thisExpr,args); @@ -3827,7 +3827,7 @@ struct NewExpr : public CppiaDynamicExpr Array< Dynamic > argList = Array_obj::__new(n,n); for(int a=0;arunObject(ctx); - + return constructor(argList).mPtr; } else @@ -3838,7 +3838,7 @@ struct NewExpr : public CppiaDynamicExpr printf("Can't create non haxe type\n"); return 0; } - + }; template @@ -3880,7 +3880,7 @@ struct CallHaxe : public CppiaExpr { case sigInt: case sigFloat: case sigString: case sigObject: break; // Ok - case sigVoid: + case sigVoid: if (i==0) // return void ok break; // fallthough @@ -3982,7 +3982,7 @@ struct CallStatic : public CppiaExpr int classId; int fieldId; Expressions args; - + CallStatic(CppiaStream &stream) { classId = stream.getInt(); @@ -4024,7 +4024,7 @@ struct CallStatic : public CppiaExpr // TODO - optimise... if (!replace && type->name==HX_CSTRING("String") && field==HX_CSTRING("fromCharCode")) replace = new CallDynamicFunction(inModule, this, String::fromCharCode_dyn(), args ); - + //printf(" static call to %s::%s (%d)\n", type->name.__s, field.__s, type->cppiaClass!=0); if (replace) @@ -4046,7 +4046,7 @@ struct CallStatic : public CppiaExpr struct CallGetIndex : public CppiaIntExpr { CppiaExpr *thisExpr; - + CallGetIndex(CppiaExpr *inSrc, CppiaExpr *inThis) : CppiaIntExpr(inSrc) { thisExpr = inThis; @@ -4073,7 +4073,7 @@ struct CallSetField : public CppiaDynamicExpr CppiaExpr *nameExpr; CppiaExpr *valueExpr; CppiaExpr *isPropExpr; - + CallSetField(CppiaExpr *inSrc, CppiaExpr *inThis, CppiaExpr *inName, CppiaExpr *inValue, CppiaExpr *inProp) : CppiaDynamicExpr(inSrc) { @@ -4109,7 +4109,7 @@ struct CallGetField : public CppiaDynamicExpr CppiaExpr *thisExpr; CppiaExpr *nameExpr; CppiaExpr *isPropExpr; - + CallGetField(CppiaExpr *inSrc, CppiaExpr *inThis, CppiaExpr *inName, CppiaExpr *inProp) : CppiaDynamicExpr(inSrc) { thisExpr = inThis; @@ -4183,23 +4183,23 @@ struct CallMemberVTable : public CppiaExpr int runInt(CppiaCtx *ctx) { CALL_VTABLE_SETUP - return runContextConvertInt(ctx, returnType, vtable[slot]); + return runContextConvertInt(ctx, returnType, vtable[slot]); } - + Float runFloat(CppiaCtx *ctx) { CALL_VTABLE_SETUP - return runContextConvertFloat(ctx, returnType, vtable[slot]); + return runContextConvertFloat(ctx, returnType, vtable[slot]); } String runString(CppiaCtx *ctx) { CALL_VTABLE_SETUP - return runContextConvertString(ctx, returnType, vtable[slot]); + return runContextConvertString(ctx, returnType, vtable[slot]); } hx::Object *runObject(CppiaCtx *ctx) { CALL_VTABLE_SETUP - return runContextConvertObject(ctx, returnType, vtable[slot]); + return runContextConvertObject(ctx, returnType, vtable[slot]); } @@ -4250,7 +4250,7 @@ struct CallGlobal : public CppiaExpr { int fieldId; Expressions args; - + CallGlobal(CppiaStream &stream) { fieldId = stream.getInt(); @@ -4320,7 +4320,7 @@ struct FieldByName : public CppiaDynamicExpr CrementOp crement; hx::Class staticClass; - + FieldByName(CppiaExpr *inSrc, CppiaExpr *inObject, hx::Class inStaticClass, String inName, AssignOp inAssign, CrementOp inCrement, CppiaExpr *inValue) : CppiaDynamicExpr(inSrc) @@ -4417,7 +4417,7 @@ struct GetFieldByName : public CppiaDynamicExpr bool isInterface; bool isStatic; hx::Class staticClass; - + GetFieldByName(CppiaStream &stream,bool isThisObject,bool inIsStatic=false) { classId = stream.getInt(); @@ -4515,7 +4515,7 @@ struct GetFieldByName : public CppiaDynamicExpr { //if (isInterface) // instance = instance->__GetRealObject(); - + ScriptCallable **vtable = (ScriptCallable **)instance->__GetScriptVTable(); ScriptCallable *func = vtable[vtableSlot]; if (func==0) @@ -4527,7 +4527,7 @@ struct GetFieldByName : public CppiaDynamicExpr } return instance->__Field(name,HX_PROP_DYNAMIC).mPtr; } - + CppiaExpr *makeSetter(AssignOp inOp,CppiaExpr *inValue) { // delete this - remove markable? @@ -4560,7 +4560,7 @@ struct Call : public CppiaDynamicExpr { Expressions args; CppiaExpr *func; - + Call(CppiaStream &stream) { int argCount = stream.getInt(); @@ -4676,7 +4676,7 @@ struct Call : public CppiaDynamicExpr CtxMemberVal pointer(offsetof(CppiaCtx,pointer)); compiler.move(pointerSave, pointer); - + // TODO - shortcut for script->script @@ -4719,7 +4719,7 @@ struct CallMember : public CppiaExpr CppiaExpr *thisExpr; Expressions args; bool callSuperField; - + CallMember(CppiaStream &stream,MemberCallType inCall) { classId = stream.getInt(); @@ -4779,7 +4779,7 @@ struct CallMember : public CppiaExpr //printf(" linking call %s::%s\n", type->name.__s, field.__s); CppiaExpr *replace = 0; - + if (type->arrayType) { replace = createArrayBuiltin(this, type->arrayType, thisExpr, field, args); @@ -4885,7 +4885,7 @@ struct CallMember : public CppiaExpr -template +template struct MemReference : public CppiaExpr { int offset; @@ -4917,7 +4917,7 @@ struct MemReference : public CppiaExpr offset = 0; pointer = inPointer; } - + ExprType getType() { return (ExprType) ExprTypeOf::value; @@ -4929,7 +4929,7 @@ struct MemReference : public CppiaExpr object = object->link(inModule); if (REFMODE==locAbsolute) // Only for string/object? inModule.markable.push_back(this); - + return this; } @@ -5001,7 +5001,7 @@ CppiaExpr *createStaticAccess(CppiaExpr *inSrc,FieldStorage inType, void *inPtr) -template +template struct MemReferenceSetter : public CppiaExpr { int offset; @@ -5073,7 +5073,7 @@ struct MemReferenceSetter : public CppiaExpr }; -template +template CppiaExpr *MemReference::makeSetter(AssignOp op,CppiaExpr *value) { switch(op) @@ -5110,7 +5110,7 @@ CppiaExpr *MemReference::makeSetter(AssignOp op,CppiaExpr *value) -template +template struct MemReferenceCrement : public CppiaExpr { int offset; @@ -5176,7 +5176,7 @@ struct MemReferenceCrement : public CppiaExpr -template +template CppiaExpr *MemReference::makeCrement(CrementOp inOp) { switch(inOp) @@ -5204,7 +5204,7 @@ struct MemStackFloatSetter : public CppiaExpr AssignOp op; MemStackFloatSetter(const CppiaExpr *inSrc, int inOffset, AssignOp inOp, CppiaExpr *inValue) - : CppiaExpr(inSrc), offset(inOffset), op(inOp), value(inValue){ } + : CppiaExpr(inSrc), offset(inOffset), op(inOp), value(inValue){ } ExprType getType() { return etFloat; } inline Float doRun(CppiaCtx *ctx) @@ -5243,7 +5243,7 @@ struct MemStackFloatCrement : public CppiaExpr CrementOp op; MemStackFloatCrement(const CppiaExpr *inSrc, int inOffset, CrementOp inOp) - : CppiaExpr(inSrc), offset(inOffset), op(inOp) { } + : CppiaExpr(inSrc), offset(inOffset), op(inOp) { } ExprType getType() { return etFloat; } inline Float doRun(CppiaCtx *ctx) @@ -5308,7 +5308,7 @@ struct GetFieldByLinkage : public CppiaExpr int fieldId; int typeId; CppiaExpr *object; - + GetFieldByLinkage(CppiaStream &stream,bool inThisObject) { typeId = stream.getInt(); @@ -5518,6 +5518,7 @@ struct PosInfo : public CppiaExprWithValue { int fileId; int line; + int column; int classId; int methodId; @@ -5609,7 +5610,7 @@ struct ArrayDef : public CppiaDynamicExpr switch(arrayType) { case arrBool: - { + { Array result = Array_obj::__new(n,n); for(int i=0;i result = Array_obj::__new(n,n); for(int i=0;i result = Array_obj::__new(n,n); for(int i=0;i result = Array_obj::__new(n,n); for(int i=0;i result = Array_obj::__new(n,n); for(int i=0;i result = Array_obj::__new(n,n); for(int i=0;i void run(CppiaCtx *ctx,T &outValue) { @@ -6152,7 +6153,7 @@ struct TVars : public CppiaVoidExpr LinkExpressions(vars,inModule); return this; } - + void runVoid(CppiaCtx *ctx) { CppiaExpr **v = &vars[0]; @@ -6168,7 +6169,7 @@ struct ForExpr : public CppiaVoidExpr CppiaExpr *init; CppiaExpr *loop; - + ForExpr(CppiaStream &stream) { var.fromStream(stream); @@ -6219,7 +6220,7 @@ struct WhileExpr : public CppiaVoidExpr CppiaExpr *condition; CppiaExpr *loop; - + WhileExpr(CppiaStream &stream) { isWhileDo = stream.getInt(); @@ -6273,7 +6274,7 @@ struct SwitchExpr : public CppiaExpr std::vector cases; CppiaExpr *defaultCase; - + SwitchExpr(CppiaStream &stream) { caseCount = stream.getInt(); @@ -6398,7 +6399,7 @@ struct TryExpr : public CppiaVoidExpr CppiaExpr *body; std::vector catches; - + TryExpr(CppiaStream &stream) { catchCount = stream.getInt(); @@ -6938,7 +6939,7 @@ struct SpecialAdd : public CppiaExpr BCR_CHECK; return (lval + Dynamic(right->runObject(ctx))).mPtr; } - + return Dynamic(runString(ctx)).mPtr; } int runInt(CppiaCtx *ctx) @@ -6949,7 +6950,7 @@ struct SpecialAdd : public CppiaExpr BCR_CHECK; return (lval + Dynamic(right->runObject(ctx)))->__ToInt(); } - + left->runVoid(ctx); BCR_CHECK; right->runVoid(ctx); @@ -6963,7 +6964,7 @@ struct SpecialAdd : public CppiaExpr BCR_CHECK; return (lval + Dynamic(right->runObject(ctx)))->__ToDouble(); } - + left->runVoid(ctx); BCR_CHECK; right->runVoid(ctx); @@ -7153,7 +7154,7 @@ struct EnumField : public CppiaDynamicExpr #endif }; -struct CrementExpr : public CppiaExpr +struct CrementExpr : public CppiaExpr { CrementOp op; CppiaExpr *lvalue; @@ -7180,7 +7181,7 @@ struct CrementExpr : public CppiaExpr } }; -struct OpCompareBase : public CppiaBoolExpr +struct OpCompareBase : public CppiaBoolExpr { enum CompareType { compFloat, compInt, compString, compDynamic }; @@ -7226,7 +7227,7 @@ struct OpCompareBase : public CppiaBoolExpr }; template -struct OpCompare : public OpCompareBase +struct OpCompare : public OpCompareBase { COMPARE compare; @@ -7646,7 +7647,7 @@ void CppiaModule::link() { DBGLOG("Resolve registered - super\n"); HaxeNativeClass::link(); - + DBGLOG("Resolve typeIds\n"); for(int t=0;tlink(*this); @@ -7759,7 +7760,7 @@ bool LoadCppia(String inValue) { CppiaModule *cppiaPtr = new CppiaModule(); hx::Object **ptrPtr = new hx::Object*[1]; - *ptrPtr = new CppiaObject(cppiaPtr); + *ptrPtr = new CppiaObject(cppiaPtr); GCAddRoot(ptrPtr); @@ -7826,7 +7827,7 @@ bool LoadCppia(String inValue) tok = stream.getToken(); if (tok!="RESO") throw "no reso tag"; - + scriptResources[r].mName = cppia.strings[stream.getInt()]; scriptResources[r].mDataLength = stream.getInt(); } @@ -7845,7 +7846,7 @@ bool LoadCppia(String inValue) scriptResources[count].mDataLength = 0; scriptResources[count].mData = 0; scriptResources[count].mName = String(); - + RegisterResources(&scriptResources[0]); } else @@ -7984,5 +7985,3 @@ void __scriptable_load_cppia(String inCode) { hx::LoadCppia(inCode); } - - diff --git a/src/hx/cppia/Cppia.h b/src/hx/cppia/Cppia.h index 4f7df21d3..060e8ab86 100644 --- a/src/hx/cppia/Cppia.h +++ b/src/hx/cppia/Cppia.h @@ -100,6 +100,7 @@ enum VarLocation struct CppiaExpr { int line; + int column; const char *filename; const char *className; const char *functionName; @@ -323,7 +324,7 @@ struct CppiaVar Float floatVal; String stringVal; void *valPointer; - + CppiaVar(bool inIsStatic); CppiaVar(CppiaFunction *inDynamicFunction); @@ -411,7 +412,7 @@ class HaxeNativeInterface #ifdef HXCPP_STACK_LINE #define CPPIA_STACK_LINE(expr) \ - __hxcpp_set_stack_frame_line(expr->line); + __hxcpp_set_stack_frame_line(expr->line, expr->column); #else #define CPPIA_STACK_LINE(expr) #endif @@ -609,7 +610,7 @@ struct CrementPostDec inVal = Dynamic(Dynamic(inVal) + 1).mPtr; return result; } - + }; diff --git a/src/hx/cppia/CppiaStream.h b/src/hx/cppia/CppiaStream.h index 44336630f..d9993a73a 100644 --- a/src/hx/cppia/CppiaStream.h +++ b/src/hx/cppia/CppiaStream.h @@ -13,6 +13,7 @@ struct CppiaStream const char *data; const char *max; int line; + int column; int pos; CppiaStream(class CppiaModule *inModule,const char *inData, int inLen) @@ -197,5 +198,3 @@ struct CppiaStream }; } // end namespace hx - - diff --git a/src/hx/cppia/sljit_src/sljitNativeTILEGX_64.c b/src/hx/cppia/sljit_src/sljitNativeTILEGX_64.c index 1d6aa5a11..74f4a295e 100644 --- a/src/hx/cppia/sljit_src/sljitNativeTILEGX_64.c +++ b/src/hx/cppia/sljit_src/sljitNativeTILEGX_64.c @@ -120,12 +120,13 @@ SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char *sljit_get_platform_name(void) typedef sljit_uw sljit_ins; struct jit_instr { - const struct tilegx_opcode* opcode; + const struct tilegx_opcode* opcode; tilegx_pipeline pipe; unsigned long input_registers; unsigned long output_registers; int operand_value[4]; int line; + int column; }; /* Opcode Helper Macros */ @@ -896,7 +897,7 @@ static sljit_si push_jr_buffer(struct sljit_compiler *compiler, tilegx_mnemonic inst_buf[inst_buf_index].output_registers = 0; inst_buf[inst_buf_index].line = line; inst_buf_index++; - + return flush_buffer(compiler); } @@ -1811,7 +1812,7 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj else { /* Rare ocasion. */ FAIL_IF(ADD(TMP_EREG2, reg_map[src1], ZERO)); - + overflow_ra = TMP_EREG2; } } diff --git a/src/hx/gc/Immix.cpp b/src/hx/gc/Immix.cpp index 89229ac0c..0733cf631 100644 --- a/src/hx/gc/Immix.cpp +++ b/src/hx/gc/Immix.cpp @@ -377,7 +377,7 @@ union BlockData // First 2 bytes are not needed for row markers (first 2 rows are for flags) unsigned short mId; - // First 2 rows contain a byte-flag-per-row + // First 2 rows contain a byte-flag-per-row unsigned char mRowMarked[IMMIX_LINES]; // Row data as union - don't use first 2 rows unsigned char mRow[IMMIX_LINES][IMMIX_LINE_LEN]; @@ -407,7 +407,7 @@ static BlockDataStats sThreadBlockDataStats[MAX_MARK_THREADS]; #ifdef HXCPP_VISIT_ALLOCS static hx::VisitContext *sThreadVisitContext = 0; #endif - + namespace hx { void MarkerReleaseWorkerLocked(); } @@ -434,7 +434,7 @@ struct GroupInfo int free; int used; }; - + hx::QuickVec gAllocGroups; @@ -502,7 +502,7 @@ struct BlockDataInfo mUsedRows = 0; mPinned = false; ZERO_MEM(allocStart,sizeof(int)*IMMIX_LINES); - ZERO_MEM(mPtr->mRowMarked+IMMIX_HEADER_LINES, IMMIX_USEFUL_LINES); + ZERO_MEM(mPtr->mRowMarked+IMMIX_HEADER_LINES, IMMIX_USEFUL_LINES); mRanges[0].start = IMMIX_HEADER_LINES << IMMIX_LINE_BITS; mRanges[0].length = IMMIX_USEFUL_LINES << IMMIX_LINE_BITS; mMaxHoleSize = mRanges[0].length; @@ -515,7 +515,7 @@ struct BlockDataInfo void makeFull() { mUsedRows = IMMIX_USEFUL_LINES; - memset(mPtr->mRowMarked+IMMIX_HEADER_LINES, 1,IMMIX_USEFUL_LINES); + memset(mPtr->mRowMarked+IMMIX_HEADER_LINES, 1,IMMIX_USEFUL_LINES); mRanges[0].start = 0; mRanges[0].length = 0; mMaxHoleSize = mRanges[0].length; @@ -1338,7 +1338,7 @@ void MarkObjectAllocUnchecked(hx::Object *inPtr,hx::MarkContext *__inCtx) __inCtx->Trace(); } #endif - + #ifdef HXCPP_DEBUG // Recursive mark so stack stays intact.. if (gCollectTrace) @@ -1350,7 +1350,7 @@ void MarkObjectAllocUnchecked(hx::Object *inPtr,hx::MarkContext *__inCtx) // run the risk of stack overflow. Also, a parallel mark algorithm could be // done when the marking is stack based. //inPtr->__Mark(__inCtx); - + #if (HXCPP_GC_DEBUG_LEVEL>0) inPtr->__Mark(__inCtx); #else @@ -2054,7 +2054,7 @@ class GlobalAllocator if (inSize<<1 > mLargeAllocSpace) mLargeAllocSpace = inSize<<1; - unsigned int *result = inClear ? + unsigned int *result = inClear ? (unsigned int *)calloc(1,inSize + sizeof(int)*2) : (unsigned int *)malloc(inSize + sizeof(int)*2); if (!result) @@ -2098,7 +2098,7 @@ class GlobalAllocator } int rounded = (inDelta +3) & ~3; - + if (rounded<<1 > mLargeAllocSpace) mLargeAllocSpace = rounded<<1; } @@ -2492,7 +2492,7 @@ class GlobalAllocator GlobalAllocator *mAlloc; public: AdjustPointer(GlobalAllocator *inAlloc) : mAlloc(inAlloc) { } - + void visitObject(hx::Object **ioPtr) { if ( ((*(unsigned int **)ioPtr)[-1]) == IMMIX_OBJECT_HAS_MOVED ) @@ -2631,7 +2631,7 @@ class GlobalAllocator } #endif // } defined(HXCPP_VISIT_ALLOCS) - + void *GetIDObject(int inIndex) { AutoLock lock(*gSpecialObjectLock); @@ -2767,7 +2767,7 @@ class GlobalAllocator { ThreadPoolAutoLock l(sThreadPoolLock); int count = 0; - + // May be woken multiple times if sRunningThreads is set to 0 then 1 before we sleep sThreadSleeping[inId] = true; // Spurious wake? @@ -3039,7 +3039,7 @@ class GlobalAllocator sgAllocsSinceLastSpam = 0; #endif - HX_STACK_FRAME("GC", "collect", 0, "GC::collect", __FILE__, __LINE__,0) + HX_STACK_FRAME("GC", "collect", 0, "GC::collect", __FILE__, __LINE__, 5, 0) #ifdef SHOW_MEM_EVENTS int here = 0; GCLOG("=== Collect === %p\n",&here); @@ -3201,7 +3201,7 @@ class GlobalAllocator int mem = stats.rowsInUse< mLargeAllocSpace) @@ -3903,7 +3903,7 @@ void SetTopOfStack(int *inTop,bool inForce) void *InternalNew(int inSize,bool inIsObject) { //HX_STACK_FRAME("GC", "new", 0, "GC::new", "src/hx/GCInternal.cpp", __LINE__, 0) - HX_STACK_FRAME("GC", "new", 0, "GC::new", "src/hx/GCInternal.cpp", inSize, 0) + HX_STACK_FRAME("GC", "new", 0, "GC::new", "src/hx/GCInternal.cpp", inSize, 5, 0) #ifdef HXCPP_DEBUG if (sgSpamCollects && sgAllocsSinceLastSpam>=sgSpamCollects) @@ -3971,7 +3971,7 @@ void *InternalRealloc(void *inData,int inSize) if (inData==0) return hx::InternalNew(inSize,false); - HX_STACK_FRAME("GC", "realloc", 0, "GC::relloc", __FILE__ , __LINE__, 0) + HX_STACK_FRAME("GC", "realloc", 0, "GC::relloc", __FILE__ , __LINE__, 5, 0) #ifdef HXCPP_DEBUG if (sgSpamCollects && sgAllocsSinceLastSpam>=sgSpamCollects) @@ -4190,4 +4190,3 @@ unsigned int __hxcpp_obj_hash(Dynamic inObj) void DummyFunction(void *inPtr) { } -