Skip to content

Commit 5a89849

Browse files
stack_walk_windows various 100% (#15)
* stack_walk_windows various 100% * Formatting and correctness --------- Co-authored-by: punpckhdq <121350336+punpckhdq@users.noreply.github.com>
1 parent 237bf67 commit 5a89849

File tree

3 files changed

+70
-2
lines changed

3 files changed

+70
-2
lines changed

config/symbols.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21969,7 +21969,7 @@
2196921969
{ "file_offset": 3001644, "flags": 0, "name": "_data_002dcd2c" },
2197021970
{ "file_offset": 3001648, "flags": 0, "name": "_header_strings" },
2197121971
{ "file_offset": 3001656, "flags": 0, "name": "_format_strings" },
21972-
{ "file_offset": 3001664, "flags": 0, "name": "_data_002dcd40" },
21972+
{ "file_offset": 3001664, "flags": 0, "name": "_stack_walk_globals" },
2197321973
{ "file_offset": 3001688, "flags": 0, "name": "_recorded_animation_event_stream_data" },
2197421974
{ "file_offset": 3001824, "flags": 0, "name": "_recorded_animation_block" },
2197521975
{ "file_offset": 3001872, "flags": 0, "name": "_data_002dce10" },

source/cseries/cseries.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ void debug_free(void *, const char *, long);
157157
void *debug_realloc(void *, unsigned int, boolean, const char *, long);
158158
void debug_dump_memory(void);
159159

160+
/* ---------- prototypes/STACK_WALK_WINDOWS.C */
161+
162+
void stack_walk_disregard_symbol_names(boolean disregard);
163+
160164
/* ---------- macros */
161165

162166
#ifndef BUILDING_CSERIES

source/cseries/stack_walk_windows.c

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,23 +99,87 @@ symbols in this file:
9999
002589E0 0019:
100100
??_C@_0BJ@NNIPHMJN@Mon?5Dec?517?512?349?336?52001?$AA@ (0000)
101101
002DCD40 0014:
102-
_data_002dcd40 (0000)
102+
_stack_walk_globals (0000)
103103
00431C98 4008:
104104
_bss_00431c98 (0000)
105105
*/
106106

107107
/* ---------- headers */
108108

109+
#include "cseries.h"
110+
109111
/* ---------- constants */
110112

111113
/* ---------- macros */
112114

113115
/* ---------- structures */
114116

117+
struct debug_symbol_table
118+
{
119+
long number_of_symbols;
120+
char *string_storage;
121+
struct debug_symbol *symbols;
122+
};
123+
124+
struct debug_symbol
125+
{
126+
unsigned long address;
127+
unsigned long rva_base;
128+
unsigned long name_string_offset;
129+
unsigned long library_object_string_offset;
130+
};
131+
132+
struct _stack_walk_globals
133+
{
134+
long fixup;
135+
boolean disregard_symbol_names;
136+
struct debug_symbol_table symbol_table;
137+
};
138+
115139
/* ---------- prototypes */
116140

117141
/* ---------- globals */
118142

143+
struct _stack_walk_globals stack_walk_globals=
144+
{
145+
NONE,
146+
FALSE
147+
};
148+
119149
/* ---------- public code */
120150

151+
void stack_walk_disregard_symbol_names(
152+
boolean disregard)
153+
{
154+
stack_walk_globals.disregard_symbol_names = disregard;
155+
}
156+
157+
void free_symbol_table(
158+
struct debug_symbol_table *symbol_table)
159+
{
160+
match_assert("c:\\halo\\SOURCE\\cseries\\stack_walk_windows.c", 549, symbol_table);
161+
162+
if (symbol_table->string_storage)
163+
{
164+
debug_free(symbol_table->string_storage, "c:\\halo\\SOURCE\\cseries\\stack_walk_windows.c", 551);
165+
}
166+
167+
if (symbol_table->symbols)
168+
{
169+
debug_free(symbol_table->symbols, "c:\\halo\\SOURCE\\cseries\\stack_walk_windows.c", 552);
170+
}
171+
172+
symbol_table->number_of_symbols= 0;
173+
symbol_table->string_storage= NULL;
174+
symbol_table->symbols= NULL;
175+
}
176+
177+
void stack_walk_dispose(
178+
void)
179+
{
180+
stack_walk_globals.fixup= NONE;
181+
stack_walk_globals.disregard_symbol_names= FALSE;
182+
free_symbol_table(&stack_walk_globals.symbol_table);
183+
}
184+
121185
/* ---------- private code */

0 commit comments

Comments
 (0)