Raspberry Zero W: Running ok but Debugger with error

General questions regarding the usage of CodeLite
codemonster
CodeLite Enthusiast
Posts: 31
Joined: Tue Feb 26, 2019 12:50 am
Genuine User: Yes
IDE Question: C++
Contact:

Raspberry Zero W: Running ok but Debugger with error

Post by codemonster »

Hello
my servoprogram is well running but when I want to debug with breakpoints I get this error message:

"No executable file specified.
Use the "file" or "exec-file" command."


my settings:
working Directory: /home/pi/myprod/cpptest/p12-servo/Debug
Compiler otions: -ggdb;-std=c++11
Debugger Settings in Project Settings: empty fields
Global Debugger Settings: Debugger Path = empty

After pressing OK in the error box the code-window is blinking 4 times :?

Code: Select all

#include <stdio.h>
#include <wiringPi.h>
#include <iostream>
#include <unistd.h>


int main()
{
	int i {1};
	int k {10};

	std::cout << "i verdoppelt :" << ++i << std::endl;
	std::cout << "k verdoppelt :" << k * 2 << std::endl;

	if (wiringPiSetup () == -1) //using wPi pin numbering
		exit (1) ;

	pinMode(1, PWM_OUTPUT);
	pwmSetMode(PWM_MODE_MS);
	pwmSetClock(384); 
	pwmSetRange(1000);
	pwmWrite(1, 75);  
	usleep(1000 * 1000);
	//goto ww;
	pwmWrite(1, 60);
	usleep(1000 * 1000);
	pwmWrite(1, 80);
	usleep(1000 * 1000);
	pwmWrite(1, 50); 
	//ww:
	return 0 ;
}
Can somebody help? Do you need some more informations regarding my settings?
Thank you
Last edited by codemonster on Fri Mar 15, 2019 3:59 am, edited 2 times in total.
codemonster
CodeLite Enthusiast
Posts: 31
Joined: Tue Feb 26, 2019 12:50 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Raspy: Running ok but Debugger with error

Post by codemonster »

Project File:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<CodeLite_Project Name="p12-servo-test" Version="10.0.0" InternalType="Console">
  <Plugins>
    <Plugin Name="qmake">
      <![CDATA[00010001N0005Debug000000000000]]>
    </Plugin>
  </Plugins>
  <Description/>
  <Dependencies/>
  <VirtualDirectory Name="src">
    <File Name="servo-test.cpp"/>
  </VirtualDirectory>
  <Dependencies Name="Debug"/>
  <Dependencies Name="Release"/>
  <Settings Type="Executable">
    <GlobalSettings>
      <Compiler Options="" C_Options="" Assembler="">
        <IncludePath Value="."/>
      </Compiler>
      <Linker Options="">
        <LibraryPath Value="."/>
      </Linker>
      <ResourceCompiler Options=""/>
    </GlobalSettings>
    <Configuration Name="Debug" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Executable" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
      <Compiler Options="-ggdb;-std=c++11" C_Options="-g;-O0;-Wall" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
        <IncludePath Value="."/>
      </Compiler>
      <Linker Options="-l wiringPi" Required="yes"/>
      <ResourceCompiler Options="" Required="no"/>
      <General OutputFile="$(IntermediateDirectory)/$(ProjectName)" IntermediateDirectory="./Debug" Command="sudo ./$(ProjectName)" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="/home/pi/myprod/cpptest/p12-servo/Debug" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
      <BuildSystem Name="Default"/>
      <Environment EnvVarSetName="&lt;Use Defaults&gt;" DbgSetName="&lt;Use Defaults&gt;">
        <![CDATA[]]>
      </Environment>
      <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="yes">
        <DebuggerSearchPaths>/home/pi/myprod/cpptest/p12-servo/Debug
