Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
429dff2
Converted StringList to StringArray
tanis2000 Jan 31, 2016
1f6ea64
Converted the ClassList to an array
tanis2000 Mar 29, 2016
20fb67a
Bumped version and protocol number. Updated changelog
tanis2000 Mar 29, 2016
540b472
Bumped client/server identification string
tanis2000 Apr 7, 2016
a54fad4
Make sure the socket is closed if we hit a connection problem (client)
tanis2000 Apr 11, 2016
baf1aeb
Notify the server about clients connecting with a mismatched protocol…
tanis2000 Apr 11, 2016
d0cd490
Rethrow the exception in HaxeServer's constructor in case it's needed…
tanis2000 Apr 29, 2016
fe2b1d9
Switched the list of classes to an array of enums instead of an array…
tanis2000 Apr 29, 2016
af09837
Merge pull request #10 from tanis2000/feature/stringarray
bjitivo May 19, 2016
9633f94
Changed default host to 0.0.0.0
romamik Jun 25, 2016
f26e50f
Changed CommandLineController to IController in HaxeServer, so that i…
romamik Jun 25, 2016
795bbf7
Print field name for TObject fields
romamik Jun 25, 2016
df62116
HXML file to run server
Jun 27, 2016
3b21a9f
1. Fixed printing classes: for some reason Std.is(value, Class) was r…
Jun 27, 2016
3660bae
fixed broken print of Anonymous objects
romamik Jun 27, 2016
8255c2a
Removed forgotten traces
romamik Jun 27, 2016
290f30c
Merge pull request #12 from romamik/master
bjitivo Sep 27, 2016
4f8571c
Fixed some whitespace in code formatting.
bji Sep 27, 2016
ee1643e
[TravisCI] rebuild hxcpp when testing for haxe dev
andyli Jul 3, 2017
8481406
[CI] test against Haxe 3.4.2
andyli Jul 3, 2017
52dc64e
Update DebuggerThread.hx
imcasper Nov 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,31 @@ language: haxe

haxe:
- development
- 3.4.2
- 3.2.1

os:
- linux
- osx

sudo: false
addons:
apt:
packages:
# C++ (for rebuilding hxcpp)
- gcc-multilib
- g++-multilib

install:
- haxelib install hxcpp
- if [ "${TRAVIS_HAXE_VERSION}" = "development" ]; then
haxelib git hxcpp https://github.com/HaxeFoundation/hxcpp.git;
pushd $(haxelib path hxcpp | head -1);
pushd tools/hxcpp; haxe compile.hxml; popd;
pushd project; neko build.n; popd;
popd;
else
haxelib install hxcpp;
fi
- haxelib dev hxcpp-debugger .
- haxelib list

Expand Down
6 changes: 6 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
1.2.0
---------------
* Switched to using arrays instead of lists for files, classes and variables. Lists have a problem when they grow too big and they become unusable.
* Bumped protocol version to 0.1.0.

1.1.0
---------------
* Change haxelib.json license to MIT, which is in the same spirit as Apache from source code.

1.0
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ environment:

install:
# Install the haxe chocolatey package (https://chocolatey.org/packages/haxe)
- cinst haxe -version 3.2.1 -y
- cinst haxe -version 3.4.2 -y
- RefreshEnv
# Setup haxelib
- mkdir "%HAXELIB_ROOT%"
Expand Down
36 changes: 13 additions & 23 deletions debugger/CommandLineController.hx
Original file line number Diff line number Diff line change
Expand Up @@ -857,37 +857,27 @@ class CommandLineController implements IController

// Utility functions and helpers -----------------------------------------

