Thread: mingw32 GDB No line information problem.

  1. #1
    Registered User
    Join Date
    Dec 2017
    Posts
    22

    mingw32 GDB No line information problem.

    Hello!

    I have this make file:

    Code:
    #===========================Basic Macros===========================#
    COMPILER    = gcc
    
    
    INCLUDES    = -IDependencies/SDL2-2.0.7/i686-w64-mingw32/include/SDL2 \
    			  -IDependencies/SDL2_image-2.0.2/i686-w64-mingw32/include/SDL2 \
    			  -IDependencies/SDL2_ttf-2.0.14/i686-w64-mingw32/include/SDL2 \
    			  -IDependencies/SDL2_mixer-2.0.2/i686-w64-mingw32/include/SDL2
    
    
    LIBRARIES   = -LDependencies/SDL2-2.0.7/i686-w64-mingw32/lib \
    			  -LDependencies/SDL2_image-2.0.2/i686-w64-mingw32/lib \
    			  -LDependencies/SDL2_ttf-2.0.14/i686-w64-mingw32/lib \
    			  -LDependencies/SDL2_mixer-2.0.2/i686-w64-mingw32/lib
    
    
    CFLAGS      = -g -Wall -c
    LINKS       = -lmingw32 -lSDL2main -lSDL2 -lSDL2_image -lSDL2_ttf -lSDL2_mixer
    #===========================Basic Macros===========================#
    
    
    
    
    #Objects.
    OBJECTS = main.o Core.o Window.o Events.o
    
    
    all: main.exe
    
    
    #Linking Everything.
    main.exe: $(OBJECTS)
    	$(COMPILER) $(LIBRARIES) -o main $(OBJECTS) $(LINKS)
    
    
    
    
    #================================Compiling Source Files================================#
    
    
    main.o: main.c TUC_Engine.h
    	$(COMPILER) $(INCLUDES) $(CFLAGS) main.c -o main.o
    
    
    Core.o: Core.c Core.h
    	$(COMPILER) $(INCLUDES) $(CFLAGS) Core.c -o Core.o
    
    
    Window.o: Window.c Window.h
    	$(COMPILER) $(INCLUDES) $(CFLAGS) Window.c -o Window.o
    
    
    Events.o: Events.c Events.h
    	$(COMPILER) $(INCLUDES) $(CFLAGS) Events.c -o Events.o
    
    
    #================================Compiling Source Files================================#
    
    
    
    
    #Clean Rule.
    #Remove .o and .exe files.
    clean:
    	del *.o *.exe
    When i run main with gdb i get this:
    Code:
    (gdb) b main
    Breakpoint 1 at 0x404510
    (gdb) r
    Starting program: C:\Users\Popara\Documents\Programming\c\TUC_Engine/main.exe
    [New Thread 5332.0x1024]
    
    
    Breakpoint 1, 0x00404510 in main ()
    (gdb) n
    Single stepping until exit from function main,
    which has no line number information.
    [New Thread 5332.0x77c]
    [New Thread 5332.0x1428]
    [New Thread 5332.0x550]
    [New Thread 5332.0x898]
    [New Thread 5332.0x107c]
    [New Thread 5332.0x4bc]
    [New Thread 5332.0x1378]
    [New Thread 5332.0x154c]
    [New Thread 5332.0x16e4]
    [New Thread 5332.0x1358]
    [New Thread 5332.0x1334]
    [New Thread 5332.0x1154]
    0x00401288 in __register_frame_info ()
    (gdb)
    I tried to make a simple hello world program and run it with gdb and it works.

    I'm probably doing something wrong in the makefile or because i'm using shared libraries has to do something with it.

    Does anyone know what is wrong?

    Thanks

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Try passing -g to the linker as well.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Dec 2017
    Posts
    22
    Quote Originally Posted by Salem View Post
    Try passing -g to the linker as well.
    I tried it, the result is the same

    I also tried to compile it in a single line like this:
    Code:
    gcc <include paths> <link paths> -g -Wall -o main <source files> <shared_files>
    But i get the same result.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Another thing to try is using the flag -ggdb to ensure debug information is in gdb format.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Dec 2017
    Posts
    22
    Quote Originally Posted by Salem View Post
    Another thing to try is using the flag -ggdb to ensure debug information is in gdb format.
    I tried to use -ggdb both in the CFLAGS and in the LINKFLAGS and also i combined -g and -ggdb together but no luck, still the same

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem retrieving information from a file line by line.
    By inu11byte in forum C Programming
    Replies: 5
    Last Post: 11-12-2012, 04:31 PM
  2. client is only receiving one line of information
    By csharp100 in forum Networking/Device Communication
    Replies: 5
    Last Post: 05-03-2012, 06:24 PM
  3. Replies: 1
    Last Post: 06-05-2009, 05:57 PM
  4. Replies: 5
    Last Post: 02-14-2009, 12:27 PM
  5. MingW32???
    By cozman in forum Windows Programming
    Replies: 0
    Last Post: 10-08-2001, 08:23 PM

Tags for this Thread