GithubHelp home page GithubHelp logo

lesderid / gdb-msvc Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 2.0 37.2 MB

GDB with patches for debugging MSVC binaries

Home Page: https://github.com/lesderid/gdb-msvc/

License: GNU General Public License v2.0

Makefile 2.64% Shell 0.78% M4 1.24% C 84.14% Objective-C 3.83% DIGITAL Command Language 0.04% sed 0.01% C++ 3.76% Perl 0.17% Python 0.30% Scheme 2.06% Batchfile 0.01% Emacs Lisp 0.01% Logos 0.17% Yacc 0.42% Lex 0.01% Awk 0.01% Roff 0.13% TeX 0.29% XSLT 0.01%
debugger gdb msvc patches

gdb-msvc's People

Contributors

lesderid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

cjia4

gdb-msvc's Issues

build environment question

hello.
i succeeded compile. but i am having a hard time gdb execution.
i built in WSL build environment.
gdb binary through WSL can read pdb file(symbol-file helloworld.exe read helloworld.pdb)
but gdb binary can not set breakpoint)

///////////////////////////////////////////////////////////////////////////////////////////////
Reading symbols from helloworld.exe...
Reading symbols from /mnt/c/ubuntu/gdb-msvc/build/gdb/helloworld.pdb...
(gdb) b main
Breakpoint 1 at 0x4014c3
(gdb) run
Starting program: /mnt/c/ubuntu/gdb-msvc/build/gdb/helloworld.exe
warning: Selected architecture i386 is not compatible with reported target architecture i386:x86-64
warning: Architecture rejected target-supplied description
Hello World!
[Inferior 1 (process 120) exited normally]
(gdb)
///////////////////////////////////////////////////////////////////////////////////////////////

so i wonder build environment.
i am not good at linux. please help me.

thanks.

PDB loading should be in bfd

Currently, we load PDBs in GDB, but most of this loading code should be moved to bfd.

