// Varobj
HRESULT ListVariables(ICorDebugFrame *pFrame, std::string &output);
HRESULT CreateVar(ICorDebugFrame *pFrame, const std::string &varobjName, const std::string &expression, std::string &output);
-HRESULT ListChildren(const std::string &name, ICorDebugFrame *pFrame, std::string &output);
+HRESULT ListChildren(const std::string &name, int print_values, ICorDebugFrame *pFrame, std::string &output);
HRESULT DeleteVar(const std::string &varobjName);
// TypePrinter
}
else if (command == "var-list-children")
{
- if (args.size() < 1)
+ int print_values = 0;
+ int var_index = 0;
+ if (!args.empty())
+ {
+ if (args.at(0) == "1" || args.at(0) == "--all-values")
+ {
+ print_values = 1;
+ var_index++;
+ }
+ else if (args.at(0) == "2" || args.at(0) == "--simple-values")
+ {
+ print_values = 2;
+ var_index++;
+ }
+ }
+
+ if (args.size() < (var_index + 1))
{
out_printf("%s^error,msg=\"%s requires an argument\"\n", token.c_str(), command.c_str());
} else {
ToRelease<ICorDebugFrame> pFrame;
hr = g_currentThread ? g_currentThread->GetActiveFrame(&pFrame) : E_FAIL;
if (SUCCEEDED(hr))
- hr = ListChildren(args.at(0), pFrame, output);
+ hr = ListChildren(args.at(var_index), print_values, pFrame, output);
}
if (SUCCEEDED(hr))
{
}
}
-void PrintChildren(std::vector<VarObjValue> &members, std::string &output)
+void PrintChildren(std::vector<VarObjValue> &members, int print_values, ICorDebugILFrame *pILFrame, std::string &output)
{
std::stringstream ss;
ss << "numchild=\"" << members.size() << "\"";
ss << sep;
sep = ",";
- ss << "child={name=\"" << m.varobjName << "\",exp=\"" << m.name << "\",";
+ ss << "child={name=\"" << m.varobjName << "\",";
+ if (print_values)
+ {
+ std::string strVal;
+ if (m.value)
+ PrintValue(m.value, pILFrame, strVal);
+ ss << "value=\"" << strVal << "\",";
+ }
+ ss << "exp=\"" << m.name << "\",";
ss << "numchild=\"" << m.numchild << "\",type=\"" << m.typeName << "\"}";
//thread-id="452958",has_more="0"}
}
return varName;
}
-HRESULT ListChildren(VarObjValue &objValue, ICorDebugFrame *pFrame, std::string &output)
+HRESULT ListChildren(VarObjValue &objValue, int print_values, ICorDebugFrame *pFrame, std::string &output)
{
HRESULT Status;
InsertVar(m);
}
- PrintChildren(members, output);
+ PrintChildren(members, print_values, pILFrame, output);
return S_OK;
}
-HRESULT ListChildren(const std::string &name, ICorDebugFrame *pFrame, std::string &output)
+HRESULT ListChildren(const std::string &name, int print_values, ICorDebugFrame *pFrame, std::string &output)
{
auto it = g_vars.find(name);
if (it == g_vars.end())
return E_FAIL;
- return ListChildren(it->second, pFrame, output);
+ return ListChildren(it->second, print_values, pFrame, output);
}
HRESULT ListVariables(ICorDebugFrame *pFrame, std::string &output)