Skip to content

Commit

Permalink
Merge pull request #4 from jvalcher/release-0.2
Browse files Browse the repository at this point in the history
termfu 0.2
  • Loading branch information
jvalcher authored Nov 16, 2024
2 parents d33c37d + 7683857 commit 71535f5
Show file tree
Hide file tree
Showing 25 changed files with 411 additions and 340 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ termfu*
core
tags
debug.out
.termfu*

test_programs/hello
test_programs/vars
test_programs/fib
test_programs/infinite_loop
test_programs/seg_fault

configs/.*_data

Expand Down
Empty file added .termfu_data
Empty file.
15 changes: 10 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ C_DEBUG_FILES = $(wildcard ./src/debug/*.c)
TEST_PROGS_DIR = test_programs

# configuration, data files
CONFIG_RUN_DEV = configs/.termfu_run_dev
DATA_RUN_DEV = configs/.termfu_run_dev_data
CONFIG_DEBUG = configs/.termfu_debugger
DATA_DEBUG = configs/.termfu_debugger_data
CONFIG_RUN_DEV = configs/.termfu_run_dev
DATA_RUN_DEV = configs/.termfu_run_dev_data
CONFIG_DEBUG = configs/.termfu_debugger
DATA_DEBUG = configs/.termfu_debugger_data
CONFIG_DEBUGGED = configs/.termfu_debugged
DATA_DEBUGGED = configs/.termfu_debugged_data

.PHONY: help all install dev devf devformat build run_dev plugins clean_prod clean_dev
.PHONY: help all install dev devf devformat debug debug_gdb build run_dev plugins clean_prod clean_dev


all: FLAGS += $(PROD_FLAGS)
Expand Down Expand Up @@ -89,6 +91,9 @@ run_dev:
debug:
$(B_FILE_PROD) -c $(CONFIG_DEBUG) -p $(DATA_DEBUG)

debug_gdb:
gdb --quiet --tui --args ./termfu_dev -c $(CONFIG_DEBUGGED) -p $(DATA_DEBUGGED)

todo:
./scripts/make_todo

Expand Down
2 changes: 1 addition & 1 deletion src/choose_layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ choose_layout (state_t *state)
}

state->debugger->src_path_changed = true;
ret = update_windows (state, 9, Dbg, Prg, Src, Asm, Brk, LcV, Reg, Stk, Wat);
ret = update_windows (9, Dbg, Prg, Src, Asm, Brk, LcV, Reg, Stk, Wat);
if (ret == FAIL) {
pfemr (ERR_UPDATE_WINS);
}
Expand Down
4 changes: 4 additions & 0 deletions src/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ typedef struct {
int stdin_pipe;
int stdout_pipe;
bool running_plugin;
int update_index;
int curr_plugin_index;

int reader_state;
Expand Down Expand Up @@ -427,6 +428,9 @@ typedef struct {

pthread_t send_key_thread;
pthread_t get_key_thread;
pthread_t display_lines_thread;
pthread_t update_window_thread;
pthread_t parse_debug_out_thread;

} debugger_t;

Expand Down
17 changes: 11 additions & 6 deletions src/display_lines.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,15 @@ create_scroll_buffer_llist (int plugin_index,
max_chars;
char *ptr;
window_t *win;
debugger_t *debugger;
buff_data_t *buff_data;
scroll_buff_line_t *buff_line,
*curr_buff_line,
*tmp_buff_line;

// free scroll_buff_line_t linked list
win = state->plugins[plugin_index]->win;
debugger = state->debugger;
buff_data = win->buff_data;
buff_line = buff_data->head_line;
while (buff_line != NULL) {
Expand All @@ -92,24 +94,27 @@ create_scroll_buffer_llist (int plugin_index,
buff_data->rows = 0;

// update source file buffer if path changed
if (plugin_index == Src && state->debugger->src_path_changed) {
if (plugin_index == Src && debugger->src_path_changed) {

if (buff_data->buff != NULL) {
free (buff_data->buff);
}

buff_data->buff = create_buff_from_file (state->debugger->src_path_buffer);
buff_data->buff = create_buff_from_file (debugger->src_path_buffer);
if (buff_data->buff == NULL) {
pfemr ("Failed to create buffer from file \"%s\"", state->debugger->src_path_buffer);
buff_data->buff = create_buff_from_file (debugger->main_src_path_buffer);
if (buff_data->buff == NULL) {
pfemr ("Failed to create buffer from file \"%s\"", debugger->main_src_path_buffer);
}
}

state->debugger->src_path_changed = false;
debugger->src_path_changed = false;
}

// create linked list from buffer
ptr = buff_data->buff;
max_chars = 0;

// create linked list from buffer
//
do {

buff_data->rows += 1;
Expand Down
1 change: 0 additions & 1 deletion src/format_window_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include "data.h"
#include "plugins.h"
#include "utilities.h"

static void format_window_data_Brk (state_t *state);
static void format_window_data_LcV (state_t *state);
Expand Down
4 changes: 2 additions & 2 deletions src/get_form_input/_get_form_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "../data.h"
#include "../utilities.h"

char* trim_whitespaces (char *str);
static char* trim_whitespaces (char *str);



Expand Down Expand Up @@ -167,7 +167,7 @@ get_form_input (char *prompt,



char*
static char*
trim_whitespaces (char *str)
{
char *end;
Expand Down
2 changes: 1 addition & 1 deletion src/get_form_input/attach_to_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ attach_to_process (state_t *state)
free (cmd);

state->plugins[Dbg]->win->buff_data->new_data = true;
ret = update_window (Dbg, state);
ret = update_window (Dbg);
if (ret == FAIL) {
pfemr (ERR_UPDATE_WINS);
}
Expand Down
6 changes: 3 additions & 3 deletions src/get_form_input/breakpoints.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ insert_breakpoint (state_t *state)
}
free (cmd);

ret = update_windows (state, 2, Brk, Src);
ret = update_windows (2, Brk, Src);
if (ret == FAIL) {
pfemr (ERR_UPDATE_WIN);
}
Expand Down Expand Up @@ -84,7 +84,7 @@ delete_breakpoint (state_t *state)
}
free (cmd);

ret = update_windows (state, 2, Brk, Src);
ret = update_windows (2, Brk, Src);
if (ret == FAIL) {
pfemr (ERR_UPDATE_WIN);
}
Expand Down Expand Up @@ -129,7 +129,7 @@ clear_all_breakpoints (state_t *state)
}
state->breakpoints = NULL;

ret = update_windows (state, 2, Brk, Src);
ret = update_windows (2, Brk, Src);
if (ret == FAIL) {
pfemr (ERR_UPDATE_WIN);
}
Expand Down
2 changes: 1 addition & 1 deletion src/get_form_input/execute_until.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ execute_until (state_t *state)

state->plugins[Dbg]->win->buff_data->new_data = true;
state->plugins[Prg]->win->buff_data->new_data = true;
ret = update_windows (state, 8, Dbg, Prg, Src, Asm, Brk, LcV, Reg, Wat);
ret = update_windows (8, Dbg, Prg, Src, Asm, Brk, LcV, Reg, Wat);
if (ret == FAIL) {
pfemr (ERR_UPDATE_WINS);
}
Expand Down
2 changes: 1 addition & 1 deletion src/get_form_input/run_custom_command.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ run_custom_command (state_t *state)

state->plugins[Dbg]->win->buff_data->new_data = true;
state->plugins[Prg]->win->buff_data->new_data = true;
ret = update_windows (state, 8, Dbg, Prg, Asm, Brk, LcV, Reg, Wat, Src);
ret = update_windows (8, Dbg, Prg, Asm, Brk, LcV, Reg, Wat, Src);
if (ret == FAIL) {
pfemr (ERR_UPDATE_WINS);
}
Expand Down
6 changes: 3 additions & 3 deletions src/get_form_input/watchpoints.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ insert_watchpoint (state_t *state)
watch->next = NULL;
}

ret = update_window (Wat, state);
ret = update_window (Wat);
if (ret == FAIL) {
pfemr ("Failed to update watchpoint window");
}
Expand Down Expand Up @@ -101,7 +101,7 @@ delete_watchpoint (state_t *state)
watch = watch->next;
}

ret = update_window (Wat, state);
ret = update_window (Wat);
if (ret == FAIL) {
pfemr (ERR_UPDATE_WIN);
}
Expand All @@ -126,7 +126,7 @@ clear_all_watchpoints (state_t *state)
}
state->watchpoints = NULL;

ret = update_window (Wat, state);
ret = update_window (Wat);
if (ret == FAIL) {
pfemr (ERR_UPDATE_WIN);
}
Expand Down
61 changes: 0 additions & 61 deletions src/insert_output_marker.c

This file was deleted.

18 changes: 0 additions & 18 deletions src/insert_output_marker.h

This file was deleted.

Loading

0 comments on commit 71535f5

Please sign in to comment.