This is pretty hacky (especially because we're adding symbols as minsyms), and GDB already has support for separate debug files, so we should use it.

PDB debug symbol loading using LLVM

Replaces: #5

I was originally under the impression that bfd should be responsible for PDB debug symbol loading.
This seems to have been incorrect: GDB does all the debug symbol loading for other debug formats, and only relies on bfd to set up the file for reading.

This means the next step is to start implementing PDB debug symbol loading using LLVM in GDB. We use bfd to do the initial parsing of the PDB file headers and to initialise the section info.

Build error on master (57943c4)

I cannot build the current master (57943c4) on Arch Linux.
My configure is:

    ../configure --prefix=/usr \
                 --target=x86_64-w64-mingw32 \
                 --enable-lto \
                 --disable-nls \
                 --with-system-readline \
                 --with-expat \
                 --with-python=python3.8

Build Error:

 CXX    p-exp.o
  CXX    pdb.o
../../gdb/pdb.c:77:24: error: ‘R_PDB’ was not declared in this scope; did you mean ‘R2_SDB’?
   77 | static std::unique_ptr<R_PDB>
      |                        ^~~~~
      |                        R2_SDB
../../gdb/pdb.c:77:29: error: template argument 1 is invalid
   77 | static std::unique_ptr<R_PDB>
      |                             ^
../../gdb/pdb.c:77:29: error: template argument 2 is invalid
../../gdb/pdb.c: In function ‘int get_r_pdb(const string&)’:
../../gdb/pdb.c:80:3: error: ‘R_PDB’ was not declared in this scope; did you mean ‘R2_SDB’?
   80 |   R_PDB pdb = {nullptr};
      |   ^~~~~
      |   R2_SDB
../../gdb/pdb.c:83:29: error: ‘pdb’ was not declared in this scope; did you mean ‘llvm::pdb’?
   83 |       if (init_pdb_parser (&pdb, path.c_str ()))
      |                             ^~~
      |                             llvm::pdb
In file included from ../../gdb/pdb.h:4,
                 from ../../gdb/pdb.c:16:
/usr/include/llvm/DebugInfo/PDB/Native/PDBFile.h:31:11: note: ‘llvm::pdb’ declared here
   31 | namespace pdb {
      |           ^~~
../../gdb/pdb.c:91:18: error: cannot convert ‘std::nullptr_t’ to ‘int’ in return
   91 |           return nullptr;
      |                  ^~~~~~~
../../gdb/pdb.c:109:20: error: cannot convert ‘std::nullptr_t’ to ‘int’ in return
  109 |             return nullptr;
      |                    ^~~~~~~
../../gdb/pdb.c:115:20: error: cannot convert ‘std::nullptr_t’ to ‘int’ in return
  115 |             return nullptr;
      |                    ^~~~~~~
../../gdb/pdb.c:136:24: error: cannot convert ‘std::nullptr_t’ to ‘int’ in return
  136 |                 return nullptr;
      |                        ^~~~~~~
../../gdb/pdb.c:149:38: error: ‘pdb’ was not declared in this scope; did you mean ‘llvm::pdb’?
  149 |       if (init_pdb_parser_with_buf (&pdb, r_buffer))
      |                                      ^~~
      |                                      llvm::pdb
In file included from ../../gdb/pdb.h:4,
                 from ../../gdb/pdb.c:16:
/usr/include/llvm/DebugInfo/PDB/Native/PDBFile.h:31:11: note: ‘llvm::pdb’ declared here
   31 | namespace pdb {
      |           ^~~
../../gdb/pdb.c:157:10: error: cannot convert ‘std::nullptr_t’ to ‘int’ in return
  157 |   return nullptr;
      |          ^~~~~~~
../../gdb/pdb.c: At global scope:
../../gdb/pdb.c:245:35: error: ‘R_PDB’ was not declared in this scope; did you mean ‘R2_SDB’?
  245 | static std::tuple<std::unique_ptr<R_PDB>, std::string>
      |                                   ^~~~~
      |                                   R2_SDB
../../gdb/pdb.c:245:40: error: template argument 1 is invalid
  245 | static std::tuple<std::unique_ptr<R_PDB>, std::string>
      |                                        ^
../../gdb/pdb.c:245:40: error: template argument 2 is invalid
../../gdb/pdb.c:245:54: error: template argument 1 is invalid
  245 | static std::tuple<std::unique_ptr<R_PDB>, std::string>
      |                                                      ^
../../gdb/pdb.c: In function ‘int load_pdb(objfile*)’:
../../gdb/pdb.c:250:54: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘int’ in return
  250 |   if (paths.empty ()) return {nullptr, std::string ()};
      |                                                      ^
../../gdb/pdb.c:256:36: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘int’ in return
  256 |         return {std::move (p), path};
      |                                    ^
../../gdb/pdb.c:259:34: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘int’ in return
  259 |   return {nullptr, std::string ()};
      |                                  ^
../../gdb/pdb.c: In function ‘void read_pdb(objfile*, minimal_symbol_reader&)’:
../../gdb/pdb.c:291:19: error: ‘R_PDB’ was not declared in this scope; did you mean ‘R2_SDB’?
  291 |   std::unique_ptr<R_PDB> pdb;
      |                   ^~~~~
      |                   R2_SDB
../../gdb/pdb.c:291:24: error: template argument 1 is invalid
  291 |   std::unique_ptr<R_PDB> pdb;
      |                        ^
../../gdb/pdb.c:291:24: error: template argument 2 is invalid
../../gdb/pdb.c:293:47: error: no match for ‘operator=’ (operand types are ‘std::tuple<int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>’ and ‘int’)
  293 |   std::tie (pdb, pdb_path) = load_pdb (objfile);
      |                                               ^
In file included from /usr/include/c++/10.2.0/bits/unique_ptr.h:37,
                 from /usr/include/c++/10.2.0/memory:83,
                 from ../../gdb/gdbsupport/common-exceptions.h:25,
                 from ../../gdb/gdbsupport/common-defs.h:137,
                 from ../../gdb/defs.h:28,
                 from ../../gdb/pdb.h:1,
                 from ../../gdb/pdb.c:16:
/usr/include/c++/10.2.0/tuple:1173:7: note: candidate: ‘std::tuple<_T1, _T2>& std::tuple<_T1, _T2>::operator=(typename std::conditional<__assignable<const _T1&, const _T2&>(), const std::tuple<_T1, _T2>&, const std::__nonesuch&>::type) [with _T1 = int&; _T2 = std::__cxx11::basic_string<char>&; typename std::conditional<__assignable<const _T1&, const _T2&>(), const std::tuple<_T1, _T2>&, const std::__nonesuch&>::type = const std::tuple<int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>&]’
 1173 |       operator=(typename conditional<__assignable<const _T1&, const _T2&>(),
      |       ^~~~~~~~
/usr/include/c++/10.2.0/tuple:1175:35: note:   no known conversion for argument 1 from ‘int’ to ‘std::conditional<true, const std::tuple<int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>&, const std::__nonesuch&>::type’ {aka ‘const std::tuple<int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>&’}
 1173 |       operator=(typename conditional<__assignable<const _T1&, const _T2&>(),
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1174 |          const tuple&,
      |          ~~~~~~~~~~~~~             
 1175 |          const __nonesuch&>::type __in)
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/usr/include/c++/10.2.0/tuple:1184:7: note: candidate: ‘std::tuple<_T1, _T2>& std::tuple<_T1, _T2>::operator=(typename std::conditional<__assignable<_T1, _T2>(), std::tuple<_T1, _T2>&&, std::__nonesuch&&>::type) [with _T1 = int&; _T2 = std::__cxx11::basic_string<char>&; typename std::conditional<__assignable<_T1, _T2>(), std::tuple<_T1, _T2>&&, std::__nonesuch&&>::type = std::tuple<int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>&&]’
 1184 |       operator=(typename conditional<__assignable<_T1, _T2>(),
      |       ^~~~~~~~
/usr/include/c++/10.2.0/tuple:1186:30: note:   no known conversion for argument 1 from ‘int’ to ‘std::conditional<true, std::tuple<int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>&&, std::__nonesuch&&>::type’ {aka ‘std::tuple<int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>&&’}
 1184 |       operator=(typename conditional<__assignable<_T1, _T2>(),
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1185 |          tuple&&,
      |          ~~~~~~~~             
 1186 |          __nonesuch&&>::type __in)
      |          ~~~~~~~~~~~~~~~~~~~~^~~~
/usr/include/c++/10.2.0/tuple:1196:2: note: candidate: ‘template<class _U1, class _U2> std::__enable_if_t<__assignable<const _U1&, const _U2&>(), std::tuple<_T1, _T2>&> std::tuple<_T1, _T2>::operator=(const std::tuple<_U1, _U2>&) [with _U1 = _U1; _U2 = _U2; _T1 = int&; _T2 = std::__cxx11::basic_string<char>&]’
 1196 |  operator=(const tuple<_U1, _U2>& __in)
      |  ^~~~~~~~
/usr/include/c++/10.2.0/tuple:1196:2: note:   template argument deduction/substitution failed:
../../gdb/pdb.c:293:47: note:   mismatched types ‘const std::tuple<_T1, _T2>’ and ‘int’
  293 |   std::tie (pdb, pdb_path) = load_pdb (objfile);
      |                                               ^
In file included from /usr/include/c++/10.2.0/bits/unique_ptr.h:37,
                 from /usr/include/c++/10.2.0/memory:83,
                 from ../../gdb/gdbsupport/common-exceptions.h:25,
                 from ../../gdb/gdbsupport/common-defs.h:137,
                 from ../../gdb/defs.h:28,
                 from ../../gdb/pdb.h:1,
                 from ../../gdb/pdb.c:16:
/usr/include/c++/10.2.0/tuple:1206:2: note: candidate: ‘template<class _U1, class _U2> std::__enable_if_t<__assignable<_U1, _U2>(), std::tuple<_T1, _T2>&> std::tuple<_T1, _T2>::operator=(std::tuple<_U1, _U2>&&) [with _U1 = _U1; _U2 = _U2; _T1 = int&; _T2 = std::__cxx11::basic_string<char>&]’
 1206 |  operator=(tuple<_U1, _U2>&& __in)
      |  ^~~~~~~~
/usr/include/c++/10.2.0/tuple:1206:2: note:   template argument deduction/substitution failed:
../../gdb/pdb.c:293:47: note:   mismatched types ‘std::tuple<_T1, _T2>’ and ‘int’
  293 |   std::tie (pdb, pdb_path) = load_pdb (objfile);
      |                                               ^
In file included from /usr/include/c++/10.2.0/bits/unique_ptr.h:37,
                 from /usr/include/c++/10.2.0/memory:83,
                 from ../../gdb/gdbsupport/common-exceptions.h:25,
                 from ../../gdb/gdbsupport/common-defs.h:137,
                 from ../../gdb/defs.h:28,
                 from ../../gdb/pdb.h:1,
                 from ../../gdb/pdb.c:16:
/usr/include/c++/10.2.0/tuple:1216:2: note: candidate: ‘template<class _U1, class _U2> std::__enable_if_t<__assignable<const _U1&, const _U2&>(), std::tuple<_T1, _T2>&> std::tuple<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) [with _U1 = _U1; _U2 = _U2; _T1 = int&; _T2 = std::__cxx11::basic_string<char>&]’
 1216 |  operator=(const pair<_U1, _U2>& __in)
      |  ^~~~~~~~
/usr/include/c++/10.2.0/tuple:1216:2: note:   template argument deduction/substitution failed:
../../gdb/pdb.c:293:47: note:   mismatched types ‘const std::pair<_T1, _T2>’ and ‘int’
  293 |   std::tie (pdb, pdb_path) = load_pdb (objfile);
      |                                               ^
In file included from /usr/include/c++/10.2.0/bits/unique_ptr.h:37,
                 from /usr/include/c++/10.2.0/memory:83,
                 from ../../gdb/gdbsupport/common-exceptions.h:25,
                 from ../../gdb/gdbsupport/common-defs.h:137,
                 from ../../gdb/defs.h:28,
                 from ../../gdb/pdb.h:1,
                 from ../../gdb/pdb.c:16:
/usr/include/c++/10.2.0/tuple:1227:2: note: candidate: ‘template<class _U1, class _U2> std::__enable_if_t<__assignable<_U1, _U2>(), std::tuple<_T1, _T2>&> std::tuple<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) [with _U1 = _U1; _U2 = _U2; _T1 = int&; _T2 = std::__cxx11::basic_string<char>&]’
 1227 |  operator=(pair<_U1, _U2>&& __in)
      |  ^~~~~~~~
/usr/include/c++/10.2.0/tuple:1227:2: note:   template argument deduction/substitution failed:
../../gdb/pdb.c:293:47: note:   mismatched types ‘std::pair<_T1, _T2>’ and ‘int’
  293 |   std::tie (pdb, pdb_path) = load_pdb (objfile);
      |                                               ^
../../gdb/pdb.c:298:10: error: base operand of ‘->’ is not a pointer
  298 |   if (pdb->pdb_parse (pdb.get ()))
      |          ^~
../../gdb/pdb.c:298:27: error: request for member ‘get’ in ‘pdb’, which is of non-class type ‘int’
  298 |   if (pdb->pdb_parse (pdb.get ()))
      |                           ^~~
../../gdb/pdb.c:308:14: error: base operand of ‘->’ is not a pointer
  308 |       l = pdb->pdb_streams2;
      |              ^~
../../gdb/pdb.c:373:6: error: base operand of ‘->’ is not a pointer
  373 |   pdb->finish_pdb_parse (pdb.get ());
      |      ^~
../../gdb/pdb.c:373:30: error: request for member ‘get’ in ‘pdb’, which is of non-class type ‘int’
  373 |   pdb->finish_pdb_parse (pdb.get ());
      |                              ^~~

bfd_target_pdb_flavour missing

../../bfd/targets.c:1806:10: error: ‘bfd_target_pdb_flavour’ undeclared (first use in this function); did you mean ‘bfd_target_pef_flavour’?
case bfd_target_pdb_flavour: return "PDB";

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.