- Online Community Forums » Installation, Setup & Configuration » Problem with GDB on Devcpp

This thread is locked; no one can reply to it. rss feed Print
Problem with GDB on Devcpp
Sophat Pheng
Member #5,774
April 2005

I was wondering why GDB is running fine let's say for a simple program like this

int main()
   int i;
   // do some stuff
   i = 3;
   i+= 5;
   return 0;

but isn't working with my allegro program. I got a segmentation fault.

1#include <allegro.h>
3int main() {
4 int depth, res;
5 allegro_init();
6 depth = desktop_color_depth();
7 if (depth == 0) depth = 32;
8 set_color_depth(depth);
9 res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
10 if (res != 0) {
11 allegro_message(allegro_error);
12 exit(-1);
13 }
14 install_keyboard();
16 while (!key[KEY_ESC]) {
17 /* put your code here */
18 }
20 allegro_exit();
21 return 0;

I have enable "Generate debugging information"
I am compiling with -Wall -g and I am linking to liballd.a

Help please.
Thanks in advance

January 2001

Code looks fine. Are you debugging step by step and it throws the exception, or it throws when trying to run it with F5?

Mitsuko's last words, Battle Royale

Sophat Pheng
Member #5,774
April 2005

When i'm not debugging, it runs fines but it throws the error when I'm doing step-by-step (shift+F4) or simply debut (F8)

Im using Devcpp (beta 5 release 9) could that be the problem ?

I've just uninstall everything and I reinstalled Mingw32 3.1.0-1 and devcpp without mingw. I switch from allegro 4.2 to allegro 4.03 and I compiled the profile, debug and release version of the library. GDB version is 5.2.1
It still doesn't work and I'm running out of ideas... :'(

Member #2,981
December 2002

Well... showing us the full source and telling us what line it tells you the segfault is at would help.

Sophat Pheng
Member #5,774
April 2005

Well the code I posted is actually the full source. Also, wherever I put my breakpoint, a segmentation fault happens.

I'm running on XP.

I fount out in other threads that I'm not the only one having this problem and maybe GDB is at fault since it wasn't made to run on windows. Any advices are still appreciated.

Kitty Cat
Member #2,815
October 2002

Yes, GDB in Windows isn't the most stable thing in the world. Seems to be a recurring problem for MinGW users.

"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Member #3,861
September 2003

I've never had problem with it under windows ... But I think I got teh fluid ;-p

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Arthur Kalliokoski
Second in Command
February 2005

I see you're not setting GFX_TEXT before calling allegro_message if failing to set a graphic mode. Also, I thought there was an issue about installing keyboard before as well?

Can the example programs set GFX_AUTODETECT_WINDOWED 640 480 @ 32bpp?

“Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.”

― Robert A. Heinlein

Go to: