Rossym.gdb
Материал из Русский WINE
rossym.gdb
define log_to_file set logging file $arg0 set logging redirect on set logging overwrite on set logging on end define end_log set logging off end define load-module-nostrip set $modname = $arg0 set $modaddr = $arg1 printf "Loading module symbols at 0x%x\n", $modaddr log_to_file sym.tmp printf "%s\n0x%x", ((char *)$name), $modaddr end_log shell sed -e 's/\..*$//g' < sym.tmp > modname_stripped.txt shell find output-i386 -iname `head -n 1 modname_stripped.txt `'.nostrip.*' > found_mod.txt shell test -s found_mod.txt || find output-i386 -iname `head -n 1 modname_stripped.txt `.'???' -and '(' -name '*.exe' -or -name '*.dll' -or -name '*.sys' -or -name '*.drv' ')' > found_mod.txt log_to_file loadsym.sh printf "echo add-symbol-file `head -n 1 found_mod.txt` `tail -n 1 sym.tmp`" end_log shell (test -s found_mod.txt && sh loadsym.sh) > load_module.gdb source load_module.gdb end define copy-module-name set $ndx = 0 while (((KDB_MODULE_INFO*)$modinf)->Name[$ndx]) set ((char *)$name)[$ndx] = ((KDB_MODULE_INFO*)$modinf)->Name[$ndx] set $ndx = $ndx + 1 end set ((char *)$name)[$ndx] = 0 end define load-all-modules set $stack_space = $esp - 1024 set $modinf = $stack_space set $name = $stack_space + sizeof(KDB_MODULE_INFO) set $index = 1 set $result = KdbpSymFindModuleByIndex($index,$modinf) while ($result != 0) copy-module-name printf "Loading symbols for %s\n", ((char *)$name) load-module-nostrip $name (((PKDB_MODULE_INFO)$modinf)->Base+0x1000) set $index = $index + 1 set $result = KdbpSymFindModuleByIndex($index,$modinf) end end define print-modules set $stack_space = $esp - 1024 set $modinf = $stack_space set $name = $stack_space + sizeof(KDB_MODULE_INFO) set $index = 0 set $result = KdbpSymFindModuleByIndex($index,$modinf) while ($result != 0) copy-module-name printf "%s \t(%08x)\n", ((char *)$name), (((PKDB_MODULE_INFO)$modinf)->Base+0x1000) set $index = $index + 1 set $result = KdbpSymFindModuleByIndex($index,$modinf) end end
.gdbinit
add-symbol-file output-i386/ntoskrnl/ntoskrnl.nostrip.exe source lib/rossym/rossym.gdb target remote :1234 break RosSymInit c fin fin finЗапустите qemu например так
qemu -hda reactos.img -S -s
Вход в отладчик будет происходить позже, а когда вам потребуется загрузить отладочные символы ядра, выполните:
load-all-modules