Programmer's Education Index

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Programmer's Education Index

Post by dandymcgee »

Accy wrote: I considered double majoring as a way to widen my options in the job field and was told that it would be a waste of time with good reason. I said a whole page back that I'm not going to do it anymore. I don't really know what point you think I missed.
Apparently none, so we're good. I only meant to make sure you understood what we were saying so you can make your own informed decisions. Sincere apologies if my post came off in the wrong way.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
Accy
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 29
Joined: Tue Jan 28, 2014 11:10 am
Programming Language of Choice: C++
Location: USA

Re: Programmer's Education Index

Post by Accy »

I've been programming quite a bit using SDL2 as of late (on ganoo/linux) and I'm having a bit of an issue. When I run a program that uses an SDL window, I get locked out of the terminal I'm running it from. Thus, I can't use GDB to debug, which sucks because it's my favorite debug tool and I really do not like IDEs.

I was wondering if anyone knew a way I could use SDL with GDB or free up a terminal while running an SDL program? I could conceivably run GDB in emacs, but I found that process confusing

EDIT: I found a solution by fucking around with it. I am surprised no one else on the entire internet seems to have had the same issue.
Anyways, the problem is that I had the generic while( !quit ) style of loop as my main loop, and GDB will seize with this kind of loop regardless of using an X window API or not. What you can do is press ^C in the GDB terminal to kill the loop, which will freeze your game and allow you to use gdb functions. Once you're done, you can use the continue function to pick up where you left off.
User avatar
short
ES Beta Backer
ES Beta Backer
Posts: 548
Joined: Thu Apr 30, 2009 2:22 am
Current Project: c++, c
Favorite Gaming Platforms: SNES, PS2, SNES, SNES, PC NES
Programming Language of Choice: c, c++
Location: Oregon, US

Re: Programmer's Education Index

Post by short »

See if learning more about how GDB works helps :)

edit: My computer seems to be busted and can't copy/paste atm, but just google GDB tutorials
My github repository contains the project I am currently working on,
link: https://github.com/bjadamson
User avatar
Accy
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 29
Joined: Tue Jan 28, 2014 11:10 am
Programming Language of Choice: C++
Location: USA

Re: Programmer's Education Index

Post by Accy »

Yeah, in my edit I talk a bit about my solution. There's really no tutorials that go into this problem, in depth. A little solution I worked out is to put a breakpoint at the start of your main loop. Then disable the breakpoint and continue. When you reach an issue, press ctrl+c to stop execution of the program, enable the breakpoint, continue, and then you have a paused program with GDB in the correct place.

Also, there's this tutorial by rms who is evidently not that rms
http://www.unknownroad.com/rtfm/gdbtut/gdbinfloop.html
Although it's more tailored to fixing an infinite loop rather than working with one, it is rather helpful.
Post Reply