• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
SuperVGA

Are segfaults normal when project hasn't been cleaned for a while?

7 posts in this topic

Hi everyone,

I'm working on a project from three machines, using one machine most of the time.
Yesterday, after adding a new member variable to a class, the project compiled but then crashed.
Usually, I wouldn't hesitate to take the blame.

It's very-very rare I make the compiler or environment behave wrong.
I code stupid, make things easy for myself when possible.

I tried debugging to find the source of the segfault. I found that it seemingly occurred in std::map::insert(val, key), and traced upwards. Everything had been initialized. Val referenced something created elsewhere, I thought it looked good. Key was a copy since the parameter. I hadn't touched this area of my code for over two months...
There were no dangling pointers (no pointers, even) to be found in my main units, so I thought it had something to do with the member variable. (Being the last change I committed, this should be the prime suspect)

The class that I added the variable to contained an object which in turn contained the std::map, so I thought to myself, that maybe the change in the header file didn't trigger a build of new .os that should depend on it. When I created my own build tool, I didn't check the headers for modifications, and unless I changed the implementation file too, I'd often end up with having to clean build, or everything would crash.

Sure enough, a clean build fixed the error. But is Netbeans supposed to miss a significant change like a new member variable, without recompiling the unit+dependent units?

Do you guys experience this too from time to time? It's been weeks since I last encountered a segfault,
and now I'm worried that perhaps I'm doing something wrong. Edited by SuperVGA
0

Share this post


Link to post
Share on other sites

Anything with an "edit and continue" type feature I've found will sometimes miss-patch the partial build.  It's rather flaky as to when I've seen this type of thing happen, but it's very annoying when it does.

2

Share this post


Link to post
Share on other sites

in my experience, a seg-fault cropping up/disappearing with a clean is resonate of a much deeper problem in the code base.

 

This is not to say it very well might be an issue with a bad build, but in general, i've almost always discovered their to be an actual flaw in my code somewhere after heavy analyzing(something that only cropped up because the compiler didn't null all my pointers(and i forgot to explicity set a pointer to null) for me for some reason, or was allowing buffer-overflow's that didn't cause immidiate crash's)

 

edit after L. Spiro's/Karsten_'s posts, i'd like to point out that i only use a single machine for compilation, and i use VS 2010, which auto-detects header changes, and appropriately re-compiles the obj's that include the headers, which is probably why i more often experience such things in form of actual bugs, than bad build's.

Edited by slicer4ever
2

Share this post


Link to post
Share on other sites

That’s not been my experience (to slicer4ever).

 

Doing a clean build removes .OBJ files from different versions of compilers and this can have a profound effect on the stability of the resulting .EXE.

I even have the same compiler on both my Windows XP and Windows 7 installs, same service packs, etc.  But when I switch between Windows XP and Windows 7 I really have to do a clean or I am guaranteed to get segment faults and other strange behavior.

Many times in the most isolated areas I have been able to prove the code was correct.  A clean rebuild became part of my routine and I no longer suspect any underlying issues with the code.

 

As for the original poster, if you work with your code between different machines, save yourself some hassle and get into the habit of cleaning each time you copy the code and project to a new machine.  Once again, for me, failure to do so always results in some kind of crazy run-time crash that makes no sense.

 

 

L. Spiro

Edited by L. Spiro
1

Share this post


Link to post
Share on other sites

Usually IDEs deal with this sort of thing using .d files.

 

Basically when you change a header and add something like an std::string to it, you really should compile every unit (.cpp file) that has a dependence on that header.

 

I believe this is because otherwise the space for the new variable is not reserved properly from those objects.

 

I have this issue when using Makefiles but rather than fix the issue (making the build system quite a bit more complex), I just detect whether a header has changed and rebuild the whole thing.

1

Share this post


Link to post
Share on other sites

I'm with LSpiro here, have frequently had issues that were nothing to do with code and simply due to the IDE/Build System failing to rebuild an object file that it should have.

 

Qt's PRO system suffers from this quite often. Guess it is hard to get a dependency system right.

1

Share this post


Link to post
Share on other sites
Thanks for your input everyone. Actually, LSpiro and Aaardvajk,
I don't even have my obj/ shared. The only thing I did of those sorts was to not clean build for a long time.
On my repo, i only have src, doc and bin/ (for scripts and assets)
And thus no obj + dist files are shared.
I have my makefiles, .nbproject (and perhaps d files as well), though.

Perhaps it tends to be a makefile-related thing?
Slicer4Evers use of MSVC could support this...
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0