Sunday, October 1, 2023
HomeiOS Developmentios - Putting in breakpoint in Python through the CPython API by...

ios – Putting in breakpoint in Python through the CPython API by line quantity with out altering the handed code


I am creating a Python IDE for iOS, and any IDE has a Debug, so I have to implement it. Studying varied sources, I discovered that Python has a breakpoint() perform, nevertheless it must be embedded within the code that will likely be handed for execution, subsequently I have to personally obtain the code from every file and put down the breakpoint. This isn’t very handy for me. The one factor I got here up with is an infinite (till urgent the IDE “proceed” button) whereas. Is there a extra, if I’ll say, extra stunning answer to this downside?

P.S:

static int trace_function(PyObject *obj, PyFrameObject *body, int occasion, PyObject *arg) {
// Проверяем событие, если это событие линии
if (occasion == PyTrace_LINE) {
    // Получаем текущий номер строки
    
    int current_line = PyFrame_GetLineNumber(body);
    printf("Presently at line: %dn", current_line);
    
    if (current_line == 2) {
        printf("Breakpoint at line: %dn", current_line);
        whereas (1) {
            
        }
    }
}
return 0;
}

this perform is handed to the Python execution monitoring system. For instance, the whereas loop is just infinite.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments