Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Set another gdb by default (programatically)
Set another gdb by default (programatically) [message #1764597] Wed, 31 May 2017 15:19 Go to next message
Mickae Barril is currently offline Mickae BarrilFriend
Messages: 17
Registered: May 2017
Junior Member
Dear team,

I would like to know how to set (by default) a new debugger (custom cross gdb).

Context: I would like to use all the features already present in C/C++ Remote application Launch config but i need to set the debugger with mine.

Can i modify the LaunchUtils.java (org.eclipse.cdt.dsf.gdb) to set the default debugger path with the relevant one (mine of course :) ) or should i create a new launch config (new plugin....)????

PS: I i don't want to set it each time i need to debug a new project


Thank you in advance

MB
Re: Set another gdb by default (programatically) [message #1764782 is a reply to message #1764597] Fri, 02 June 2017 09:11 Go to previous messageGo to next message
Jonah Graham is currently offline Jonah GrahamFriend
Messages: 416
Registered: June 2014
Senior Member
Are you shipping your own plug-ins already? If so, I believe you will want your own config or at least launch delegate.

If you are a user, you can set the default GDB in Window -> Preferences -> C/C++ -> Debug -> GDB. Note that setting will only apply to newly created files.

If you are a little bit in the middle of the above options (e.g. you are shipping your own CDT based product, but don't want to write new code just for this) use plugin_customization.ini to set the default value for the preference above.
Re: Set another gdb by default (programatically) [message #1765341 is a reply to message #1764782] Thu, 08 June 2017 14:44 Go to previous messageGo to next message
Mickae Barril is currently offline Mickae BarrilFriend
Messages: 17
Registered: May 2017
Junior Member
Hi Jonah,

Thanks for your response.

Here are the modification i made in org.eclipse.cdt.debug.application plugin_customization.ini file

org.eclipse.cdt.dsf.gdb/defaultGdbCommand= "pathToMyGDBCommand\zynq-linux-gdb"

Should i set something else? Or maybe somewhere else??!!??

Caus' i still got the same old gdb default command.....


Thank you ;)

Re: Set another gdb by default (programatically) [message #1765344 is a reply to message #1765341] Thu, 08 June 2017 15:03 Go to previous messageGo to next message
Jonah Graham is currently offline Jonah GrahamFriend
Messages: 416
Registered: June 2014
Senior Member
Hi, Not sure about this one. I would have to debug it to see what is going wrong. Just to confirm, you have to have a new workspace I think.
Re: Set another gdb by default (programatically) [message #1765389 is a reply to message #1765344] Fri, 09 June 2017 07:14 Go to previous messageGo to next message
Mickae Barril is currently offline Mickae BarrilFriend
Messages: 17
Registered: May 2017
Junior Member
Hi Jonah,

I tried to switch workspace but nothing change....

Thank for your assistance
Re: Set another gdb by default (programatically) [message #1765452 is a reply to message #1765389] Fri, 09 June 2017 16:06 Go to previous messageGo to next message
Jonah Graham is currently offline Jonah GrahamFriend
Messages: 416
Registered: June 2014
Senior Member
Sounds like a little more debugging is necessary. Have you managed to set any default preferences with plugin_customization.ini? If not, some common problems include forgetting to add it to build.properties and putting it in the folder with the .product file instead of the the plug-in with the product defined in the plugin.xml.

HTH
Re: Set another gdb by default (programatically) [message #1765531 is a reply to message #1765452] Mon, 12 June 2017 07:30 Go to previous messageGo to next message
Mickae Barril is currently offline Mickae BarrilFriend
Messages: 17
Registered: May 2017
Junior Member
Hi Jonah,


FYI, i need to get my own CDT with these preferences (own debugger path) set as defaults. I don't think that creating a plugin is necessary for me because setting up my own debugger path is enough. What do you think?

To sum up, i just need to set some existing .ini file to get this default gdb command set with my own path. No need to create a new plugin to do so???

If this is the case, Could you please tell me which one of the plugin_customization.ini file should i implement? Caus' i got 4 different .ini files belonging to the below plugins:
=>org.eclipse.cdt.debug.application
=>org.eclipse.platform
=>org.eclipse.epp.package.cpp
=>org.eclipse.sdk

Thank you
Re: Set another gdb by default (programatically) [message #1765533 is a reply to message #1765531] Mon, 12 June 2017 08:06 Go to previous messageGo to next message
Jonah Graham is currently offline Jonah GrahamFriend
Messages: 416
Registered: June 2014
Senior Member
Hi Mickae,

The reason you have 4 different plugin_customization.ini is that you have 4 different "products" there:

=>org.eclipse.cdt.debug.application --> CDT stand along debugger -- get it here: http://download.eclipse.org/tools/cdt/releases/9.2/r.1/rcp/
=>org.eclipse.platform --> The Eclipse platform, with no additional plug-ins: http://download.eclipse.org/eclipse/downloads/drops4/R-4.6.3-201703010400/ under "Platform Runtime Binary"
=>org.eclipse.epp.package.cpp --> The main promoted download (EPP is Eclipse Packaging Product) available here: https://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/neon3
=>org.eclipse.sdk --> The Eclipse platform, with no additional plug-ins: http://download.eclipse.org/eclipse/downloads/drops4/R-4.6.3-201703010400/ under "Eclipse SDK"

If you really don't want to have your own product, you are presumably shipping the org.eclipse.epp.package.cpp. In that case you can add to the command line arguments of eclipse{.exe} your own pluginCustomization, see https://help.eclipse.org/neon/topic/org.eclipse.platform.doc.isv/reference/misc/runtime-options.html and search for pluginCustomization. By adding the command line arguments to eclipse.ini you can achieve what you want.

HTH

Re: Set another gdb by default (programatically) [message #1765534 is a reply to message #1765533] Mon, 12 June 2017 08:40 Go to previous messageGo to next message
Mickae Barril is currently offline Mickae BarrilFriend
Messages: 17
Registered: May 2017
Junior Member
You're awesome Jonah.

That perfectly works :)

On last thing, Could you please tell me if we can proceed that way to set cross GCC settings path or prefix????

Thanks for your guidance.

MB
Re: Set another gdb by default (programatically) [message #1765538 is a reply to message #1765534] Mon, 12 June 2017 09:25 Go to previous messageGo to next message
Jonah Graham is currently offline Jonah GrahamFriend
Messages: 416
Registered: June 2014
Senior Member
Quote:
On last thing, Could you please tell me if we can proceed that way to set cross GCC settings path or prefix????


I don't know on this one. The cross gcc default settings are saved after user enters them once in: .metadata/.plugins/org.eclipse.cdt.core/shareddefaults.xml

The code that manages the file is:
core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/SharedDefaults.java
and the wizard page that reads the saved settings is:
cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/SetCrossCommandWizardPage.java

One drawback to the way crossgcc handles prefix/path is that it is saved per project, which makes the projects hard to transport to other machines. You may want to consider http://gnuarmeclipse.github.io/ which adds some stuff on top of CDT for managing embedded toolchains. Note that it is currently called GNU ARM Eclipse, but is being rebranded because it already supports non-ARM and will continue to expand in that way.
Re: Set another gdb by default (programatically) [message #1765540 is a reply to message #1765538] Mon, 12 June 2017 09:36 Go to previous messageGo to next message
Mickae Barril is currently offline Mickae BarrilFriend
Messages: 17
Registered: May 2017
Junior Member
Thank you Jonah. I will check this ;)

I still have one question (sorry for the inconvenience):
Is it possible to get the eclipse installation path in an .ini file?


THank you

MB
Re: Set another gdb by default (programatically) [message #1765545 is a reply to message #1765540] Mon, 12 June 2017 10:11 Go to previous messageGo to next message
Jonah Graham is currently offline Jonah GrahamFriend
Messages: 416
Registered: June 2014
Senior Member
Quote:
Is it possible to get the eclipse installation path in an .ini file?


I assume you mean the eclipse.ini or plugin customizations one?

Many setting in Eclipse allow you to use Eclipse variables. For example you can set org.eclipse.cdt.dsf.gdb/defaultGdbCommand to ${eclipse_home}/gdb-mine and that will expand as expected.

To find out the variables available, I normally do what greg recommends here: https://stackoverflow.com/a/30369579/2796832

Note that some fields should have the "Variables.." button because they do expand variables, but they may not have the button. If you find a field that you want to use variables for, patches are welcome for that.

HTH,
Jonah


Re: Set another gdb by default (programatically) [message #1765546 is a reply to message #1765545] Mon, 12 June 2017 10:16 Go to previous messageGo to next message
Jonah Graham is currently offline Jonah GrahamFriend
Messages: 416
Registered: June 2014
Senior Member
PS I would be more than open to a patch against CDT that made it possible/easier to do what you want in regard to default crossgcc settings! https://wiki.eclipse.org/CDT/contributing
Re: Set another gdb by default (programatically) [message #1765652 is a reply to message #1765546] Tue, 13 June 2017 07:12 Go to previous messageGo to next message
Mickae Barril is currently offline Mickae BarrilFriend
Messages: 17
Registered: May 2017
Junior Member
Hi Jonah,

Hope you're well.

Thank you for the given information. it perfectly works for me.

MB
Re: Set another gdb by default (programatically) [message #1765661 is a reply to message #1765652] Tue, 13 June 2017 08:24 Go to previous messageGo to next message
Jonah Graham is currently offline Jonah GrahamFriend
Messages: 416
Registered: June 2014
Senior Member
Happy to help!

Perhaps if you could, can you share your use case. It is really nice to know how people are using CDT in the real world.
Re: Set another gdb by default (programatically) [message #1765682 is a reply to message #1765661] Tue, 13 June 2017 09:55 Go to previous messageGo to next message
Mickae Barril is currently offline Mickae BarrilFriend
Messages: 17
Registered: May 2017
Junior Member
No problem Jonah.

In my case, i just need to "tell" eclipse to use my own gdb tool (which has been created by my team). For that i need to poupuler the debugger command field (debugger page) with the path to my gdb bin directory. In order to set it as default, i used plugin_customization.ini file (org.eclipse.epp.package.cpp folder) and i set the below line :
org.eclipse.cdt.dsf.gdb/defaultGdbCommand=path\\to\\my\\gdb\\mygdb.exe


I also have to add the below lines to eclipse.ini:
-pluginCustomization
plugins/org.eclipse.epp.package.cpp_4.6.3.20170314-1500

Dear Jonah,
Please tell me if you want me to explain a bit more.

Thanks for your assistance
Re: Set another gdb by default (programatically) [message #1765683 is a reply to message #1765682] Tue, 13 June 2017 10:04 Go to previous message
Jonah Graham is currently offline Jonah GrahamFriend
Messages: 416
Registered: June 2014
Senior Member
Thanks. Feel free to be in touch with me at jonah <at> kichwacoders.com if I can provide any additional support on your Eclipse needs.
Previous Topic:Using GCOV with eclipse based ADA code, gives wrong code coverage
Next Topic:watchpoint unimplemented call
Goto Forum:
  


Current Time: Wed Sep 18 23:17:36 GMT 2024

Powered by FUDForum. Page generated in 0.04240 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top