Wow, bisect is awesome. Thanks, Kevin. And the winner is:
Cataclysm-DDA ((no branch))$ git bisect bad
51af914b18b153c38d487d8a8d066d7133743d4b is the first bad commit
commit 51af914b18b153c38d487d8a8d066d7133743d4b
Author: C0DEHERO codehero@nerdpol.ch
Date: Sat Oct 5 11:34:48 2013 -0400
Added tileset option to the option menu. The options will be populated dynamically with the tilesets in gfx/. Tilesets should be in their own folder and should have a tileset.tif. Examples of those tileset.tif are in the tileset folders in gfx/
:100644 100644 2aa1d1c68a536b2aa41ef6dabd10631741ea5192 b96cb1ae387e9ba4b018e2c76ea7a4a7d28b7758 M cata_tiles.cpp
:100644 100644 7c001b66a56b734f1969daf9f5523c30c68f9ec3 e800dc4146b3421a68465abf245d978293036aaf M cata_tiles.h
:040000 040000 c73e803cfa62d78d6246c6f6018eb6edb20c45d6 6bf3848be7b7b4d2df4b18f34e79fde67ed60d01 M data
:040000 040000 ca212df6f758a8283e9e6748880701d5b10754db e14e0a695c4cf44efbd5c4e2cf58b06b1fa3ef5b M gfx
:100644 100644 48f82b30bc2b7cf86daa3da2684d7ff9093af29c cb5c87f08b26201c0a54541d24d798be60fc9507 M options.cpp
:100644 100644 6ca21223a04d7669b46e39eee30dd391f0b73a3a c778ceb1b60ff944758bbc7af6d450a1c86a3ea6 M options.h
:100644 100644 6102b34964a786711f7eaad263b6d96ee8b44e29 4255525eafc1b6d94651c07032bd8eda83f20a2c M sdltiles.cpp
So where do we go from here? I was looking at the commit, and a big chunk of it is reading in filenames. I wonder if the approach used is Windows specific somehow. Or it could be that there is some sort of implicit assumption that SDL is being used that causes a break in the non-SDL version.
Anyone see what’s going on? Thanks in advance!
EDIT: I figured out how to use gdb a little. Here is the backtrace:
(gdb) backtrace
#0 0x00007fff8a736162 in closedir ()
#1 0x00000001001a8b5a in file_finder::get_files_from_path (extension=@0x7fff5fbfa4f8, root_path=@0x7fff5fbfa4f0, recursive_search=true) at file_finder.cpp:73
#2 0x000000010084182c in get_tileset_names (dir_path=@0x7fff5fbfb738) at options.cpp:851
#3 0x00000001008447ef in initOptions () at options.cpp:315
#4 0x00000001004b38cb in main (argc=0, argv=0x7fff5fbff978) at main.cpp:66
EDIT2: stepping through
68 subdir = opendir(subpath.c_str());
(gdb)
69 if (subdir)
(gdb)
73 closedir(subdir);
(gdb)
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x00007fff8a736162 in closedir ()
The function successfully crawls Deon’s and Hoder’s tilesets. It dies when it gets to the end. It looks like subdir is an empty pointer:
(gdb) p subdir
$1 = (DIR *) 0x0
Thus the segfault.
EDIT 3:
I think this was a simple fix. PR is here