How can I use eclipse to debug the generated libtool script?

I have a big C ++ project created using libtool. the problem is that eclipse will not run the libtool script created, and I get "The program is not a recognized executable." error message. how can i use eclipse debugger? I am currently using kdevelop3 as an editor and debugging with the understanding .. which is terrible.

I could run the actual executable, i.e. in. / libs of the project directory, but then I would have to manually set LD_LIBRARY_PATH and the like ... there should be a better way to do this.

Any help would be appreciated!

+6
source share
5 answers

Running a script instead of an executable is still not supported in Eclipse, see this error . Until this feature is introduced, you cannot debug a libtool-enabled project in Eclipse unless you save something like

path/to/configure --disable-shared 

thereby relying on static binding for debugging purposes only.

To do this, you

  • Open Project|Properties in the top menu

  • Select Autotools|Configure Settings in the left window menu

  • (optional) Create a new build configuration with highlighted C/C++ Build|Builder Settings|Build location

  • In the configure|Advanced section, fill in "Advanced command line options" with --disable-shared

+2
source

You need to convince eclipse to run gdb as follows:

 $ libtool --mode=execute gdb <your-program> 

See https://www.gnu.org/s/libtool/manual/html_node/Debugging-executables.html

+1
source

I think it would be possible to write a small wrapper program to insert exec 'sh libtool -mode execute' to run gdb. Call it "gdb-libtool" and call it instead of gdb.

I am developing on Windows and Linux, so I need something for myself.

There are some complex bits, for example, getting paths directly to libtool and calling gdb .. off to take swat at the same time.

Greetings, Jerry.

+1
source

You can get around this by executing the actual executable instead of the libtool script. The executable file is usually located in .libs/ . Therefore, in your debug configuration on the main tab, set the C/C++ Application value to approximately .libs/my_application . Then you will need to update LD_LIBRARY_PATH in your debug configuration.

Go to the environment tab of your debug configuration and create a new environment variable called LD_LIBRARY_PATH . You need to add the .libs directory to the path. Therefore, the value should look like this: ${project_loc}/.libs:$LD_LIBRARY_PATH if your .libs folder is located directly inside the project directory.

+1
source

First of all, you can disable the intermediate libtool script by adding -no-install to LDFLAGS to your Makefile.am OR you can just run make install and debug from the installed binary.

At the second point, you will need to set and export LD_LIBRARY_PATH before starting the eclipse.

0
source

Source: https://habr.com/ru/post/901613/


All Articles