Sublime Forum

Sublime beginner gdb not working (solved)

#1

Sublime text looks like a real nice code editor, but before I buy it, I want it to get it work just right.

First I had problems with sublime linter, but after some reading I solved that. And now I try to get the debugger to work, but so var no luck.

I run sublime text build:4169.

My project file :

{
	"folders":
	[
		{
			"path": ".",
		},
		{
			"path": "src"
		},
	],
	"settings":
    {
        "sublimegdb_workingdir": "${folder:${project_path:/bin/helo}}",
        // NOTE: You MUST provide --interpreter=mi for the plugin to work
        "sublimegdb_commandline": "gdb --interpreter=mi ./home/bert/c/helotest/bin/helo"
    
    }
}

and my makefile:

# List your source and build output directories:
SRC_DIR := src
OBJ_DIR := obj
BIN_DIR := bin

# Name your final target, that is, your executable:
EXE := $(BIN_DIR)/helo test

# List your source files:
SRC := $(wildcard $(SRC_DIR)/*.c)

#From the source files, list the object files:
OBJ := $(SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)

#handle the flags
CPPFLAGS := -Iinclude -MMD -MP  # -I is a preprocessor flag, not a compiler flag
CFLAGS   := -Wall -g3              # some warnings about bad code
LDFLAGS  := -Llib               # -L is a linker flag
LDLIBS   := -lm                 # Left empty if no libs are needed

# so make will not think it must create a file or folder named  and clean
.PHONY: all clean

all: $(EXE)

$(EXE): $(OBJ) | $(BIN_DIR)
	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@

$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c | $(OBJ_DIR)
	$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@

#create bin dir and obj dir if they dont exist
$(BIN_DIR) $(OBJ_DIR):
	mkdir -p $@

clean:
	@$(RM) -rv $(BIN_DIR) $(OBJ_DIR)

-include $(OBJ:.o=.d) # The dash silences errors when files don't exist (yet)

First I set a breakpoint with f9 and then I start the debugger with f5.

I get the following error message:


I would appreciate it if someone could help me get this to work, so I can move on to the next problem (Doxygen doesn’t do what I expect it to do, and figuring out how to best template a project)
Kind regards, Bert.

0 Likes

#2

I am currently using the following settings in my project file to get it working:

{
	"folders":
	[
		{
			"path": ".",
		},
		{
			"path": "src"
		},
	],
	
	

	 "settings":
     {
        "sublimegdb_workingdir": "/home/bert/c/helotest/bin",
        "sublimegdb_arguments": "",
        "sublimegdb_commandline": "gdb --interpreter=mi --args ./helo"
     }
}
0 Likes