Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS

ReactOS Community > ReactOS Wiki

Roswin.gdb

From ReactOS

Jump to: navigation, search
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
      set $i = 0
      while (((char *)$modname)[$i] != '.' && ((char *)$modname)[$i] != 0)
           set $i = $i + 1
      end
      if (((char *)$modname)[$i] == '.')
           set ((char *)$modname)[$i] = 0
      end
      log_to_file findsym.cmd
          printf "for /f \"usebackq\" %%%%i in (`dir /s /b d:\\reactos\\output-i386\\%s.nostrip.*`) do (\nset x=\"%%%%i\"\nset y=!x:\\=/!\necho add-symbol-file !y! 0x%x\n) >> findsym.gdb\n", $modname, $modaddr
      end_log
      shell cmd /e:on /v:on /c .\findsym.cmd
end

define copy-module-name
      set $ndx     = 0
      while (((LDR_DATA_TABLE_ENTRY*)$modinf)->BaseDllName.Buffer[$ndx])
              set ((char *)$name)[$ndx] = ((LDR_DATA_TABLE_ENTRY*)$modinf)->BaseDllName.Buffer[$ndx]
              set $ndx = $ndx + 1
      end
      set ((char *)$name)[$ndx] = 0
end

define load-all-modules
      set $stack_space = $esp - 1024
      set $name    = $stack_space

      set $modinf = PsLoadedModuleList->Flink
      set $modinf = ((PLIST_ENTRY)$modinf)->Flink

      shell del /q findsym.gdb

      while ($modinf != &PsLoadedModuleList)
              copy-module-name
              printf "Loading symbols for %s\n", ((char *)$name)
              load-module-nostrip $name (((PLDR_DATA_TABLE_ENTRY)$modinf)->DllBase+0x1000)
              set $modinf = ((PLIST_ENTRY)$modinf)->Flink
      end
      source findsym.gdb
end

define print-modules
      set $stack_space = $esp - 1024
      set $name    = $stack_space

      set $modinf = PsLoadedModuleList->Flink

      while ($modinf != &PsLoadedModuleList)
              copy-module-name
              printf "%s \t(%08x)\n", ((char *)$name), (((PLDR_DATA_TABLE_ENTRY)$modinf)->DllBase+0x1000)
              set $modinf = ((PLIST_ENTRY)$modinf)->Flink
      end
end