Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwang committed Dec 18, 2019
2 parents bb19e41 + 6718777 commit 749a2fa
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions Debugger/LuaPanda.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2042,7 +2042,7 @@ function this.createWatchedVariableInfo(variableName, variableIns)
xpcall(function() var.value = tostring(variableIns) end , function() var.value = tostring(type(variableIns)) .. " [value can't trans to string]" end );
var.variablesReference = "0"; --这个地方必须用“0”, 以免variableRefTab[0]出错

if var.type == "table" or var.type == "function" then
if var.type == "table" or var.type == "function" or var.type == "userdata" then
var.variablesReference = variableRefIdx;
variableRefTab[variableRefIdx] = variableIns;
variableRefIdx = variableRefIdx + 1;
Expand Down Expand Up @@ -2296,7 +2296,7 @@ function this.getVariableRef( refStr )
var.type = tostring(type(v));
xpcall(function() var.value = tostring(v) end , function() var.value = tostring(type(v)) .. " [value can't trans to string]" end );
var.variablesReference = "0";
if var.type == "table" or var.type == "function" then
if var.type == "table" or var.type == "function" or var.type == "userdata" then
var.variablesReference = variableRefIdx;
variableRefTab[variableRefIdx] = v;
variableRefIdx = variableRefIdx + 1;
Expand Down Expand Up @@ -2336,6 +2336,28 @@ function this.getVariableRef( refStr )
variableRefTab[variableRefIdx] = udMtTable;
variableRefIdx = variableRefIdx + 1;
table.insert(varTab, var);

if udMtTable.__pairs ~= nil and type(udMtTable.__pairs) == "function" then
for n,v in pairs(variableRefTab[varRef]) do
local var = {};
var.name = tostring(n);
var.type = tostring(type(v));
xpcall(function() var.value = tostring(v) end , function() var.value = tostring(type(v)) .. " [value can't trans to string]" end );
var.variablesReference = "0";
if var.type == "table" or var.type == "function" or var.type == "userdata" then
var.variablesReference = variableRefIdx;
variableRefTab[variableRefIdx] = v;
variableRefIdx = variableRefIdx + 1;
if var.type == "table" then
local memberNum = this.getTableMemberNum(v);
var.value = memberNum .." Members ".. ( var.value or '' );
end
elseif var.type == "string" then
var.value = '"' ..v.. '"';
end
table.insert(varTab, var);
end
end
end
end
return varTab;
Expand All @@ -2352,7 +2374,7 @@ function this.getGlobalVariable( ... )
var.type = tostring(type(v));
xpcall(function() var.value = tostring(v) end , function() var.value = tostring(type(v)) .." [value can't trans to string]" end );
var.variablesReference = "0";
if var.type == "table" or var.type == "function" then
if var.type == "table" or var.type == "function" or var.type == "userdata" then
var.variablesReference = variableRefIdx;
variableRefTab[variableRefIdx] = v;
variableRefIdx = variableRefIdx + 1;
Expand Down Expand Up @@ -2395,7 +2417,7 @@ function this.getUpValueVariable( checkFunc , isFormatVariable)

if isGetValue == false then
xpcall(function() var.value = tostring(v) end , function() var.value = tostring(type(v)) .. " [value can't trans to string]" end );
if var.type == "table" or var.type == "function" then
if var.type == "table" or var.type == "function" or var.type == "userdata" then
var.variablesReference = variableRefIdx;
variableRefTab[variableRefIdx] = v;
variableRefIdx = variableRefIdx + 1;
Expand Down Expand Up @@ -2457,7 +2479,7 @@ function this.getVariable( checkLayer, isFormatVariable , offset)

if isGetValue == false then
xpcall(function() var.value = tostring(v) end , function() var.value = tostring(type(v)) .. " [value can't trans to string]" end );
if var.type == "table" or var.type == "function" then
if var.type == "table" or var.type == "function" or var.type == "userdata" then
var.variablesReference = variableRefIdx;
variableRefTab[variableRefIdx] = v;
variableRefIdx = variableRefIdx + 1;
Expand Down Expand Up @@ -2530,7 +2552,7 @@ function this.processExp(msgTable)
var.type = tostring(type(retString));
xpcall(function() var.value = tostring(retString) end , function(e) var.value = tostring(type(retString)) .. " [value can't trans to string] ".. e; var.isSuccess = false; end);
var.variablesReference = "0";
if var.type == "table" or var.type == "function" then
if var.type == "table" or var.type == "function" or var.type == "userdata" then
variableRefTab[variableRefIdx] = retString;
var.variablesReference = variableRefIdx;
variableRefIdx = variableRefIdx + 1;
Expand Down Expand Up @@ -2575,7 +2597,7 @@ function this.processWatchedExp(msgTable)
xpcall(function() var.value = tostring(retString) end , function() var.value = tostring(type(retString)) .. " [value can't trans to string]"; var.isSuccess = "false"; end );
var.variablesReference = "0";

if var.type == "table" or var.type == "function" then
if var.type == "table" or var.type == "function" or var.type == "userdata" then
variableRefTab[variableRefIdx] = retString;
var.variablesReference = variableRefIdx;
variableRefIdx = variableRefIdx + 1;
Expand Down

0 comments on commit 749a2fa

Please sign in to comment.