mac automation by passing message to 'configure' - c

I installed 'gdb' to debug my C program in mac with VS Code.
When I typed "brew install gdb", it told me to follow the instructions in https://sourceware.org/gdb/wiki/BuildingOnDarwin to give permission to gdb.
But there is one sentence that I have no idea how to follow.
The sentence is :
If you plan to build gdb frequently, this step can be automated by passing --enable-codesign=gdb-cert (assuming, again, that gdb-cert is the name of the certificate) to configure.
How can I pass the message to the configure? What is the 'configure' in mac terminal?? I'm using Catalina and zsh. please help!

Related

Can't launch debug - C in VS code on Linux

Let me preface this, I am very new to linux and to working on a non-IDE based setup.
I am trying to debug a very simple C program using vs code version 1.55
I unloaded all modules beforehand, so vs code can load appropriate default gcc & gdb versions (which it did, GCC 8.2)
I am following the VS code getting started documentation for setting up and everything seems very straight forward until I try to debug.
I use the default settings as instructed, the file builds successfully but then I get the below
/usr/bin/gdb: symbol lookup error: /usr/bin/gdb: undefined symbol: PyUnicodeUCS4_FromEncodedObject
please note that I cannot rebuild python with ucs4 enabled as suggested in another thread as I have no root access. however I can change VS code version to an earlier one if this will help.
Thanks.
I think this issue is specific to my environment but I will post the answer anyway as it may face someone else.
So this for me was 2 separate issues:
First gdb doesn't start and second vs code can't start gdb.
To check if this is the case try to launch gdb from terminal (not vs code) by typing gdb in the terminal (after loading gdb if needed), I was receiving the error above
Solution to this part is this as T0maas thankfully suggested above
Steps for linux newbies:
ldd gdb (or /usr/bin/gdb) (with vs_code loaded)
from step one get the python library path
unload all modules
load gdb
LD_PRELOAD=<python path from 1>
bash -c "export LD_PRELOAD"
load vs_code
load gdb
After the above steps writing gdb in the terminal should start gdb
Part 2:
The rest of the problem was when I tried to launch debugging session through the GUI of vs_code (still produced the same error)
In the terminal (after loading gdb) type whereis gdb
For me this produced multiple directories the first of which was /usr/bin/gdb (this is the default used in vs_code launch.json)
Changing that directory in the launch.json file to a different one of the other directories solved the second part of the problem for me.

OSX Eclipse CDT stalls at the start of debugging: "Configuring GDB"

I have installed Eclipse CDT and GDB.
I created a simple "Hello World" C project.
When I try to debug the project, GDB starts to behave very chaotic: I am able to debug a few times, step through the code, etc., but then it starts stalling at the begining of the next debug session with the message "Configuring GDB".
After I restart Eclipse CDT sometimes I still cannot debug, and sometimes I can, but also just for a few times, and then again the same problem comes up: stalls with "Configuring GDB" message.
I have tried hard to find the pattern, but failed.
What could be the reason for such a chaotic behaviour?
p.s.
I forgot to mention that I did sign the /usr/local/bin/gdb executable (and verified it with codesign --verify --verbose gdb).
Edit:
The screenshot shows the 2 stuck sessions:

GDB stuck at “Configuring GDB Aborting configuring GDB”

I've installed (OSX Mojave 10.14.6.) Eclipse CDT and GNU MCU Eclipse plugin and finaly GNU Tools for ARM. My goal is to build and debug ARM code using GDB (arm-none-eabi-gdb).
I've created a Hello World project for Arm, which builds ok - but, debugging seems not to work with GDB (that comes with the Arm package). GDB gets stuck:
I have set the proper paths in Eclipse to arm-none-eabi-gdb.
I have signed the arm-none-eabi-gdb (with the same certificate that I used to sign GDB installed via brew into /usr/local/bin/gdb the day before - and it worked!).
I have also tried running Eclipse as root from command line.
Nothing helps.
The message is "Configuring GDB Aborting configuring GDB".
What to do?
Probably what is going on here is that you built to a given target (ARM based) and you're trying to run it (with gdb) on your mac (x86).
You'll need an emulator or QEMU to properly run on your mac or maybe a real board.

Debugging in Eclipse with remote GDB

I have a Linux machine which is set up to cross-compile programs for an AVR target. It's easy to run and debug programs locally:
Run the program with simavr (acts as GDB server)
Run GDB (avr-gdb) and connect it to simavr
I'd like to to recreate this flow remotely from Eclipse on a Windows machine. The Windows machine isn't really set up for development — it has Eclipse installed and the source code for my project, but it doesn't have any local C/C++ dev tools like GDB. I'd ideally like to visually debug using the local copy of the source, but by interacting with the remote GDB over SSH.
This Eclipse plugin seems to be the recommended tool for the job. Unfortunately I can't get this working. Here's what I've done:
Created a new "C/C++ Remote Application" debug configuration.
Set the "Preferred Launcher" to "Direct Remote Debugging Launcher".
Pointed "Remote C/C++ exe file path" to the location of the binary on the remote machine
Pointed "Remote workspace directory" to the location of the project source on the remote machine
This does not seem to work. When I attempt to debug with this configuration, I get this error:
Error with command: gdb --version
Cannot run program "gdb": Launching failed
This error makes sense. If I look in the "Debugger" tab of my debug configuration, the "GDB debugger" is set to gdb. If I open the file browser for the debugger, it only shows files on my local Windows machine. It looks like the configuration is set up to execute gdb on my machine.
I thought the point of the plugin was the launch GDB on a remote machine, but I can't find a way to make a debug configuration that actually does that. Any help would be appreciated.
We use the package called GDB Hardware Debugger which lets you specify which GDB you want to use and how you want to launch it. We keep its eclipse configuration as empty as possible, with the minimum required, and continue configuring GDB through its scripting option -x which offers finer-grained control. That way, you are not required to understand how and when are those eclipse fields used to run GDB. For example, we needed to perform some extra GDB settings before connecting while this plugin connects first and then uses the provided GDB script.

Error while launching gdb version Eclipse

Here is an issue I've worked around by simply not using Eclipse for debugging, but it's getting out-of-hand.
I've used Eclipse Helios, Juno and Kepler over the last year and they all display exactly the same problem when I try to debug a local C/C++ application.
When I try to debug, it simply reports the error "Error while launching gdb --version".
gdb is in my path, but to be sure, I change the Debug settings to list the path explicitly. If I do that, I simply get "Error while launching /usr/bin/gdb --version", which is no better.
I'm using Scientific Linux version 6.4 (as required by my customers) and currently, I'm trying to use Eclipse Kepler. Running from the command line, gdb has no problem reporting it's version:
# gdb --version
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6)
[... licensing info]
Please, please let me know how to fix this as I have spent weeks working at only a fraction of the rate I would expect because I'm not utilizing an integrated development environment, but using separate tools.
I've seen other similar posts, but they are either
(a) about Windows / MingW - although I've tried their ideas anyway, just in case they work.
(b) don't have any answer provided.
As Scientific Linux is a RedHat derivative, I expect RHEL or CentOS information would be as relevant for me.

Resources