Fixed an issue where adding breakpoints caused errors, and stepping out of a nested function removed breakpoints from the parent function. #8982
parent
86c2769221
commit
2dd27d20c1
|
|
@ -1464,7 +1464,13 @@ def set_clear_breakpoint(trans_id, line_no, set_type):
|
|||
# For multilevel function debugging, we need to fetch current selected
|
||||
# frame's function oid for setting the breakpoint. For single function
|
||||
# the frame id will be 0.
|
||||
foid = res_stack['rows'][de_inst.debugger_data['frame_id']]['func']
|
||||
frame_id = de_inst.debugger_data['frame_id']
|
||||
rows = res_stack.get('rows', [])
|
||||
if not rows or frame_id < 0 or frame_id >= len(rows):
|
||||
return make_json_response(
|
||||
data={'status': False, 'result': 'Empty stack info.'}
|
||||
)
|
||||
foid = rows[frame_id]['func']
|
||||
|
||||
# Check the result of the stack before setting the breakpoint
|
||||
if conn.connected():
|
||||
|
|
|
|||
|
|
@ -82,6 +82,19 @@ export default function DebuggerComponent({ pgAdmin, selectedNodeInfo, panelId,
|
|||
return httpStatus.data.data.status === 'Busy';
|
||||
};
|
||||
|
||||
// Function to set breakpoints in the editor given a list of line numbers
|
||||
const applyBreakpointsToEditor = (breakpoints) => {
|
||||
if (!editor.current) return;
|
||||
editor.current.clearBreakpoints();
|
||||
if (Array.isArray(breakpoints)) {
|
||||
breakpoints.forEach(breakVal => {
|
||||
if (breakVal && breakVal !== -1) {
|
||||
editor.current.toggleBreakpoint(breakVal, true, true); // silent, set to true
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Function to get the breakpoint information from the server
|
||||
const getBreakpointInformation = (transId, callBackFunc) => {
|
||||
let result = '';
|
||||
|
|
@ -109,13 +122,13 @@ export default function DebuggerComponent({ pgAdmin, selectedNodeInfo, panelId,
|
|||
};
|
||||
|
||||
const clearAllBreakpoint = (transId) => {
|
||||
let clearBreakpoint = (br_list) => {
|
||||
let clearBreakpoint = (brList) => {
|
||||
// If there is no break point to clear then we should return from here.
|
||||
if ((br_list.length == 1) && (br_list[0].linenumber == -1))
|
||||
if ((brList.length == 1) && (brList[0].linenumber == -1))
|
||||
return;
|
||||
|
||||
disableToolbarButtons();
|
||||
let breakpoint_list = getBreakpointList(br_list);
|
||||
let breakpointList = getBreakpointList(brList);
|
||||
|
||||
// Make ajax call to listen the database message
|
||||
let baseUrl = url_for('debugger.clear_all_breakpoint', {
|
||||
|
|
@ -126,7 +139,7 @@ export default function DebuggerComponent({ pgAdmin, selectedNodeInfo, panelId,
|
|||
url: baseUrl,
|
||||
method: 'POST',
|
||||
data: {
|
||||
'breakpoint_list': breakpoint_list.length > 0 ? breakpoint_list.join() : null,
|
||||
'breakpoint_list': breakpointList.length > 0 ? breakpointList.join() : null,
|
||||
},
|
||||
})
|
||||
.then(function (res) {
|
||||
|
|
@ -373,13 +386,13 @@ export default function DebuggerComponent({ pgAdmin, selectedNodeInfo, panelId,
|
|||
}, []);
|
||||
|
||||
const triggerClearBreakpoint = () => {
|
||||
let clearBreakpoint = (br_list) => {
|
||||
let clearBreakpoint = (brList) => {
|
||||
// If there is no break point to clear then we should return from here.
|
||||
if ((br_list.length == 1) && (br_list[0].linenumber == -1))
|
||||
if ((brList.length == 1) && (brList[0].linenumber == -1))
|
||||
return;
|
||||
|
||||
disableToolbarButtons();
|
||||
let breakpoint_list = getBreakpointList(br_list);
|
||||
let breakpointList = getBreakpointList(brList);
|
||||
|
||||
// Make ajax call to listen the database message
|
||||
let _baseUrl = url_for('debugger.clear_all_breakpoint', {
|
||||
|
|
@ -390,7 +403,7 @@ export default function DebuggerComponent({ pgAdmin, selectedNodeInfo, panelId,
|
|||
url: _baseUrl,
|
||||
method: 'POST',
|
||||
data: {
|
||||
'breakpoint_list': breakpoint_list.join(),
|
||||
'breakpoint_list': breakpointList.join(),
|
||||
},
|
||||
})
|
||||
.then(function () {
|
||||
|
|
@ -752,20 +765,26 @@ export default function DebuggerComponent({ pgAdmin, selectedNodeInfo, panelId,
|
|||
|
||||
};
|
||||
|
||||
const getBreakpointList = (br_list) => {
|
||||
let breakpoint_list = [];
|
||||
for (let val of br_list) {
|
||||
const getBreakpointList = (brList) => {
|
||||
let breakpointList = [];
|
||||
for (let val of brList) {
|
||||
if (val.linenumber != -1) {
|
||||
breakpoint_list.push(val.linenumber);
|
||||
breakpointList.push(val.linenumber);
|
||||
}
|
||||
}
|
||||
|
||||
return breakpoint_list;
|
||||
return breakpointList;
|
||||
};
|
||||
|
||||
// Function to get the latest breakpoint information
|
||||
const updateBreakpoint = (transId, updateLocalVar = false) => {
|
||||
let callBackFunc = () => {
|
||||
const callBackFunc = (brList) => {
|
||||
if ((brList.length == 1) && (brList[0].linenumber == -1))
|
||||
return;
|
||||
|
||||
const breakpointList = getBreakpointList(brList);
|
||||
// Apply all breakpoints to the editor
|
||||
applyBreakpointsToEditor(breakpointList);
|
||||
if (updateLocalVar) {
|
||||
// Call function to create and update local variables ....
|
||||
getLocalVariables(params.transId);
|
||||
|
|
|
|||
Loading…
Reference in New Issue