Technical support > Mac

Log of an attempt to compile a universal binary for 10.5.6 for 2.3-dev (trunk)

<< < (4/5) > >>

keybounce:
I am the first to admit that I do not know what to look for. But, playing around with GDB, I found something that looks interesting.

It looks like the map data is being generated bad.

--- Code: ---(gdb) down
#0  0x00147458 in TR_TestBoxInBrush (trace_data=0xbfffa3bc, brush=0x1062e9bc) at src/common/tracing.c:800
800 plane = side->plane;
(gdb) down
Bottom (i.e., innermost) frame selected; you cannot go down.
(gdb) list
795 return;
796
797 for (i = 0; i < brush->numsides; i++) {
798 side = &myTile->brushsides[brush->firstbrushside + i];
799 #ifdef COMPILE_UFO
800 plane = side->plane;
801 #else
802 plane = myTile->planes + side->planenum;
803 #endif
804
(gdb) p i
$15 = 0
(gdb) p side
$16 = (cBspBrushSide_t *) 0x3a8ab02c
(gdb) p *side
Cannot access memory at address 0x3a8ab02c

(gdb) p *brush
$17 = {
  contentFlags = 16777216,
  numsides = 134217728,
  firstbrushside = 571998208,
  checkcount = 1
}

(gdb) up
#1  0x00147a30 in TR_TestInLeaf (trace_data=0xbfffa3bc, leafnum=11) at src/common/tracing.c:900
900 TR_TestBoxInBrush(trace_data, b);
(gdb) list
895 continue; /* already checked this brush in another leaf */
896 b->checkcount = checkcount;
897
898 if (!(trace_data->contents && b->contentFlags & trace_data->contents) || (b->contentFlags & trace_data->rejects))
899 continue;
900 TR_TestBoxInBrush(trace_data, b);
901 if (!trace_data->trace.fraction)
902 return;
903 }
904 }
(gdb) p b
$18 = (cBspBrush_t *) 0x1062e9bc
(gdb) p *b
$19 = {
  contentFlags = 16777216,
  numsides = 134217728,
  firstbrushside = 571998208,
  checkcount = 1
}

877 static void TR_TestInLeaf (boxtrace_t *trace_data, int leafnum)
878 {
879 int k;
880 const TR_LEAF_TYPE *leaf;
881 TR_TILE_TYPE *myTile = trace_data->tile;
882
883 assert(leafnum > LEAFNODE);
884 assert(leafnum <= myTile->numleafs);
(gdb)
885
886 leaf = &myTile->leafs[leafnum];
887 if (!(leaf->contentFlags & trace_data->contents) || (leaf->contentFlags & trace_data->rejects))
888 return;
889
890 /* trace line against all brushes in the leaf */
891 for (k = 0; k < leaf->numleafbrushes; k++) {
892 const int brushnum = myTile->leafbrushes[leaf->firstleafbrush + k];
893 cBspBrush_t *b = &myTile->brushes[brushnum];
894 if (b->checkcount == checkcount)
(gdb) p brushnum
$20 = 537
(gdb) p leaf
$21 = (const cBspLeaf_t *) 0x29c6f084
(gdb) p *leaf
$22 = {
  contentFlags = 1,
  firstleafbrush = 2,
  numleafbrushes = 1
}

Leaf looks good, but brushnum looks bad. So part of trace_data looks good, and part of it scrambled.

(gdb) p myTile
$23 = (mapTile_t *) 0x5bfbf54
(gdb) p *myTile
$24 = {
  name = "wilderness", '\0' <repeats 53 times>,
  numbrushsides = 8155,
  brushsides = 0x29cab02c,
  numtexinfo = 1767,
  surfaces = 0x29c4e02c,
  numplanes = 9290,
  planes = 0x29c7d02c,
  numnodes = 6939,
  nodes = 0x29cbb02c,
  numleafs = 6946,
  leafs = 0x29c6f02c,
  emptyleaf = 1,
  numleafbrushes = 2598,
  leafbrushes = 0x1062b22c,
  nummodels = 258,
  models = 0x2950902c,
  numbrushes = 732,
  brushes = 0x1062c82c,
  box_planes = 0x29caa5f4,
  box_headnode = 6939,
  box_brush = 0x1062f5ec,
  box_leaf = 0x29c7c93c,
  tnodes = 0x29cf902c,
  numtheads = 6,
  thead = {0, 24, 920, 1680, 6412, 6478, 0 <repeats 252 times>},
  theadlevel = {0 <repeats 258 times>},
  numcheads = 153,
  cheads = {{
      cnode = 0,
      level = 0
    }, {
      cnode = 17,
      level = 0
    }, {
      cnode = 24,
      level = 252
    }, {
      cnode = 157,
      level = 252
    }, {
      cnode = 331,
      level = 252
    }, {
      cnode = 361,
      level = 252
    }, {
... snip ...
    }, {
      cnode = 6922,
      level = 257
    }, {
      cnode = 6928,
      level = 257
    }, {
      cnode = 0,
      level = 0
    } <repeats 65383 times>},
  wpMins = {128, 118, 0},
  wpMaxs = {193, 197, 7}
}

There's enough obvious meaningful information in there that I don't suspect an invalid pointer, but some of the data in there is invalid -- it's crashing in the next subroutine down.

(gdb) p k
$25 = 0
(gdb) p leafnum
$26 = 11
(gdb) p leaf
$27 = (const cBspLeaf_t *) 0x29c6f084
(gdb) p *leaf
$28 = {
  contentFlags = 1,
  firstleafbrush = 2,
  numleafbrushes = 1
}
(gdb) p brushnum
$29 = 537

Looks a little high

Some earlier looking around:

(gdb) up
#2  0x00148720 in TR_BoxTrace (tile=0x5bfbf54, start=0xbfffba10, end=0xbfffba10, mins=0xbfffb9f8, maxs=0xbfffba04, headnode=0, brushmask=-1, brushreject=0, fraction=2) at src/common/tracing.c:1106
1106 TR_TestInLeaf(&trace_data, leafs[i]);
(gdb) list
1101 c2[i] += 1;
1102 }
1103
1104 numleafs = TR_BoxLeafnums_headnode(&trace_data, c1, c2, leafs, MAX_LEAFS, headnode, &topnode);
1105 for (i = 0; i < numleafs; i++) {
1106 TR_TestInLeaf(&trace_data, leafs[i]);
1107 if (trace_data.trace.allsolid)
1108 break;
1109 }
1110 VectorCopy(start, trace_data.trace.endpos);
(gdb) p i
$12 = 4
(gdb) p numleafs
$13 = 11
(gdb) p leafs
$14 = {1, 6, 8, 10, 11, 12, 13, 14, 15, 17, 18, 0, 0, 0, 0, -- snip --

--- End code ---
Numleafs looks good, and this isn't the first time through the loop. So the data seems to be partially valid, and partially invalid.

As a side note: Do not use "i" as an array subscript. Reason: The notation "[ i ]" in code triggers bbcode ...

Mattn:
the brush num doesn't look bad - i mean 537 isn't really that high.

if you activate the developer mode (developer cvar to 1) you can see how many nodes, leafs brushes and so on are loaded on map start. please try to compare them with the numsides, numbrushes, numleafs and so on. i had a look too, and i can't find any missing endian swap for the bsp data. maybe there is some memory corruption. did you ever use valgrind (is it even available for macosx?). if you could run it in valgrind (execute ./contrib/scritps/valgrind.sh ufo from trunk/), please send the output (but be warned, it's damn slow in valgrind ;))

did you compile the wilderness map yourself?

keybounce:
Valgrind turned out to be real fast:
Kleiman-ibook:trunk michael$ ./contrib/scripts/valgrind.sh ufo
readlink: illegal option -- f
usage: readlink [-n] [file ...]
 is no executable
Kleiman-ibook:trunk michael$

Kleiman-ibook:trunk michael$ valgrind
-bash: valgrind: command not found
Kleiman-ibook:trunk michael$ man valgrind
No manual entry for valgrind

I don't think it's there.

Yes, I compiled wilderness myself.
===

Now a question on "make maps" versus "./ufo2map". "Make maps" normally adds in "-extra", and we were told by another mac developer that it takes about 5 days. I have used ./ufo2map, without -extra; when I removed that from the makefile, it only took overnight.

I'm going to try a map with -extra, and see what that's like.

keybounce:
I think something got missed on a recent check-in:

This is from a make clean.

...
 * [GAM] src/game/lua/lvm.c
 * [GAM] src/game/lua/lzio.c
 * [GAM] src/game/lua/print.c
 * [GAM] ... linking -rdynamic ()
Undefined symbols:
  "_AI_Cleanup", referenced from:
      _G_EndGame in g_main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Undefined symbols:
  "_AI_Cleanup", referenced from:
      _G_EndGame in g_main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/rE/rEdMXgrOG7WDErrJmyTTEE+++TM/-Tmp-//ccYDb4iZ.out (No such file or directory)
make: *** [base/game.dylib] Error 1
Kleiman-ibook:trunk michael$ svn up
At revision 23625.
Kleiman-ibook:trunk michael$

keybounce:
Alright, if you can tell me what to look for, I can provide you with any information you want. I've got a null pointer dereference right now.

Svn: 23627.
All maps compiled locally.
"Wilderness" compiled with -extra

Currently sitting there in GDB, waiting for instructions.

--- Code: ---.. done
S_Music_Start: Playing music: 'music/van_theme'
R_RegisterModelShort: Could not find: 'weapons/autocannon/autocannon'
CL_LanguageInit: language settings are stored in configuration: en
...using language: en_US.UTF-8
SDL_ttf version 2.0.9 - we need at least 2.0.7
...registering 10 fonts
126 static models loaded
====== UFO Initialized ======

Switch grab input off
Reading symbols for shared libraries .. done
Reading symbols for shared libraries . done
r console
Unknown command "r" - wasn't sent to server
r_checkerror 1
r_programs 0
r_developer 1
Unknown command "r_developer" - wasn't sent to server
developer 1
^C
Program received signal SIGINT, Interrupt.
0x92f17d20 in select$DARWIN_EXTSN ()
(gdb) break CM_AddMapTile
Breakpoint 1 at 0x11f26c: file src/common/cmodel.c, line 1033.
(gdb) c
Continuing.
ExecuteString: '+leftmouse 200 626573'
ExecuteString: 'mn_push singleplayer'
ExecuteString: ''
ExecuteString: '-leftmouse 200 626747'
ExecuteString: '-select 200 626747'
ExecuteString: '+leftmouse 200 641034'
ExecuteString: 'mn_push skirmish'
ExecuteString: ''
ExecuteString: 'game_setmode'
Change gametype to 'Skirmish mode'
ExecuteString: 'set ai_numaliens 8'
ExecuteString: 'set difficulty 0'
ExecuteString: ''
ExecuteString: 'set mn_serverday 1'
ExecuteString: 'mn_getmaps'
ExecuteString: ''
ExecuteString: '-leftmouse 200 641546'
ExecuteString: '-select 200 641546'
ExecuteString: '+leftmouse 200 645356'
ExecuteString: 'mn_prevmap'
ExecuteString: ''
ExecuteString: '-leftmouse 200 645490'
ExecuteString: '-select 200 645490'
ExecuteString: '+leftmouse 200 650140'
ExecuteString: 'sk_start'
Could not find rank 'rifleman'
No valid name definitions for gender 0 in category 'phalanx'
Could not find rank 'rifleman'
Could not find rank 'rifleman'
Could not find rank 'rifleman'
Could not find rank 'rifleman'
No valid name definitions for gender 0 in category 'phalanx'
Could not find rank 'rifleman'
Could not find rank 'rifleman'
Could not find rank 'rifleman'
No valid name definitions for gender 0 in category 'phalanx'
ExecuteString: ''
ExecuteString: 'map day wilderness '
Set server state to 0
------- Loading game.dylib -------
Reading symbols for shared libraries . done
LoadLibrary (./base/game.dylib)
==== InitGame ====
SpawnServer: wilderness
Set server state to 0
CM_LoadMap: token: wilderness

