Fixed an issue where Debugger is not getting started if arguments loaded from SQLite database. Fixes #6132

This commit is contained in:
Nikhil Mohite 2022-06-22 11:16:50 +05:30 committed by Akshay Joshi
parent e8f0454b39
commit 41ceda01d0
2 changed files with 181 additions and 169 deletions

View File

@ -1836,6 +1836,9 @@ def set_arguments_sqlite(sid, did, scid, func_id):
# handle the Array list sent from the client # handle the Array list sent from the client
array_string = '' array_string = ''
if 'value' in data[i]:
array_string = data[i]['value']
if 'is_array_value' in data[i] and 'value' in data[i] and data[i][ if 'is_array_value' in data[i] and 'value' in data[i] and data[i][
'is_array_value']: 'is_array_value']:
array_string = get_array_string(data, i) array_string = get_array_string(data, i)

View File

@ -143,7 +143,7 @@ export default function DebuggerArgumentComponent({ debuggerInfo, restartDebug,
let funcArgsData = []; let funcArgsData = [];
if (res.data.data.args_count != 0) { if (res.data.data.args_count != 0) {
setIsDisableDebug(false); setIsDisableDebug(false);
for(const i of res.data.data.result) { for (const i of res.data.data.result) {
// Below will format the data to be stored in sqlite database // Below will format the data to be stored in sqlite database
funcArgsData.push({ funcArgsData.push({
'arg_id': i['arg_id'], 'arg_id': i['arg_id'],
@ -246,9 +246,9 @@ export default function DebuggerArgumentComponent({ debuggerInfo, restartDebug,
return myObj; return myObj;
} }
function setFuncObj(funcArgsData, argMode, argType, argName, defValList, isUnnamedParam=false) { function setFuncObj(funcArgsData, argMode, argType, argName, defValList, isUnnamedParam = false) {
let index, values, funcObj=[]; let index, values, funcObj = [];
for(const argData of funcArgsData) { for (const argData of funcArgsData) {
index = argData['arg_id']; index = argData['arg_id'];
if (debuggerInfo['proargmodes'] != null && if (debuggerInfo['proargmodes'] != null &&
(argMode && argMode[index] == 'o' && !isEdbProc) && !isUnnamedParam) { (argMode && argMode[index] == 'o' && !isEdbProc) && !isUnnamedParam) {
@ -278,7 +278,7 @@ export default function DebuggerArgumentComponent({ debuggerInfo, restartDebug,
} }
function setUnnamedParamNonDefVal(argType, defValList, myargname) { function setUnnamedParamNonDefVal(argType, defValList, myargname) {
let myObj= []; let myObj = [];
for (let i = 0; i < argType.length; i++) { for (let i = 0; i < argType.length; i++) {
myObj.push({ myObj.push({
'name': myargname[i], 'name': myargname[i],
@ -508,13 +508,15 @@ export default function DebuggerArgumentComponent({ debuggerInfo, restartDebug,
}); });
// Update values if any change in the args. // Update values if any change in the args.
if (debuggerFinalArgs.current) {
debuggerFinalArgs.current.changed.forEach(changedArg => { debuggerFinalArgs.current.changed.forEach(changedArg => {
argsList.forEach((el, _index) => { argsList.forEach((el, _index) => {
if(changedArg.name == el.name) { if (changedArg.name == el.name) {
argsList[_index] = changedArg; argsList[_index] = changedArg;
} }
}); });
}); });
}
} }
} }
@ -692,10 +694,11 @@ export default function DebuggerArgumentComponent({ debuggerInfo, restartDebug,
function startDebugging() { function startDebugging() {
var self = this; var self = this;
setLoaderText('Starting debugger.'); setLoaderText('Starting debugger.');
try {
/* Initialize the target once the debug button is clicked and create asynchronous connection /* Initialize the target once the debug button is clicked and create asynchronous connection
and unique transaction ID If the debugging is started again then treeInfo is already stored. */ and unique transaction ID If the debugging is started again then treeInfo is already stored. */
var [treeInfo, d] = getSelectedNodeData(); var [treeInfo, d] = getSelectedNodeData();
if(!d) return; if (!d) return;
var argsValueList = []; var argsValueList = [];
var sqliteFuncArgsList = []; var sqliteFuncArgsList = [];
@ -857,7 +860,13 @@ export default function DebuggerArgumentComponent({ debuggerInfo, restartDebug,
); );
}); });
} }
} catch (err) {
setLoaderText('');
Notify.alert(
gettext('Debugger Error'),
gettext(err.message)
);
}
} }
@ -878,20 +887,20 @@ export default function DebuggerArgumentComponent({ debuggerInfo, restartDebug,
onDataChange={(isChanged, changedData) => { onDataChange={(isChanged, changedData) => {
let isValid = false; let isValid = false;
let skipStep = false; let skipStep = false;
if('_sessData' in debuggerArgsSchema.current) { if ('_sessData' in debuggerArgsSchema.current) {
isValid = true; isValid = true;
debuggerArgsSchema.current._sessData.aregsCollection.forEach((data)=> { debuggerArgsSchema.current._sessData.aregsCollection.forEach((data) => {
if(skipStep) {return;} if (skipStep) { return; }
if((data.is_null || data.use_default || data?.value?.toString()?.length > 0) && isValid) { if ((data.is_null || data.use_default || data?.value?.toString()?.length > 0) && isValid) {
isValid = true; isValid = true;
} else { } else {
isValid = false; isValid = false;
skipStep = true; skipStep = true;
} }
if(!data.isValid) { if (!data.isValid) {
isValid = false; isValid = false;
skipStep = true; skipStep = true;
} }