/home/pi/myprod/cpptest/p12-servo</DebuggerSearchPaths>
        <PostConnectCommands/>
        <StartupCommands/>
      </Debugger>
      <PreBuild/>
      <PostBuild/>
      <CustomBuild Enabled="no">
        <RebuildCommand/>
        <CleanCommand/>
        <BuildCommand/>
        <PreprocessFileCommand/>
        <SingleFileCommand/>
        <MakefileGenerationCommand/>
        <ThirdPartyToolName>None</ThirdPartyToolName>
        <WorkingDirectory/>
      </CustomBuild>
      <AdditionalRules>
        <CustomPostBuild/>
        <CustomPreBuild/>
      </AdditionalRules>
      <Completion EnableCpp11="no" EnableCpp14="no">
        <ClangCmpFlagsC/>
        <ClangCmpFlags/>
        <ClangPP/>
        <SearchPaths/>
      </Completion>
    </Configuration>
    <Configuration Name="Release" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Executable" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
      <Compiler Options="-O2;-Wall" C_Options="-O2;-Wall" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
        <IncludePath Value="."/>
        <Preprocessor Value="NDEBUG"/>
      </Compiler>
      <Linker Options="" Required="yes"/>
      <ResourceCompiler Options="" Required="no"/>
      <General OutputFile="$(IntermediateDirectory)/$(ProjectName)" IntermediateDirectory="./Release" Command="./$(ProjectName)" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
      <BuildSystem Name="Default"/>
      <Environment EnvVarSetName="&lt;Use Defaults&gt;" DbgSetName="&lt;Use Defaults&gt;">
        <![CDATA[]]>
      </Environment>
      <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no">
        <DebuggerSearchPaths/>
        <PostConnectCommands/>
        <StartupCommands/>
      </Debugger>
      <PreBuild/>
      <PostBuild/>
      <CustomBuild Enabled="no">
        <RebuildCommand/>
        <CleanCommand/>
        <BuildCommand/>
        <PreprocessFileCommand/>
        <SingleFileCommand/>
        <MakefileGenerationCommand/>
        <ThirdPartyToolName>None</ThirdPartyToolName>
        <WorkingDirectory/>
      </CustomBuild>
      <AdditionalRules>
        <CustomPostBuild/>
        <CustomPreBuild/>
      </AdditionalRules>
      <Completion EnableCpp11="no" EnableCpp14="no">
        <ClangCmpFlagsC/>
        <ClangCmpFlags/>
        <ClangPP/>
        <SearchPaths/>
      </Completion>
    </Configuration>
  </Settings>
</CodeLite_Project>

codemonster
CodeLite Enthusiast
Posts: 31
Joined: Tue Feb 26, 2019 12:50 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Raspy: Running ok but Debugger with error

Post by codemonster »

The error is that the sudo in"executable to Run/Debug = sudo ./$(ProjectName)" not operates in Debug mode (only in release mode) in Codelite or I don't find out how I can setup this.
The codeline "pwmSetMode(PWM_MODE_MS)" needs a sudo started gdb.
It's also possible that this is an error in Codelite 10.0.0. But this is the newest version that is running on my Raspy Zero W.
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Raspy: Running ok but Debugger with error

Post by DavidGH »

Hi,

No promises that I'm right, but I think you need to tick the 'Use separate debug args' box, and put the sudo into 'Debug Program Arguments'. You might also need temporarily the 'sudo' from 'Executable to Run/Debug'.

If that isn't the answer, the next thing to do is to try running in a terminal. See what happens with:
~> gdb --args sudo /full/path/to/your/ExecutableName

Regards,

David
codemonster
CodeLite Enthusiast
Posts: 31
Joined: Tue Feb 26, 2019 12:50 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Raspy: Running ok but Debugger with error

Post by codemonster »

Hi,
what a shame, your first tip doesn't works.

The program works fine with gdb in terminalmode. This also was my way to find out that codelite 10.0.0 doesn't starts gdb with sudo.
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Raspy: Running ok but Debugger with error

Post by DavidGH »

The program works fine with gdb in terminal mode
Out of interest, what was your successful command? The one I suggested, or just: gdb sudo /path/to/program ?
your first tip doesn't works.
OK. Please turn on Full Debugger Logging. (You can do that from the Settings > GDB: Misc menu, or by ticking the 'Enable Log' box in the Output tab of the Debugger Pane.) Try to debug your program and you'll get a lot of output from gdb.

You may see something there that explains the problem. Otherwise please paste the output here.
codemonster
CodeLite Enthusiast
Posts: 31
Joined: Tue Feb 26, 2019 12:50 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Raspy: Running ok but Debugger with error

Post by codemonster »

Thank you very much for helping me!!!

with this command the program was running with gdb on terminal: sudo gdb ./Debug/program

Debugger Output Log:

Code: Select all