Breakpoint 1, 0x0011f26c in CM_AddMapTile (name=0xbfffbde0 "wilderness", day=qtrue, sX=0, sY=0, sZ=0 '\0') at src/common/cmodel.c:1033
1033 {
(gdb) # First call
Current language:  auto; currently c
(gdb) c
Continuing.
CM_AddMapTile: wilderness at 0,0,0
...surfaces: 1767
...leafs: 6946
...leafbrushes: 2598
...planes: 9290
...brushes: 732
...brushsides: 8155
...submodels: 258
...nodes: 6939
Map:wilderness  Offset:(0, 0, 0)
wpMins:(128, 118, 0) wpMaxs:(193, 197, 7)
Shifted wpMins:(128, 118, 0) wpMaxs:(193, 197, 7)
Tile bounds: (128, 118, 0) to (193, 197, 7)
Source bounds: (128, 118, 0) to (193, 197, 7)
Done copying data.

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
0x0014839c in TR_TestBoxInBrush (trace_data=0xbfffa3bc, brush=0x10613dbc) at src/common/tracing.c:808
808 if (plane->normal[j] < 0)
(gdb) p j
$1 = 0
(gdb) p plane
$2 = (cBspPlane_t *) 0x0
(gdb) bt
#0  0x0014839c in TR_TestBoxInBrush (trace_data=0xbfffa3bc, brush=0x10613dbc) at src/common/tracing.c:808
#1  0x00148950 in TR_TestInLeaf (trace_data=0xbfffa3bc, leafnum=11) at src/common/tracing.c:899
#2  0x00149640 in TR_BoxTrace (tile=0x5bfcf54, start=0xbfffba10, end=0xbfffba10, mins=0xbfffb9f8, maxs=0xbfffba04, headnode=0, brushmask=-1, brushreject=0, fraction=2) at src/common/tracing.c:1105
#3  0x00149f50 in TR_TileBoxTrace (myTile=0x5bfcf54, start=0xbfffba10, end=0xbfffba10, mins=0xbfffb9f8, maxs=0xbfffba04, levelmask=511, brushmask=-1, brushreject=0, fraction=2) at src/common/tracing.c:1237
#4  0x0014a70c in TR_CompleteBoxTrace (start=0xbfffba10, end=0xbfffba10, mins=0xbfffb9f8, maxs=0xbfffba04, levelmask=511, brushmask=-1, brushreject=0) at src/common/tracing.c:1319
#5  0x0011d7a4 in CM_EntCompleteBoxTrace (start=0xbfffba10, end=0xbfffba10, mins=0xbfffb9f8, maxs=0xbfffba04, levelmask=511, brushmask=-1, brushreject=0) at src/common/cmodel.c:741
#6  0x0014b578 in RT_GetMapSize (map_min=0x4432014, map_max=0x4432008) at src/common/routing.c:177
#7  0x0011ecd8 in CMod_LoadRouting (name=0xbfffbde0 "wilderness", l=0xbfffbce8, sX=0, sY=0, sZ=0) at src/common/cmodel.c:915
#8  0x0011f8b0 in CM_AddMapTile (name=0xbfffbde0 "wilderness", day=qtrue, sX=0, sY=0, sZ=0 '\0') at src/common/cmodel.c:1107
#9  0x00120434 in CM_LoadMap (tiles=0xbfffbf9a "", day=qtrue, pos=0x0, mapchecksum=0xbfffbed0) at src/common/cmodel.c:1258
#10 0x00157dc8 in SV_SpawnServer (day=qtrue, server=0xbfffbf90 "wilderness", param=0x0) at src/server/sv_init.c:1111
#11 0x001583fc in SV_Map (day=qtrue, levelstring=0xbfffbf90 "wilderness", assembly=0x0) at src/server/sv_init.c:1224
#12 0x00151fd0 in SV_Map_f () at src/server/sv_ccmds.c:187
#13 0x00116d58 in Cmd_ExecuteString (text=0xbffff254 "map day wilderness ") at src/common/cmd.c:912
#14 0x0011524c in Cbuf_Execute () at src/common/cmd.c:229
#15 0x00036f28 in CL_SendCommand () at src/client/cl_main.c:931
#16 0x00037794 in CL_Frame (now=650140, data=0x0) at src/client/cl_main.c:1111
#17 0x00128920 in tick_timer (now=650140, data=0x183a071c) at src/common/common.c:1084
#18 0x00128d44 in Qcommon_Frame () at src/common/common.c:1165
#19 0x0019ccd8 in main (argc=1, argv=0xbffff8ac) at src/ports/macosx/osx_main.m:142
(gdb)
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version