Posts

Showing posts with the label debugging

Reading a .txt file in C++ [on hold]

Reading a .txt file in C++ [on hold] So im trying to write a program in C++ that takes input line by line from a text file and give it as and output but im running into errors that I cant find very good answers to. Thanks in advance for the help Code is: 1 #include "stdafx.h" 2 #include <iostream> 3 #include <fstream> 4 #include <string> 5 using namespace std; 6 int main() 7 { 8 string line; 9 ifstream file("INPUT.txt"); 10 if (file.is_open()) 11 { 12 while(getline(file,line) 13 { 14 cout << line << 'n' 15 } 16 file.close(); 17 18 } 19 else 20 { 21 cout << "file is not open" << 'n'; 22 } 23 24 return 0; 25 } The errors from the compiler read: line(15): error C2064: term does not evaluate to a fun...

Infinite loop in unexpected place

Infinite loop in unexpected place I try to create a function, that delete chosen string is a text file. But in lines 56-64 I get an infinite loop - whereas file.txt contains only 8 strings, not eternity) int delNStr(int N, string way) { ifstream log(way, ios_base::in); ofstream temp("C:TempLoadLogger.txt", ios_base::trunc | ios_base::app); int num = 0; while (!log.eof()) { if (num != N) { string currier; getline(log, currier); temp << currier; }; } log.close(); temp.close(); ofstream log2(way, ios_base::trunc | ios_base::app); ifstream temp2("C:TempLoadLogger.txt", ios_base::in); while (!temp2.eof()) { string currier; getline(temp2, currier); log2 << currier; } log2.close(); temp2.close(); delete ("C:TempLoadLogger.txt"); return...

Is there a limit to the Delphi Win64 debugger loading symbols?

Image
Is there a limit to the Delphi Win64 debugger loading symbols? I'm using RAD Studio 10.2.3 Tokyo. Research Related to this question, and this issue I run into trouble when debugging my flagship application that extensively utilizes runtime BPLs as a plugin system. The problem occurs only when compiled and debugged as a Win64 application, and using Delphi's Win64 internal debugger. Delphi's Win32 internal debugger does not have this problem. When using "load all symbols" in the debugger options, I miss stack and local symbols info for some units but not other units in the same BPL (check screenshots). However, when I use the option to load debug info for specific BPLs, and only in my runtime BPL all units have local symbols info. Logically, I am missing debug info for all other units. Of course, I dont like having to specify each symbol table specifically, I would rather load all symbol tables and not have to mess with it. I have also experimented with using the sy...

Should I use logging module or python's debugger?

Should I use logging module or python's debugger? I have a question. In which cases should I use python's debugger instead of logging module. I undestand that both are debugging tools, but I don't know how to exactly use them - if it is better to primary debug with logging module or with python's debugger. Logging isn't only for debugging, it's for retroactively analysing what your program was doing, even hours or weeks after the fact. That's quite different from stepping through an algorithm in a debugger. – deceze ♦ 2 days ago Logging is not a debugging tool. It is for monitoring and should be done continuously. With the appropriate log level of cause. – Klaus D. 2 days ago ...

Get the time spent waiting on breakpoints in a debugger

Get the time spent waiting on breakpoints in a debugger Background Suppose I have a metaphorical patient whose heart beats once per second, and every second, I check whether his last heartbeat was more than five seconds late (and, if so, declare him to be in danger): let lastHeartbeat = Date.now(); // Heartbeater setInterval(() => lastHeartbeat = Date.now(), 1000); // Health-checker setInterval( () => { if((Date.now() - lastHeartbeat) > 5000){ alert("Patient has flatlined"); } }, 1000 ); Issue If I use a debugger to pause the execution of this script at some point, I have a problem: if I remain on a breakpoint for more than five seconds, then, once script execution resumes, my health-checker function is certain to declare that the patient has flatlined. Desired behaviour Instead, I'd like to factor in the time spent in the debugger. i.e., if I spend twenty seconds sitting on a breakpoint just after an initial heartbeat occu...