Using gdbinit file: /tmp/codelite_gdbinit.txt
Current working dir: /home/pi/myprod/cpptest/p12-servo
Launching gdb from : /home/pi/myprod/cpptest/p12-servo/Debug
Starting debugger  : gdb --command="/tmp/codelite_gdbinit.txt" --tty=/dev/pts/1 --interpreter=mi "sudo ./p12-servo-test"
DEBUG>>set unwindonsignal on
DEBUG>>set breakpoint pending on
DEBUG>>set print object on
DEBUG>>set width 0
DEBUG>>set height 0
DEBUG>>set print elements 200
DEBUG>>python
DEBUG>>import sys
DEBUG>>sys.path.insert(0, '/home/pi/.codelite/gdb_printers')
DEBUG>>from libstdcxx.v6.printers import register_libstdcxx_printers
DEBUG>>register_libstdcxx_printers (None)
DEBUG>>from qt4 import register_qt4_printers
DEBUG>>register_qt4_printers (None)
DEBUG>>from wx import register_wx_printers
DEBUG>>register_wx_printers (None)
DEBUG>>end
DEBUG>>00000070-break-insert -f "/home/pi/myprod/cpptest/hello/hello.cpp:6"						 
DEBUG>>00000071-break-insert -f "/home/pi/myprod/cpptest/p12-servo/servo-test.cpp:26"
DEBUG>>00000072-break-insert -f "/home/pi/myprod/cpptest/test/main.cpp:10"						 
DEBUG>>00000073-enable-pretty-printing
Debug session started successfully!
DEBUG>>00000074-exec-arguments sudo
DEBUG>>00000075-exec-run 
DEBUG>>=thread-group-added,id="i1"
=thread-group-added,id="i1"
DEBUG>>~"GNU gdb (Raspbian 7.12-6) 7.12.0.20161007-git\n"
GNU gdb (Raspbian 7.12-6) 7.12.0.20161007-git
DEBUG>>~"Copyright (C) 2016 Free Software Foundation, Inc.\n"
Copyright (C) 2016 Free Software Foundation, Inc.
DEBUG>>~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\nand \"show warranty\" for details.\n"
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.  Type "show copying"\nand "show warranty" for details.
DEBUG>>~"This GDB was configured as \"arm-linux-gnueabihf\".\nType \"show configuration\" for configuration details."
This GDB was configured as "arm-linux-gnueabihf".\nType "show configuration" for configuration details.
DEBUG>>~"\nFor bug reporting instructions, please see:\n"
\nFor bug reporting instructions, please see:
DEBUG>>~"<http://www.gnu.org/software/gdb/bugs/>.\n"
<http://www.gnu.org/software/gdb/bugs/>.
DEBUG>>~"Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.\n"
Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.
DEBUG>>~"For help, type \"help\".\n"
For help, type "help".
DEBUG>>~"Type \"apropos word\" to search for commands related to \"word\"...\n"
Type "apropos word" to search for commands related to "word"...
DEBUG>>&"sudo ./p12-servo-test: Datei oder Verzeichnis nicht gefunden.\n"
DEBUG>>&"set unwindonsignal on\n"
DEBUG>>=cmd-param-changed,param="unwindonsignal",value="on"
=cmd-param-changed,param="unwindonsignal",value="on"
DEBUG>>^done
DEBUG>>&"set breakpoint pending on\n"
DEBUG>>=cmd-param-changed,param="breakpoint pending",value="on"
=cmd-param-changed,param="breakpoint pending",value="on"
DEBUG>>^done
DEBUG>>&"set print object on\n"
DEBUG>>=cmd-param-changed,param="print object",value="on"
=cmd-param-changed,param="print object",value="on"
DEBUG>>^done
DEBUG>>&"set width 0\n"
DEBUG>>=cmd-param-changed,param="width",value="4294967295"
=cmd-param-changed,param="width",value="4294967295"
DEBUG>>^done
DEBUG>>&"set height 0\n"
DEBUG>>=cmd-param-changed,param="height",value="4294967295"
=cmd-param-changed,param="height",value="4294967295"
DEBUG>>^done
DEBUG>>&"set print elements 200\n"
DEBUG>>^done
DEBUG>>&"python\n"
DEBUG>>&"Traceback (most recent call last):\n"
DEBUG>>&"  File \"<string>\", line 4, in <module>\n"
DEBUG>>&"  File \"/home/pi/.codelite/gdb_printers/libstdcxx/v6/printers.py\", line 1023, in register_libstdcxx_printers\n"
DEBUG>>&"    gdb.printing.register_pretty_printer(obj, libstdcxx_printer)\n"
DEBUG>>&"  File \"/usr/share/gdb/python/gdb/printing.py\", line 152, in register_pretty_printer\n"
DEBUG>>&"    printer.name)\n"
DEBUG>>&"RuntimeError: pretty-printer already registered: libstdc++-v6\n"
DEBUG>>&"Error while executing Python code.\n"
DEBUG>>^error,msg="Error while executing Python code."
^error,msg="Error while executing Python code."
DEBUG>>&"No symbol table is loaded.  Use the \"file\" command.\n"
DEBUG>>00000070^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="/home/pi/myprod/cpptest/hello/hello.cpp:6",times="0",original-location="/home/pi/myprod/cpptest/hello/hello.cpp:6"}
Found the breakpoint ID!
Storing debugger breakpoint Id=1
Successfully set breakpoint 1 at: /home/pi/myprod/cpptest/hello/hello.cpp:6
DEBUG>>&"No symbol table is loaded.  Use the \"file\" command.\n"
DEBUG>>00000071^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="/home/pi/myprod/cpptest/p12-servo/servo-test.cpp:26",times="0",original-location="/home/pi/myprod/cpptest/p12-servo/servo-test.cpp:26"}
Found the breakpoint ID!
Storing debugger breakpoint Id=2
Successfully set breakpoint 2 at: /home/pi/myprod/cpptest/p12-servo/servo-test.cpp:26
DEBUG>>&"No symbol table is loaded.  Use the \"file\" command.\n"
DEBUG>>00000072^done,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="/home/pi/myprod/cpptest/test/main.cpp:10",times="0",original-location="/home/pi/myprod/cpptest/test/main.cpp:10"}
Found the breakpoint ID!
Storing debugger breakpoint Id=3
Successfully set breakpoint 3 at: /home/pi/myprod/cpptest/test/main.cpp:10
DEBUG>>00000073^done
DEBUG>>00000074^done
DEBUG>>00000075^error,msg="No executable file specified.\nUse the \"file\" or \"exec-file\" command."
Debug session ended
No executable file specified.\nUse the "file" or "exec-file" command.
... and why is he checking other Projects as::
Successfully set breakpoint 1 at: /home/pi/myprod/cpptest/hello/hello.cpp:6 and
Successfully set breakpoint 3 at: /home/pi/myprod/cpptest/test/main.cpp:10
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Raspy: Running ok but Debugger with error