private static function printStringList(list : StringList, sep : String)
private static function printStringList(list : StringArray, sep : String)
{
var need_sep = false;

while (true) {
switch (list) {
case Terminator:
break;
case Element(string, next):
if (need_sep) {
Sys.print(sep);
}
else {
need_sep = true;
}
Sys.print(string);
list = next;
for(string in list) {
if (need_sep) {
Sys.print(sep);
}
else {
need_sep = true;
}
Sys.print(string);
}
}

private static function printUnresolvableClasses(
unresolvableClasses : StringList)
{
switch (unresolvableClasses) {
case Terminator:
case Element(string, next):
Sys.print("Unresolvable classes: ");
printStringList(unresolvableClasses, ", ");
Sys.println(".");
}
unresolvableClasses : StringArray)
{
Sys.print("Unresolvable classes: ");
printStringList(unresolvableClasses, ", ");
Sys.println(".");
}

private static function findEndQuote(str : String, index : Int) : Int
Expand Down
97 changes: 53 additions & 44 deletions debugger/DebuggerThread.hx
Original file line number Diff line number Diff line change
Expand Up @@ -314,42 +314,30 @@ class DebuggerThread
mController.acceptMessage(message);
}

private function filesToList(files:Array<String>) : StringList
{
var list : StringList = Terminator;

// Preserve order
for (f in 0...files.length) {
list = Element(files[files.length-1-f], list);
}

return list;
}

private function files() : Message
{
// Preserve order to match filesFullPath
return Files( filesToList( Debugger.getFiles() ) );
return Files( Debugger.getFiles() );
}

private function filesFullPath() : Message
{
return Files( filesToList( Debugger.getFilesFullPath() ) );
return Files( Debugger.getFilesFullPath() );
}

private function allClasses() : Message
{
var classes = Debugger.getClasses();

var list : StringList = Terminator;
var list : StringArray = new StringArray();

// Sort the classes in reverse so that the list can be created easily
classes.sort(function (a : String, b : String) {
return Reflect.compare(b, a);
});

for (f in classes) {
list = Element(f, list);
list.push(f);
}

return AllClasses(list);
Expand Down Expand Up @@ -389,13 +377,15 @@ class DebuggerThread
return Reflect.compare(b, a);
});

var list : ClassList = ((continuation == null) ?
Terminator : Continued(continuation));
var ca = new Array<ClassEnum>();

for (f in classes_to_use) {
list = Element(f, hasStaticValue(f), list);
var ce : ClassEnum = ClassFunction(f, hasStaticValue(f));
ca.push(ce);
}

var list : ClassList = ClassFunction(ca, continuation);

return Classes(list);
}

Expand Down Expand Up @@ -524,10 +514,10 @@ class DebuggerThread
var breakpoint = mBreakpointsByDescription.get(desc);
breakpoint.enable();
return ClassFunctionBreakpointNumber
(breakpoint.number, Terminator);
(breakpoint.number, null);
}

var badClasses : StringList = Terminator;
var badClasses : StringArray = new StringArray();

var classNames = Debugger.getClasses();
for (cn in classNames) {
Expand All @@ -553,7 +543,7 @@ class DebuggerThread
}
var klass = Type.resolveClass(cn);
if (klass == null) {
badClasses = Element(cn, badClasses);
badClasses.push(cn);
}
else {
this.breakFunction(desc, cn, klass, functionName,
Expand Down Expand Up @@ -996,15 +986,15 @@ class DebuggerThread

mStateMutex.release();

var list : StringList = Terminator;
var list : StringArray = new StringArray();

// Sort the variables in reverse so that the list can be created easily
variables.sort(function (a : String, b : String) {
return Reflect.compare(b, a);
});

for (f in variables) {
list = Element(f, list);
list.push(f);
}

return Variables(list);
Expand Down Expand Up @@ -1232,6 +1222,8 @@ class DebuggerThread

private class TypeHelpers
{
private static inline var MAX_RECORD_AMOUNT = 100;

public static function getValueTypeName(value : Dynamic) : String
{
switch (Type.typeof(value)) {
Expand Down Expand Up @@ -1272,8 +1264,9 @@ private class TypeHelpers
return "INVALID";
}

public static function getValueString(value : Dynamic, indent : String = "",
ellipseForObjects : Bool = false) : String
public static function getValueString
(value : Dynamic, indent : String = "",
ellipseForObjects : Bool = false) : String
{
switch (Type.typeof(value)) {
case TUnknown:
Expand All @@ -1285,22 +1278,27 @@ private class TypeHelpers
case TFunction:
return Std.string(value);
case TObject:
if (Std.is(value, Class)) {
var klass = null;
try {
klass = cast(value, Class<Dynamic>);
} catch (e:Dynamic) {
}
if (klass != null) {
return ("Class<" + Std.string(value) + ">" +
getClassValueString(value, indent));
getClassValueString(klass, indent));
}
if (ellipseForObjects) {
return "...";
}
var ret = "{\n";
for (f in Reflect.fields(value)) {
ret += indent;
ret += f + ' : ';
ret += getValueString(Reflect.field(value, f), indent + " ",
ellipseForObjects);
ret += "\n";
}
return ret + indent + "}";

case TClass(Array):
var arr : Array<Dynamic> = cast value;
if (arr.length == 0) {
Expand Down Expand Up @@ -1329,11 +1327,11 @@ private class TypeHelpers
if (ellipseForObjects) {
return "...";
}
var klass = Type.getClass(value);
var klass:Class<Dynamic> = Type.getClass(value);
if (klass == null) {
return "???";
}
return getInstanceValueString(Type.getClass(value), value, indent);
return getInstanceValueString(klass, value, indent);
}

return Std.string(value);
Expand Down Expand Up @@ -1382,32 +1380,36 @@ private class TypeHelpers

for (f in fields) {
var fieldValue = Reflect.getProperty(value, f);

ret += (indent + " " + f + " : " +
getValueTypeName(fieldValue) + " = " +
getValueString(fieldValue, indent + " ", true) + "\n");
}

fields = new Array<String>();

// Although the instance fields returned by Type seem to include super
// class variables also, class variables do not, so iterate through
// super classes manually
while (klass != null) {
fields = new Array<String>();

for (f in Type.getClassFields(klass)) {
if (Reflect.isFunction(Reflect.field(value, f))) {
if (Reflect.isFunction(Reflect.field(klass, f))) {
continue;
}
fields.push(f);
}

for (f in fields) {
var fieldValue = Reflect.getProperty(klass, f);
ret += (indent + " " + f + " : static " +
getValueTypeName(fieldValue) + " = " +
getValueString(fieldValue, indent + " ", true) +
"\n");
}

klass = Type.getSuperClass(klass);
}

for (f in fields) {
var fieldValue = Reflect.getProperty(value, f);
ret += (indent + " " + f + " : static " +
getValueTypeName(fieldValue) + " = " +
getValueString(fieldValue, indent + " ", true) + "\n");
}

return ret + indent + "}";
}
Expand Down Expand Up @@ -1475,7 +1477,8 @@ private class TypeHelpers
return className;
}

private static function getClassFieldNames(value : Dynamic, klass : Class<Dynamic>)
private static function getClassFieldNames(value : Dynamic,
klass : Class<Dynamic>)
: Array<String>
{
// We walk the class hierarchy to find all statics.
Expand Down Expand Up @@ -1519,8 +1522,9 @@ private class TypeHelpers
var property : Dynamic = Reflect.getProperty(klass, f);
if (null == property) {
// Variable was inlined.
fieldValue = Single(getStructuredValueType(null),
Std.string("No instances (inlined)"));
fieldValue = Single
(getStructuredValueType(null),
Std.string("No instances (inlined)"));
}
else {
fieldValue = getStructuredValue(property, true,
Expand Down Expand Up @@ -1555,6 +1559,11 @@ private class TypeHelpers
var subexp = expression + "[" + i + "]";
list = Element(Std.string(i),
getStructuredValue(val, true, subexp), list);
// Skip items if too many
if (i > MAX_RECORD_AMOUNT) {
list = Element("...", Single(TypeNull, "..."), list);
i = MAX_RECORD_AMOUNT;
}
i -= 1;
}
}
Expand Down Expand Up @@ -2871,4 +2880,4 @@ private class DebugTimer {
private var mLogLevel : Int;
private var mStartTime : Float;
private var mMessage: Dynamic;
}
}
4 changes: 2 additions & 2 deletions debugger/HaxeProtocol.hx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class HaxeProtocol
}

private static var gClientIdentification =
"Haxe debug client v1.1 coming at you!\n\n";
"Haxe debug client v1.2 coming at you!\n\n";
private static var gServerIdentification =
"Haxe debug server v1.1 ready and willing, sir!\n\n";
"Haxe debug server v1.2 ready and willing, sir!\n\n";
}
1 change: 1 addition & 0 deletions debugger/HaxeRemote.hx
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ class HaxeRemote implements IController
LogDebuggerMessage("Failed to connect to debugging server at " +
mHost + ":" + mPort + " : " + e);
}
closeSocket();
LogDebuggerMessage("Trying again in 3 seconds.");
Sys.sleep(3);
}
Expand Down
Loading