It builds fine and manually starting gdb from the cmd-line I can debug. But when running from the IDE with F5 focused on main.cpp there’s a popup telling
Unable to get thread information: No symbol “undefined” in current context. (from thread-select undefined)
The debugger no longer responds and I have to kill it along with the Python process.
Unfortunately the above message does not help me further. Any takers?
^C[New Thread 0x2203 of process 38870]
[New Thread 0x2503 of process 38870]
warning: unhandled dyld version (17)
Thread 2 hit Temporary breakpoint 1, main () at src/main.cpp:29
29 cout << "This program is used to compute the value of the following series : " << endl;
(gdb) The program being debugged has been started already.
Start it from the beginning? (y or n) [answered Y; input not from terminal]
Starting program: <…>/PlatformIO/Projects/221123-164320-hello-world/.pio/build/native/program
This is where some input has to be entered (it’s a simple test program). The next Ctrl-C (no way to input something to either program or gdb) lets the program run through the 2nd input to its end. Then (gdb) asks again.
#include <iostream>
#include <cmath>
using namespace std;
int ComputeFactorial(int number) {
int fact = 0;
for (int j = 1; j <= number; j++) {
fact = fact * j;
}
return fact;
}
double ComputeSeriesValue(double x, int n) {
double seriesValue = 0.0;
double xpow = 1;
for (int k = 0; k <= n; k++) {
seriesValue += xpow / ComputeFactorial(k);
xpow = xpow * x;
}
return seriesValue;
}
int main() {
cout << "This program is used to compute the value of the following series : " << endl;
cout << "(x^0)/0! + (x^1)/1! + (x^2)/2! + (x^3)/3! + (x^4)/4! + ........ + (x^n)/n! " << endl;
cout << "Please enter the value of x : " ;
double x;
cin >> x;
int n;
cout << endl << "Please enter an integer value for n : " ;
cin >> n;
cout << endl;
double seriesValue = ComputeSeriesValue(x, n);
cout << "The value of the series for the values entered is "
<< seriesValue << endl;
return 0;
}
Would not matter if it contained just a printf or so.
Anybody knows solution for this? I’m running into exactly same issue. Trying to debug my native unit tests on Mac with latest VSC(1.83.1) and PIO plugin (Core 6.1.11·Home 3.4.4) using gdb. I signed the tool based on this thread How to debug a native application on MacOS
When running from command line, only after pressing Clt^C it shows info about breakpoint.
Reading symbols from /Users/lubos.horacek/workspace/project/.pio/build/native/program...
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = None
PlatformIO: Initializing remote target...
Temporary breakpoint 1 at 0x100000e24: file test/test_native/test_first.cpp, line 58.
PlatformIO: Initialization completed
(gdb) PlatformIO: Resume the execution to `debug_init_break = tbreak main`
PlatformIO: More configuration options -> https://bit.ly/pio-debug
Starting program: /Users/lubos.horacek/workspace/project/.pio/build/native/program
^C[New Thread 0x1603 of process 26130]
[New Thread 0x2003 of process 26130]
warning: unhandled dyld version (17)
Thread 2 hit Temporary breakpoint 1, main (argc=1, argv=0x7ff7bfeff500)
at test/test_native/test_first.cpp:58
58 UNITY_BEGIN();
(gdb) (gdb)
In VSC it hangs with this output:
Processing native (platform: native)
--------------------------------------------------------------------------------
Building...
Reading symbols from /Users/lubos.horacek/workspace/project/.pio/build/native/program...
Warning: 'set target-async', an alias for the command 'set mi-async', is deprecated.
Use 'set mi-async'.
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = None
PlatformIO: Initializing remote target...
Temporary breakpoint 1 at 0x100000d74: file test/test_native/test_firstcpp, line 58.
PlatformIO: Initialization completed
PlatformIO: Resume the execution to `debug_init_break = tbreak main`
PlatformIO: More configuration options -> https://bit.ly/pio-debug
[New Thread 0x1703 of process 13434]