Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Compiling codeblocks original source code to develop my own customized codeblock
BlueHazzard:
Please Enable full debug logging: Settings->Debugger->Common->Full (Debug) log. There you see exactly what is going on, and why the debugger fails.
--- Quote ---Plugin question:
So do I need to copy my complete source code and put it inside plugin section in codeblocks_svn_code?
--- End quote ---
No. Simply open both projects in one workspace (by opening simply both projects). But the settings of the projects have to be ok, and i think there is your problem...
As Tim suggested you should try to build and debug a contrib plugin first.
1) For this open a contrib plugin project from /PATHTOCODEBLOCKS/src/plugins/contrib/ProjectOptionsManipulator/ProjectOptionsManipulator.cbp .
2) Then open /PATHTOCODEBLOCKS/src/CodeBlocks.cbp .
3) Activate again the ProjectOptionsManipulator.cbp by double click int the Management pane. This project should now be marked as active (The name is bold).
4) Check if the correct "default" target is selected in the toolbar near the build button
5) In the Management panel browse to Codeblocks/Source/src/app.cpp (BUT DON'T ACTIVATE THE PROJECT) and go to line 610. Set a breakpoint there
6) Set a breakpoint of interest in the ProjectOptionsManipulator source
7) Now hit the debugger button
8) It should now halt first at src/app.cpp:610
9) Hit continue if the debugger stops until you hit the desired breakpoint
If this works you can look into the project settings, how the project is set up and compare it wit your settings. Then you should find the error why your plugin is not debugging correctly. If you have found the error can you please post it here?
[EDIT:] I am not sure but probably you have to build codeblocks with debugging symbols enabled. You do this by Settings->Global Variables->cb_release_type and add "-g" in the "base" field. Then you have to rebuild Codeblocks by hitting Build->Rebuild
BlueHazzard:
Ok , i think i have found your problem. The wizard script for plugins is not really created for targets to be able to debug. I have created a updated script:
0) Close Codeblocks
1) Download the attached archive
1.1) Extract the archive
2) copy the extracted script to YOUR_CODEBLOCKS_INSTALLATION_DIRECTORY\share\CodeBlocks\templates\wizard\plugins\wizard.script
3) Open codeblocks by clicking on YOUR_CODEBLOCKS_INSTALLATION_DIRECTORY\codeblocks.exe
4) Create a new project: Codeblocks plugin
5) Go trough the wizard pages
6) This should create a project with two targets: "default" and "to_codeblocks"
* "default" will create the normal PLUGIN_NAME.cbplugin file for installation
* "to_codeblocks" will build and install the plugin in one step to your development version of codeblocks. With this target debugging should work out of the box
If this works i will try to talk to the devs to update the script
anandamu16:
Hi @BlueHazzard
Thanks for the detailed explanation.
--- Quote ---No. Simply open both projects in one workspace (by opening simply both projects). But the settings of the projects have to be ok, and i think there is your problem...
As Tim suggested you should try to build and debug a contrib plugin first.
1) For this open a contrib plugin project from /PATHTOCODEBLOCKS/src/plugins/contrib/ProjectOptionsManipulator/ProjectOptionsManipulator.cbp .
2) Then open /PATHTOCODEBLOCKS/src/CodeBlocks.cbp .
3) Activate again the ProjectOptionsManipulator.cbp by double click int the Management pane. This project should now be marked as active (The name is bold).
4) Check if the correct "default" target is selected in the toolbar near the build button
5) In the Management panel browse to Codeblocks/Source/src/app.cpp (BUT DON'T ACTIVATE THE PROJECT) and go to line 610. Set a breakpoint there
6) Set a breakpoint of interest in the ProjectOptionsManipulator source
7) Now hit the debugger button
8) It should now halt first at src/app.cpp:610
9) Hit continue if the debugger stops until you hit the desired breakpoint
--- End quote ---
I follow the steps and it works fine.Thanks
After it, I go to ProjectOptionsManipulator.cbp and then go into it build options (right click->buildOptions) but it has no any relevant settings inside. I mean Other directories tab doesn't contain any path and same with linker and compiler settings. Even pre/post build steps tab also doesn't contain any info. Then I go into the ProjectOptionsManipulator project Properties, There also I compared the settings it was fine.
I checked into the files inside projectOptionsManipulator contrib plug, Th only additional file is makefile, which is not available in my menuplugin project.
--- Quote ---If this works you can look into the project settings, how the project is set up and compare it wit your settings
--- End quote ---
By this, did you mean to compare the settings present in makefile?
After matching the properties, I am getting the error while debugging
My debuggerlog after matching project properties:
--- Code: ---Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
default
Adding source dir: C:\zbcqcm\codeblocks_svn_code\code\src\plugins\contrib\MenuPlugin\
Adding source dir: C:\zbcqcm\codeblocks_svn_code\code\src\plugins\contrib\MenuPlugin\
Adding file: C:\zbcqcm\codeblocks_svn_code\code\src\devel\codeblocks.exe
Changing directory to: C:/zbcqcm/codeblocks_svn_code/code/src/devel
Set variable: PATH=.;C:\zbcqcm\codeblocks_svn_code\code\src\devel;C:\wxMSW-2.8.12\wxMSW-2.8.12\lib\gcc_dll;C:\MinGW\bin;C:\MinGW;C:\ProgramData\Oracle\Java\javapath;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\doxygen\bin;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files (x86)\SEGGER\JLink_V610l;C:\GNU_Tools_ARM_Embedded\6.2_2016q4\bin;C:\arm-none-eabi-gcc-4.8.2_nl-1.19.0_bu-2.23.2-mingw32-netx.0\arm-none-eabi-gcc-4.8.2\arm-none-eabi\bin;C:\arm-none-eabi-gcc-4.8.2_nl-1.19.0_bu-2.23.2-mingw32-netx.0\arm-none-eabi-gcc-4.8.2\bin;C:\gcc-arm-none-eabi-6_2-2016q4-20161216-win32\arm-none-eabi\bin;C:\gcc-arm-none-eabi-6_2-2016q4-20161216-win32\bin;C:\SysGCC\arm-elf\bin;C:\SysGCC\arm-eabi\bin;C:\Program Files (x86)\AXSEM\AXSDB\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\TortoiseGit\bin;C:\Program Files\Git\cmd;C:\TDM-GCC-32\bin;C:\Program Files (x86)\WinRAR;C:\Program Files (x86)\GNU Tools ARM Embedded\6.2 2016q4\bin;C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.5\arm\bin;\\ C\CB_20161120_rev10922_win32\zip300xn-x64\zip300xn-x64;\\ C\boost\boost-jam-3.1.18-1-ntx86\boost-jam-3.1.18-1-ntx86;C:\Program Files\Git\bin;C:\cygwin64\bin;C:\codeblocks zip\zip300xn-x64\zip300xn-x64
[debug]Command-line: C:\TDM-GCC-32\bin\gdb32.exe -nx -fullname -quiet -args C:/zbcqcm/codeblocks_svn_code/code/src/devel/codeblocks.exe
[debug]Working dir : C:\zbcqcm\codeblocks_svn_code\code\src\devel
Starting debugger: C:\TDM-GCC-32\bin\gdb32.exe -nx -fullname -quiet -args C:/zbcqcm/codeblocks_svn_code/code/src/devel/codeblocks.exe
done
[debug]> set prompt >>>>>>cb_gdb:
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
[debug]Reading symbols from C:/zbcqcm/codeblocks_svn_code/code/src/devel/codeblocks.exe...
[debug]done.
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 7.9.1
[debug]Copyright (C) 2015 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law. Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "mingw32".
[debug]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]Find the GDB manual and other documentation resources online at:
[debug]<http://www.gnu.org/software/gdb/documentation/>.
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off
Debugger name and version: GNU gdb (GDB) 7.9.1
[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 200
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source C:\zbcqcm\codeblocks_svn_code\code\src\devel\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory C:/zbcqcm/codeblocks_svn_code/code/src/plugins/contrib/MenuPlugin/
[debug]Source directories searched: C:/zbcqcm/codeblocks_svn_code/code/src/plugins/contrib/MenuPlugin;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> break "C:/zbcqcm/codeblocks_svn_code/code/src/src/app.cpp:610"
[debug]Breakpoint 2 at 0x402d12: file C:\zbcqcm\codeblocks_svn_code\code\src\src\app.cpp, line 610.
[debug]>>>>>>cb_gdb:
[debug]> break "C:/zbcqcm/codeblocks_svn_code/code/src/plugins/contrib/ProjectOptionsManipulator/ProjectOptionsManipulator.cpp:181"
[debug]No source file named C:/zbcqcm/codeblocks_svn_code/code/src/plugins/contrib/ProjectOptionsManipulator/ProjectOptionsManipulator.cpp.
[debug]Breakpoint 3 ("C:/zbcqcm/codeblocks_svn_code/code/src/plugins/contrib/ProjectOptionsManipulator/ProjectOptionsManipulator.cpp:181") pending.
[debug]>>>>>>cb_gdb:
[debug]> break "C:/zbcqcm/codeblocks_svn_code/code/src/plugins/contrib/ProjectOptionsManipulator/ProjectOptionsManipulator.cpp:161"
[debug]No source file named C:/zbcqcm/codeblocks_svn_code/code/src/plugins/contrib/ProjectOptionsManipulator/ProjectOptionsManipulator.cpp.
[debug]Breakpoint 4 ("C:/zbcqcm/codeblocks_svn_code/code/src/plugins/contrib/ProjectOptionsManipulator/ProjectOptionsManipulator.cpp:161") pending.
[debug]>>>>>>cb_gdb:
[debug]> break "C:/zbcqcm/codeblocks_svn_code/code/src/plugins/contrib/ProjectOptionsManipulator/ProjectOptionsManipulator.cpp:85"
[debug]No source file named C:/zbcqcm/codeblocks_svn_code/code/src/plugins/contrib/ProjectOptionsManipulator/ProjectOptionsManipulator.cpp.
[debug]Breakpoint 5 ("C:/zbcqcm/codeblocks_svn_code/code/src/plugins/contrib/ProjectOptionsManipulator/ProjectOptionsManipulator.cpp:85") pending.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: C:\zbcqcm\codeblocks_svn_code\code\src\devel\codeblocks.exe
Child process PID: 4488
[debug][New Thread 4488.0xfcc]
[debug]Breakpoint 2, CodeBlocksApp::OnInit (this=0x5d707f0) at C:\zbcqcm\codeblocks_svn_code\code\src\src\app.cpp:610
[debug]C:\zbcqcm\codeblocks_svn_code\code\src\src\app.cpp:610:21787:beg:0x402d12
[debug]>>>>>>cb_gdb:
At C:\zbcqcm\codeblocks_svn_code\code\src\src\app.cpp:610
Continuing...
[debug]> cont
[debug]Continuing.
[debug]Starting Code::Blocks svn build rev 0 Feb 7 2017, 17:16:55 - wx2.8.12 (Windows, unicode) - 32 bit
[debug][Inferior 1 (process 4488) exited with code 037777777777]
[debug]>>>>>>cb_gdb:
[Inferior 1 (process 4488) exited with code 037777777777]
[debug]> quit
Debugger finished with status 0
--- End code ---
--- Quote ---I am not sure but probably you have to build codeblocks with debugging symbols enabled. You do this by Settings->Global Variables->cb_release_type and add "-g" in the "base" field. Then you have to rebuild Codeblocks by hitting Build->Rebuild
--- End quote ---
I did the build, using "-g" symbol inside cb_release_type.
I will check your wizard, once I understand the makefile present in projectOptionsManipulator plugin.
[/quote]
anandamu16:
--- Quote ---Ok , i think i have found your problem. The wizard script for plugins is not really created for targets to be able to debug. I have created a updated script:
0) Close Codeblocks
1) Download the attached archive
1.1) Extract the archive
2) copy the extracted script to YOUR_CODEBLOCKS_INSTALLATION_DIRECTORY\share\CodeBlocks\templates\wizard\plugins\wizard.script
3) Open codeblocks by clicking on YOUR_CODEBLOCKS_INSTALLATION_DIRECTORY\codeblocks.exe
4) Create a new project: Codeblocks plugin
5) Go trough the wizard pages
6) This should create a project with two targets: "default" and "to_codeblocks"
* "default" will create the normal PLUGIN_NAME.cbplugin file for installation
* "to_codeblocks" will build and install the plugin in one step to your development version of codeblocks. With this target debugging should work out of the box
--- End quote ---
It gives the same error, as in previous case
--- Quote ---* "to_codeblocks" will build and install the plugin in one step to your development version of codeblocks
--- End quote ---
Does it mean that, on building our project on "to_codeblock" target, it will build up as well as plugin gets automatically installed in codeblocks.? If its so, I checked my plugins sections inside codeblocks IDE. Plugin-> Manage Plugins-> Look into the list.
But there was no plugin installed in the list.
I also try to debug the plugin, but the error was same.
BlueHazzard:
--- Quote ---Does it mean that, on building our project on "to_codeblock" target, it will build up as well as plugin gets automatically installed in codeblocks.? If its so, I checked my plugins sections inside codeblocks IDE. Plugin-> Manage Plugins-> Look into the list.
But there was no plugin installed in the list.
I also try to debug the plugin, but the error was same.
--- End quote ---
Yes, it gets installed in the development output of Codeblocks (the subfolder devel, hopefully not the codeblocks folder with what you work).
Just to make things clear: There should be 3 folders with codeblocks.exe
1) CODEBLOCKS_INSTALLATION <-- Something like C:\Program Files\Codeblocks - This is your installation of codeblocks. If you use Codeblocks in your daily work this executable should be used
2) CODEBLOCKS_DEVEL <-- Something like C:\User\MYUSER\Documents\Programming\Codeblocks\src\codeblocks_sf\src\devel - This is the output directory if you build codeblocks. This gets overwritten every time you build codeblocks
3) CODEBLOCKS_OUTPUT <-- This folder gets created/updated if you run the update.bat script from the src folder. You can copy the content from this folder over CODEBLOCKS_INSTALLATION to update your installation
Now if you run my script and build the "to_codeblock" target the output gets copied and installed to CODEBLOCKS_DEVEL. Now if you want to run your plugin you have to run CODEBLOCKS_DEVEL\codeblocks.exe.
I made a mistake in the script: the run parameter for codeblocks are missing. For the target to_codeblocks you should add
--- Code: -----debug-log --no-dde --no-check-associations --multiple-instance --no-splash-screen --verbose -p debug
--- End code ---
To Project->Set programs argument->Program arguments You have to select the correct target from the list.
i have attached a updated version of the script
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version