-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
To build and use EAC-y, you will need:
- A C/C++ compiler e.g.
gcc/g++
- Python
- The GNU Debugger (GDB)
It is recommended that you use Vim. To
edit your code, as well as the termdebug
plugin for Vim
(should be part of a standard Vim installation from major
distros).
Simply clone the repository:
git clone https://github.com/DeltaBoyBZ/eacy
Build all the binary target and install to /usr/local
:
make all
sudo make install
Then configure GDB and Vim:
./configure.sh
NOTE: This example assumes you have Vim, and are using the EAC-y Vim plugin.
Create a new folder and in it add the following file:
#include<eacy/eacy.h>
#include<unistd.h>
#include<stdio.h>
#define EAC_LIB "libtest.so"
EAC void foo(int x, int y)
{
printf("%d\n", x + y);
}
int main()
{
while(1)
{
foo(10, 20);
sleep(1);
}
return 0;
}
Now enter <LocalLeader>ep
. If you have installed EAC-y
correctinly, you should see the foo
block transform:
void foo(int x, int y)
{EAC_VOID_FUNC(func, EAC_WRAP(x, y))
} EAC_VOID_EXPORT(func, EAC_WRAP(int x, int y),
EAC_WRAP(x, y))
If this does not work for you, check the
~/.vim/plugin
directory for eacy.vim
. If it does not
exist, then you should either:
-
Ensure
.vim/plugin
exists and run./configure
as in the last section; OR -
Add the following to your
~/.vimrc
:call plug#begin() " other plugins ... Plug 'DeltaBoyBZ/eacy' call plug#end()
Source
~/.vimrc
(possibly by restarting Vim) and then execute:PlugInstall
.
Create the following Makefile
:
.eac/libtest.so: test.c
mkdir -p .eac
gcc -g -shared -fPIC test.c -o .eac/libtest.so
test:
gcc -g -DEAC_DEBUG test.c -o test
all: test libtest.so
Run make all
and ensure everything builds correctly.
Start a GDB debuggin session, either in a separate terminal with,
gdb test
or inside Vim with,
:Termdebug test
If we run the program, we get the (I assume) expected output:
(gdb) run
30
30
30
...
Interupt the execution with <C-c>
. Edit the source code so
that instead of,
printf("%d\n", x + y);
we have:
printf("%d\n", x * y);
Rebuild the shared libary target,
make .eac/libtest.so
and execute:
(gdb) eacreload
(gdb) continue
You should see the following output:
30 # possible hold-over from original library
200
200
200
...
Congratulations! You've just performed edit and continue debugging through GDB.