Post by DavidGH »

So all is well until:
Datei oder Verzeichnis nicht gefunden

I don't know what it can't find, sudo or ./p12-servo-test. You could try (in your 'Debug Program Arguments' field) replacing sudo with /usr/bin/sudo (if that's the correct path in your pi); and ./p12-servo-test with /full/path/to/p12-servo-test in your 'Executable to Run/Debug' field.

However:
with this command the program was running with gdb on terminal: sudo gdb ./Debug/program
You were running gdb itself under sudo; that's different from what you're telling CodeLite to do, which is:
gdb sudo ./Debug/program

What happens if you do, in the terminal:
gdb sudo ./Debug/program

By the way, do you need to enter a password when you use sudo? If so, I don't know if CodeLite can cope...
codemonster
CodeLite Enthusiast
Posts: 31
Joined: Tue Feb 26, 2019 12:50 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Raspy: Running ok but Debugger with error

Post by codemonster »

Datei oder Verzeichnis nicht gefunden
it says: file or directory not found
You could try (in your 'Debug Program Arguments' field) replacing sudo with /usr/bin/sudo
Then title of Debugger window: Debugging "sudo ./p12-servo-test" /usr/bin/sudo
...and error
and ./p12-servo-test with /full/path/to/p12-servo-test in your 'Executable to Run/Debug' field.
error
What happens if you do, in the terminal:
gdb sudo ./Debug/program
GDB brings error…. btw yes, sudo is in /usr/bin/
By the way, do you need to enter a password when you use sudo?
no!

:cry:
codemonster
CodeLite Enthusiast
Posts: 31
Joined: Tue Feb 26, 2019 12:50 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Raspy: Running ok but Debugger with error

Post by codemonster »

I think it can't find sudo because other programs with no need of gdb-sudo-start are running in gdb.
Post Reply