Compare commits
27 Commits
Author | SHA1 | Date |
---|---|---|
Les De Ridder | 3bb47e2884 | |
Les De Ridder | 1debe334f6 | |
Les De Ridder | a738390a8c | |
Les De Ridder | 991c2e3262 | |
Les De Ridder | 601403b4f9 | |
Les De Ridder | 1952d58df2 | |
Les De Ridder | f6d5862ceb | |
Les De Ridder | 12d1289ad6 | |
Les De Ridder | 0cf0e48af0 | |
Les De Ridder | 0c7b5f1c0a | |
Les De Ridder | 23a86f466c | |
Les De Ridder | b65dd571b3 | |
Les De Ridder | 71b82dfea9 | |
Les De Ridder | c3184e01ce | |
Les De Ridder | dcae9fd7d7 | |
Les De Ridder | 995f44ff35 | |
Les De Ridder | a8451d40c1 | |
Les De Ridder | 8f00d3d3cd | |
Les De Ridder | d82430d33c | |
Les De Ridder | 43ba294701 | |
Les De Ridder | 9f50eba524 | |
Les De Ridder | 5c03599324 | |
Les De Ridder | 817afcd046 | |
Les De Ridder | e234ce54cd | |
Les De Ridder | ef88a7721d | |
Les De Ridder | 6c5d6eb9b0 | |
Les De Ridder | 3702438120 |
|
@ -0,0 +1,58 @@
|
|||
name: CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Install radare2 dependencies
|
||||
run: sudo apt install patch unzip git gcc make curl pkg-config xz-utils
|
||||
|
||||
- name: Checkout radare2
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: radare2
|
||||
repository: radareorg/radare2
|
||||
ref: 4.5.0
|
||||
|
||||
- name: Build radare2
|
||||
working-directory: radare2
|
||||
run: |
|
||||
sys/debian.sh
|
||||
mv radare2_*_amd64.deb radare2_amd64.deb
|
||||
mv radare2-dev_*_amd64.deb radare2-dev_amd64.deb
|
||||
|
||||
- name: Install radare2
|
||||
working-directory: radare2
|
||||
run: sudo apt install ./radare2*.deb
|
||||
|
||||
- name: Checkout gdb-msvc
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: sudo apt install libreadline-dev llvm-dev
|
||||
|
||||
- name: Create build directory
|
||||
run: mkdir build
|
||||
|
||||
- name: Configure
|
||||
working-directory: build
|
||||
run: >-
|
||||
../configure
|
||||
--prefix=/usr
|
||||
--target=i686-w64-mingw32
|
||||
--with-system-readline
|
||||
--disable-nls
|
||||
|
||||
- name: Build
|
||||
working-directory: build
|
||||
run: make
|
||||
|
||||
- name: Install
|
||||
working-directory: build
|
||||
run: sudo make install
|
||||
|
||||
- name: Print version
|
||||
run: i686-w64-mingw32-gdb --version
|
|
@ -0,0 +1 @@
|
|||
/build-*
|
|
@ -0,0 +1,32 @@
|
|||
# gdb-msvc
|
||||
|
||||
![CI](https://github.com/lesderid/gdb-msvc/workflows/CI/badge.svg)
|
||||
|
||||
gdb-msvc is a series of patches for GDB (and its dependencies) for easier debugging of Microsoft Visual C++ (MSVC) binaries.
|
||||
|
||||
## Main features
|
||||
|
||||
The main features in this patchset are:
|
||||
|
||||
* MSVC demangling support
|
||||
* PDB debug symbol loading
|
||||
|
||||
These features are implemented using libraries from [LLVM](https://llvm.org/).
|
||||
|
||||
**NOTE:** Currently, PDB symbol loading uses [radare2](https://github.com/radareorg/radare2)'s libr. This is being removed in favour of a better implementation that uses LLVM.
|
||||
|
||||
## Building
|
||||
|
||||
* `mkdir build && cd build`
|
||||
* `../configure --target=i686-w64-mingw32 <other configure flags>`
|
||||
* `make` (and `make install`)
|
||||
|
||||
Packages:
|
||||
|
||||
* Arch Linux: [gdb-msvc-git](https://aur.archlinux.org/packages/gdb-msvc-git/) (AUR)
|
||||
|
||||
## License
|
||||
|
||||
Most of the code is available under the terms of the [GNU GPLv3 license](/gdb/COPYING). See [the original README](/README-GDB) and license notices in source files for details.
|
||||
|
||||
By contributing you agree to make your code available under the same license.
|
|
@ -52,8 +52,14 @@ ZLIBINC = @zlibinc@
|
|||
|
||||
WARN_CFLAGS = @WARN_CFLAGS@
|
||||
NO_WERROR = @NO_WERROR@
|
||||
|
||||
AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
|
||||
AM_CXXFLAGS = -Werror $(LLVM_CXXFLAGS)
|
||||
AM_CPPFLAGS = -DBINDIR='"$(bindir)"' -DLIBDIR='"$(libdir)"'
|
||||
AM_LIBS = $(LLVM_LIBS)
|
||||
|
||||
libbfd_la_LDFLAGS += $(LLVM_LDFLAGS)
|
||||
|
||||
if PLUGINS
|
||||
bfdinclude_HEADERS += $(INCDIR)/plugin-api.h
|
||||
LIBDL = @lt_cv_dlopen_libs@
|
||||
|
@ -534,6 +540,12 @@ BFD32_BACKENDS_CFILES = \
|
|||
xtensa-isa.c \
|
||||
xtensa-modules.c
|
||||
|
||||
PDB_CXXFILES = \
|
||||
pdb.cpp
|
||||
|
||||
PDB_OBJS = \
|
||||
pdb.lo
|
||||
|
||||
# The .o files needed by all of the 64 bit vectors that are configured into
|
||||
# target_vector in targets.c if configured with --enable-targets=all
|
||||
# and --enable-64-bit-bfd.
|
||||
|
@ -706,7 +718,8 @@ SOURCE_HFILES = \
|
|||
som.h sysdep.h \
|
||||
version.h vms.h \
|
||||
wasm-module.h \
|
||||
xcofflink.h xsym.h
|
||||
xcofflink.h xsym.h \
|
||||
pdb.h pdb-types.h
|
||||
|
||||
## ... and .h files which are in the build tree, minus config.h and bfd.h
|
||||
BUILD_HFILES = \
|
||||
|
@ -737,7 +750,7 @@ all diststuff: info
|
|||
# BFD_MACHINES Architecture-specific routines the configured targets need.
|
||||
# COREFILE Core file routines for a native configuration
|
||||
# bfd64_libs Routines for 64bit support
|
||||
OFILES = $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@ @bfd64_libs@
|
||||
OFILES = $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@ @bfd64_libs@ $(PDB_OBJS)
|
||||
|
||||
stamp-ofiles: Makefile
|
||||
rm -f tofiles
|
||||
|
@ -758,7 +771,7 @@ ofiles: stamp-ofiles ; @true
|
|||
# libbfd_la_SOURCES, we put BFD64_LIBS in OFILES instead.
|
||||
# However, list all sources in EXTRA_libbfd_la_SOURCES so the
|
||||
# dependency tracking fragments are picked up in the Makefile.
|
||||
libbfd_la_SOURCES = $(BFD32_LIBS_CFILES)
|
||||
libbfd_la_SOURCES = $(BFD32_LIBS_CFILES) $(PDB_CXXFILES)
|
||||
EXTRA_libbfd_la_SOURCES = $(CFILES)
|
||||
libbfd_la_DEPENDENCIES = $(OFILES) ofiles
|
||||
libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL) $(ZLIB)
|
||||
|
@ -896,7 +909,8 @@ $(BFD32_LIBS) \
|
|||
$(ALL_MACHINES) \
|
||||
$(BFD32_BACKENDS) \
|
||||
$(BFD64_BACKENDS) \
|
||||
$(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
|
||||
$(OPTIONAL_BACKENDS) \
|
||||
$(PDB_OBJS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
|
||||
|
||||
host-aout.lo: Makefile
|
||||
|
||||
|
|
1486
bfd/Makefile.in
1486
bfd/Makefile.in
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
|
||||
# generated automatically by aclocal 1.16.2 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
|
||||
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to.
|
|||
If you have problems, you may need to regenerate the build system entirely.
|
||||
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
|
||||
|
||||
# Copyright (C) 2002-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
|
|||
# generated from the m4 files accompanying Automake X.Y.
|
||||
# (This private macro should not be called outside this file.)
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION],
|
||||
[am__api_version='1.15'
|
||||
[am__api_version='1.16'
|
||||
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
|
||||
dnl require some minimum version. Point them to the right macro.
|
||||
m4_if([$1], [1.15.1], [],
|
||||
m4_if([$1], [1.16.2], [],
|
||||
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
|
||||
])
|
||||
|
||||
|
@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
|
|||
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
|
||||
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.15.1])dnl
|
||||
[AM_AUTOMAKE_VERSION([1.16.2])dnl
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
|
|||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -141,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE(
|
|||
Usually this means the macro was only invoked conditionally.]])
|
||||
fi])])
|
||||
|
||||
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -332,13 +332,12 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
|
|||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
|
||||
# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# ------------------------------
|
||||
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
|
@ -346,49 +345,43 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
|||
# Older Autoconf quotes --file arguments for eval, but not when files
|
||||
# are listed without --file. Let's play safe and only enable the eval
|
||||
# if we detect the quoting.
|
||||
case $CONFIG_FILES in
|
||||
*\'*) eval set x "$CONFIG_FILES" ;;
|
||||
*) set x $CONFIG_FILES ;;
|
||||
esac
|
||||
# TODO: see whether this extra hack can be removed once we start
|
||||
# requiring Autoconf 2.70 or later.
|
||||
AS_CASE([$CONFIG_FILES],
|
||||
[*\'*], [eval set x "$CONFIG_FILES"],
|
||||
[*], [set x $CONFIG_FILES])
|
||||
shift
|
||||
for mf
|
||||
# Used to flag and report bootstrapping failures.
|
||||
am_rc=0
|
||||
for am_mf
|
||||
do
|
||||
# Strip MF so we end up with the name of the file.
|
||||
mf=`echo "$mf" | sed -e 's/:.*$//'`
|
||||
# Check whether this is an Automake generated Makefile or not.
|
||||
# We used to match only the files named 'Makefile.in', but
|
||||
# some people rename them; so instead we look at the file content.
|
||||
# Grep'ing the first line is not enough: some people post-process
|
||||
# each Makefile.in and add a new line on top of each file to say so.
|
||||
# Grep'ing the whole file is not good either: AIX grep has a line
|
||||
am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
|
||||
# Check whether this is an Automake generated Makefile which includes
|
||||
# dependency-tracking related rules and includes.
|
||||
# Grep'ing the whole file directly is not great: AIX grep has a line
|
||||
# limit of 2048, but all sed's we know have understand at least 4000.
|
||||
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
|
||||
dirpart=`AS_DIRNAME("$mf")`
|
||||
else
|
||||
continue
|
||||
fi
|
||||
# Extract the definition of DEPDIR, am__include, and am__quote
|
||||
# from the Makefile without running 'make'.
|
||||
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
|
||||
test -z "$DEPDIR" && continue
|
||||
am__include=`sed -n 's/^am__include = //p' < "$mf"`
|
||||
test -z "$am__include" && continue
|
||||
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
|
||||
# Find all dependency output files, they are included files with
|
||||
# $(DEPDIR) in their names. We invoke sed twice because it is the
|
||||
# simplest approach to changing $(DEPDIR) to its actual value in the
|
||||
# expansion.
|
||||
for file in `sed -n "
|
||||
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
|
||||
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
|
||||
# Make sure the directory exists.
|
||||
test -f "$dirpart/$file" && continue
|
||||
fdir=`AS_DIRNAME(["$file"])`
|
||||
AS_MKDIR_P([$dirpart/$fdir])
|
||||
# echo "creating $dirpart/$file"
|
||||
echo '# dummy' > "$dirpart/$file"
|
||||
done
|
||||
sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
|
||||
|| continue
|
||||
am_dirpart=`AS_DIRNAME(["$am_mf"])`
|
||||
am_filepart=`AS_BASENAME(["$am_mf"])`
|
||||
AM_RUN_LOG([cd "$am_dirpart" \
|
||||
&& sed -e '/# am--include-marker/d' "$am_filepart" \
|
||||
| $MAKE -f - am--depfiles]) || am_rc=$?
|
||||
done
|
||||
if test $am_rc -ne 0; then
|
||||
AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
|
||||
for automatic dependency tracking. If GNU make was not used, consider
|
||||
re-running the configure script with MAKE="gmake" (or whatever is
|
||||
necessary). You can also try re-running configure with the
|
||||
'--disable-dependency-tracking' option to at least be able to build
|
||||
the package (albeit without support for automatic dependency tracking).])
|
||||
fi
|
||||
AS_UNSET([am_dirpart])
|
||||
AS_UNSET([am_filepart])
|
||||
AS_UNSET([am_mf])
|
||||
AS_UNSET([am_rc])
|
||||
rm -f conftest-deps.mk
|
||||
}
|
||||
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
|
||||
|
@ -397,18 +390,17 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
|||
# -----------------------------
|
||||
# This macro should only be invoked once -- use via AC_REQUIRE.
|
||||
#
|
||||
# This code is only required when automatic dependency tracking
|
||||
# is enabled. FIXME. This creates each '.P' file that we will
|
||||
# need in order to bootstrap the dependency handling code.
|
||||
# This code is only required when automatic dependency tracking is enabled.
|
||||
# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
|
||||
# order to bootstrap the dependency handling code.
|
||||
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AC_CONFIG_COMMANDS([depfiles],
|
||||
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
|
||||
])
|
||||
[AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -495,8 +487,8 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
|
|||
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
|
||||
# For better backward compatibility. To be removed once Automake 1.9.x
|
||||
# dies out for good. For more background, see:
|
||||
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
|
||||
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
|
||||
# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
|
||||
# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
|
||||
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
|
||||
# We need awk for the "check" target (and possibly the TAP driver). The
|
||||
# system "awk" is bad on some platforms.
|
||||
|
@ -563,7 +555,7 @@ END
|
|||
Aborting the configuration process, to ensure you take notice of the issue.
|
||||
|
||||
You can download and install GNU coreutils to get an 'rm' implementation
|
||||
that behaves properly: <http://www.gnu.org/software/coreutils/>.
|
||||
that behaves properly: <https://www.gnu.org/software/coreutils/>.
|
||||
|
||||
If you want to complete the configuration process using your problematic
|
||||
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
|
||||
|
@ -605,7 +597,7 @@ for _am_header in $config_headers :; do
|
|||
done
|
||||
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -629,7 +621,7 @@ AC_SUBST([install_sh])])
|
|||
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
|
||||
# From Jim Meyering
|
||||
|
||||
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -664,7 +656,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
|||
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -672,49 +664,42 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
|||
|
||||
# AM_MAKE_INCLUDE()
|
||||
# -----------------
|
||||
# Check to see how make treats includes.
|
||||
# Check whether make has an 'include' directive that can support all
|
||||
# the idioms we need for our automatic dependency tracking code.
|
||||
AC_DEFUN([AM_MAKE_INCLUDE],
|
||||
[am_make=${MAKE-make}
|
||||
cat > confinc << 'END'
|
||||
[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
|
||||
cat > confinc.mk << 'END'
|
||||
am__doit:
|
||||
@echo this is the am__doit target
|
||||
@echo this is the am__doit target >confinc.out
|
||||
.PHONY: am__doit
|
||||
END
|
||||
# If we don't find an include directive, just comment out the code.
|
||||
AC_MSG_CHECKING([for style of include used by $am_make])
|
||||
am__include="#"
|
||||
am__quote=
|
||||
_am_result=none
|
||||
# First try GNU make style include.
|
||||
echo "include confinc" > confmf
|
||||
# Ignore all kinds of additional output from 'make'.
|
||||
case `$am_make -s -f confmf 2> /dev/null` in #(
|
||||
*the\ am__doit\ target*)
|
||||
am__include=include
|
||||
am__quote=
|
||||
_am_result=GNU
|
||||
;;
|
||||
esac
|
||||
# Now try BSD make style include.
|
||||
if test "$am__include" = "#"; then
|
||||
echo '.include "confinc"' > confmf
|
||||
case `$am_make -s -f confmf 2> /dev/null` in #(
|
||||
*the\ am__doit\ target*)
|
||||
am__include=.include
|
||||
am__quote="\""
|
||||
_am_result=BSD
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AC_SUBST([am__include])
|
||||
AC_SUBST([am__quote])
|
||||
AC_MSG_RESULT([$_am_result])
|
||||
rm -f confinc confmf
|
||||
])
|
||||
# BSD make does it like this.
|
||||
echo '.include "confinc.mk" # ignored' > confmf.BSD
|
||||
# Other make implementations (GNU, Solaris 10, AIX) do it like this.
|
||||
echo 'include confinc.mk # ignored' > confmf.GNU
|
||||
_am_result=no
|
||||
for s in GNU BSD; do
|
||||
AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
|
||||
AS_CASE([$?:`cat confinc.out 2>/dev/null`],
|
||||
['0:this is the am__doit target'],
|
||||
[AS_CASE([$s],
|
||||
[BSD], [am__include='.include' am__quote='"'],
|
||||
[am__include='include' am__quote=''])])
|
||||
if test "$am__include" != "#"; then
|
||||
_am_result="yes ($s style)"
|
||||
break
|
||||
fi
|
||||
done
|
||||
rm -f confinc.* confmf.*
|
||||
AC_MSG_RESULT([${_am_result}])
|
||||
AC_SUBST([am__include])])
|
||||
AC_SUBST([am__quote])])
|
||||
|
||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -753,7 +738,7 @@ fi
|
|||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -782,7 +767,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
|
|||
AC_DEFUN([_AM_IF_OPTION],
|
||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||
|
||||
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -829,7 +814,7 @@ AC_LANG_POP([C])])
|
|||
# For backward compatibility.
|
||||
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
|
||||
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -848,7 +833,7 @@ AC_DEFUN([AM_RUN_LOG],
|
|||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -929,7 +914,7 @@ AC_CONFIG_COMMANDS_PRE(
|
|||
rm -f conftest.file
|
||||
])
|
||||
|
||||
# Copyright (C) 2009-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2009-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -989,7 +974,7 @@ AC_SUBST([AM_BACKSLASH])dnl
|
|||
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
|
||||
])
|
||||
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -1017,7 +1002,7 @@ fi
|
|||
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# Copyright (C) 2006-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -1036,7 +1021,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
|
|||
|
||||
# Check how to create a tarball. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2004-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
|
|
@ -6710,6 +6710,7 @@ struct bfd
|
|||
struct bfd_pef_data_struct *pef_data;
|
||||
struct bfd_pef_xlib_data_struct *pef_xlib_data;
|
||||
struct bfd_sym_data_struct *sym_data;
|
||||
struct pdb_data_struct *pdb_data;
|
||||
void *any;
|
||||
}
|
||||
tdata;
|
||||
|
@ -7234,7 +7235,8 @@ enum bfd_flavour
|
|||
bfd_target_mach_o_flavour,
|
||||
bfd_target_pef_flavour,
|
||||
bfd_target_pef_xlib_flavour,
|
||||
bfd_target_sym_flavour
|
||||
bfd_target_sym_flavour,
|
||||
bfd_target_pdb_flavour
|
||||
};
|
||||
|
||||
enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
|
||||
|
|
|
@ -342,6 +342,7 @@ CODE_FRAGMENT
|
|||
. struct bfd_pef_data_struct *pef_data;
|
||||
. struct bfd_pef_xlib_data_struct *pef_xlib_data;
|
||||
. struct bfd_sym_data_struct *sym_data;
|
||||
. struct pdb_data_struct *pdb_data;
|
||||
. void *any;
|
||||
. }
|
||||
. tdata;
|
||||
|
@ -2466,9 +2467,9 @@ bfd_demangle (bfd *abfd, const char *name, int options)
|
|||
++name;
|
||||
pre_len = name - pre;
|
||||
|
||||
/* Strip off @plt and suchlike too. */
|
||||
/* Strip off @plt too. */
|
||||
alloc = NULL;
|
||||
suf = strchr (name, '@');
|
||||
suf = strstr (name, "@plt");
|
||||
if (suf != NULL)
|
||||
{
|
||||
alloc = (char *) bfd_malloc (suf - name + 1);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -36,6 +36,7 @@ dnl configure option --enable-shared.
|
|||
AC_DISABLE_SHARED
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
AC_GNU_SOURCE
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
|
||||
|
@ -1125,4 +1126,10 @@ AC_SUBST(docdir)
|
|||
AC_SUBST(htmldir)
|
||||
AC_SUBST(pdfdir)
|
||||
|
||||
AC_CHECK_PROG(LLVM_CONFIG_FOUND, llvm-config, yes)
|
||||
AS_IF([test x"$LLVM_CONFIG_FOUND" != x"yes"], [AC_MSG_ERROR([Please make sure llvm-config is in your PATH.])])
|
||||
AC_SUBST([LLVM_CXXFLAGS], [$(llvm-config --cxxflags)])
|
||||
AC_SUBST([LLVM_LDFLAGS], [$(llvm-config --ldflags)])
|
||||
AC_SUBST([LLVM_LIBS], [$(llvm-config --libs)])
|
||||
|
||||
AC_OUTPUT
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.in generated by automake 1.15.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.16.2 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -247,6 +247,10 @@ COREFILE = @COREFILE@
|
|||
COREFLAG = @COREFLAG@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DEBUGDIR = @DEBUGDIR@
|
||||
|
@ -281,6 +285,10 @@ LIBOBJS = @LIBOBJS@
|
|||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LLVM_CONFIG_FOUND = @LLVM_CONFIG_FOUND@
|
||||
LLVM_CXXFLAGS = @LLVM_CXXFLAGS@
|
||||
LLVM_LDFLAGS = @LLVM_LDFLAGS@
|
||||
LLVM_LIBS = @LLVM_LIBS@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
|
@ -327,6 +335,7 @@ abs_srcdir = @abs_srcdir@
|
|||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
all_backends = @all_backends@
|
||||
am__include = @am__include@
|
||||
|
@ -518,8 +527,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
|||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
|
@ -676,7 +685,10 @@ ctags CTAGS:
|
|||
cscope cscopelist:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
|
|
|
@ -127,7 +127,7 @@ static inline char *
|
|||
bfd_strdup (const char *str)
|
||||
{
|
||||
size_t len = strlen (str) + 1;
|
||||
char *buf = bfd_malloc (len);
|
||||
char *buf = (char*) bfd_malloc (len);
|
||||
if (buf != NULL)
|
||||
memcpy (buf, str, len);
|
||||
return buf;
|
||||
|
|
|
@ -132,7 +132,7 @@ static inline char *
|
|||
bfd_strdup (const char *str)
|
||||
{
|
||||
size_t len = strlen (str) + 1;
|
||||
char *buf = bfd_malloc (len);
|
||||
char *buf = (char*) bfd_malloc (len);
|
||||
if (buf != NULL)
|
||||
memcpy (buf, str, len);
|
||||
return buf;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,316 @@
|
|||
/* PDB support for BFD. */
|
||||
|
||||
#include "pdb.h"
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma ide diagnostic ignored "UnusedLocalVariable"
|
||||
#pragma ide diagnostic ignored "UnusedMacroInspection"
|
||||
#pragma ide diagnostic ignored "UnusedGlobalDeclarationInspection"
|
||||
|
||||
/* Called when the BFD is being closed to do any necessary cleanup. */
|
||||
bfd_boolean
|
||||
bfd_pdb_close_and_cleanup (bfd *abfd)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Ask the BFD to free all cached information. */
|
||||
bfd_boolean
|
||||
bfd_pdb_bfd_free_cached_info (bfd *abfd)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Called when a new section is created. */
|
||||
#define bfd_pdb_new_section_hook _bfd_generic_new_section_hook
|
||||
|
||||
/* Read the contents of a section. */
|
||||
#define bfd_pdb_get_section_contents _bfd_generic_get_section_contents
|
||||
#define bfd_pdb_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
|
||||
|
||||
long
|
||||
bfd_pdb_get_symtab_upper_bound (bfd *abfd)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
long
|
||||
bfd_pdb_canonicalize_symtab (bfd *abfd, asymbol **alocation)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#define bfd_pdb_make_empty_symbol _bfd_generic_make_empty_symbol
|
||||
|
||||
void
|
||||
bfd_pdb_print_symbol (bfd *abfd,
|
||||
void *afile,
|
||||
asymbol *symbol,
|
||||
bfd_print_symbol_type how)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
bfd_pdb_get_symbol_info (bfd *abfd,
|
||||
asymbol *symbol,
|
||||
symbol_info *ret)
|
||||
{
|
||||
}
|
||||
|
||||
#define bfd_pdb_get_symbol_version_string _bfd_nosymbols_get_symbol_version_string
|
||||
#define bfd_pdb_bfd_is_local_label_name bfd_generic_is_local_label_name
|
||||
#define bfd_pdb_bfd_is_target_special_symbol _bfd_bool_bfd_asymbol_false
|
||||
#define bfd_pdb_get_lineno _bfd_nosymbols_get_lineno
|
||||
|
||||
bfd_boolean
|
||||
bfd_pdb_find_nearest_line (bfd *abfd,
|
||||
asymbol **symbols,
|
||||
asection *section,
|
||||
bfd_vma offset,
|
||||
const char **filename_ptr,
|
||||
const char **functionname_ptr,
|
||||
unsigned int *line_pt,
|
||||
unsigned int *discriminator_ptr)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#define bfd_pdb_find_line _bfd_nosymbols_find_line
|
||||
#define bfd_pdb_find_inliner_info _bfd_nosymbols_find_inliner_info
|
||||
|
||||
/* Back-door to allow format-aware applications to create debug symbols
|
||||
while using BFD for everything else. Currently used by the assembler
|
||||
when creating COFF files. */
|
||||
#define bfd_pdb_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
|
||||
|
||||
#define bfd_pdb_read_minisymbols _bfd_nosymbols_read_minisymbols
|
||||
#define bfd_pdb_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
class BfdByteStream;
|
||||
|
||||
static bfd_pdb_data_struct *
|
||||
get_bfd_pdb_data (bfd *abfd)
|
||||
{
|
||||
//TODO: check file magic
|
||||
|
||||
auto allocator = std::make_unique<llvm::BumpPtrAllocator> ();
|
||||
|
||||
auto stream = std::make_unique<BfdByteStream> (abfd);
|
||||
auto pdbFile = std::make_unique<llvm::pdb::PDBFile> (abfd->filename, std::move (stream), *allocator);
|
||||
|
||||
//TODO: proper error handling, only if magic says we're actually reading a PDB file
|
||||
auto ec = pdbFile->parseFileHeaders ();
|
||||
if (ec)
|
||||
{
|
||||
//printf ("%s: error: %s\n", abfd->filename, toString (std::move (ec)).c_str ());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ec = pdbFile->parseStreamData ();
|
||||
if (ec)
|
||||
{
|
||||
//printf ("%s: error: %s\n", abfd->filename, toString (std::move (ec)).c_str ());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto session = std::make_unique<llvm::pdb::NativeSession> (std::move (pdbFile),
|
||||
std::move (allocator));
|
||||
|
||||
auto resultBuffer = bfd_alloc (abfd, sizeof (bfd_pdb_data_struct));
|
||||
auto result = new (resultBuffer) bfd_pdb_data_struct;
|
||||
result->session = std::move (session);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool
|
||||
bfd_pdb_get_sections (bfd *abfd)
|
||||
{
|
||||
auto & session = abfd->tdata.pdb_data->session;
|
||||
auto & pdbFile = session->getPDBFile ();
|
||||
|
||||
auto dbi = pdbFile.getPDBDbiStream ();
|
||||
auto streamIndex = dbi->getDebugStreamIndex (llvm::pdb::DbgHeaderType::SectionHdr);
|
||||
auto stream = pdbFile.createIndexedStream (streamIndex);
|
||||
|
||||
llvm::ArrayRef<llvm::object::coff_section> headers;
|
||||
auto headerCount = stream->getLength () / sizeof (llvm::object::coff_section);
|
||||
llvm::BinaryStreamReader reader (*stream);
|
||||
if(reader.readArray (headers, headerCount))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto & header: headers)
|
||||
{
|
||||
asection *section = bfd_make_section_with_flags (abfd,
|
||||
header.Name,
|
||||
SEC_LOAD);
|
||||
section->vma = header.VirtualAddress;
|
||||
section->size = header.VirtualSize;
|
||||
//section->userdata = header;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
class BfdByteStream : public llvm::BinaryStream {
|
||||
public:
|
||||
explicit BfdByteStream (bfd *abfd) : abfd (abfd)
|
||||
{
|
||||
}
|
||||
|
||||
llvm::support::endianness getEndian () const override
|
||||
{
|
||||
return llvm::support::little;
|
||||
}
|
||||
|
||||
llvm::Error readBytes (uint32_t Offset, uint32_t Size, llvm::ArrayRef<uint8_t> & Buffer) override
|
||||
{
|
||||
//We need to cache the whole PDB file in memory:
|
||||
//During parsing, the LLVM functions first read one block of PDB data into an ArrayRef. They
|
||||
//then just assume all blocks are stored contiguously in memory and simply change the `size`
|
||||
//field of the ArrayRef instead of actually reading the remaining blocks...
|
||||
|
||||
if (!cached)
|
||||
{
|
||||
auto ec = this->createCache ();
|
||||
if (ec) return ec;
|
||||
}
|
||||
|
||||
//printf ("%s: readBytes(offset=%d,size=%d)\n", abfd->filename, Offset, Size);
|
||||
|
||||
Buffer = llvm::ArrayRef<uint8_t> (cache + Offset, (size_t) Size);
|
||||
return llvm::Error::success ();
|
||||
}
|
||||
|
||||
llvm::Error
|
||||
readLongestContiguousChunk (uint32_t Offset, llvm::ArrayRef<uint8_t> & Buffer) override
|
||||
{
|
||||
return readBytes (Offset, getLength () - Offset, Buffer);
|
||||
}
|
||||
|
||||
uint32_t getLength () override
|
||||
{
|
||||
if (fileSize != -1)
|
||||
return fileSize;
|
||||
|
||||
struct stat stat{};
|
||||
if (bfd_stat (abfd, &stat) < 0)
|
||||
return -1;
|
||||
|
||||
fileSize = stat.st_size;
|
||||
|
||||
//printf("stat.st_size=%ld\n", stat.st_size);
|
||||
return fileSize;
|
||||
}
|
||||
|
||||
private:
|
||||
llvm::Error
|
||||
createCache ()
|
||||
{
|
||||
if (cached) return llvm::Error::success ();
|
||||
|
||||
auto length = getLength ();
|
||||
|
||||
cache = static_cast<uint8_t *>(bfd_alloc (abfd, length));
|
||||
if (bfd_seek (abfd, 0, SEEK_SET) != 0)
|
||||
return llvm::createStringError (std::error_code (), "EOF");
|
||||
if (bfd_bread (cache, length, abfd) != length)
|
||||
return llvm::createStringError (std::error_code (), "EOF");
|
||||
|
||||
cached = true;
|
||||
|
||||
return llvm::Error::success ();
|
||||
}
|
||||
|
||||
bfd *abfd;
|
||||
bool cached = false;
|
||||
uint8_t *cache = nullptr;
|
||||
size_t fileSize = -1;
|
||||
};
|
||||
|
||||
const bfd_target *
|
||||
bfd_pdb_check_format (bfd *abfd)
|
||||
{
|
||||
if ((abfd->tdata.pdb_data = get_bfd_pdb_data (abfd)))
|
||||
{
|
||||
auto & pdbData = abfd->tdata.pdb_data;
|
||||
|
||||
if (!bfd_pdb_get_sections (abfd))
|
||||
goto fail;
|
||||
|
||||
return abfd->xvec;
|
||||
}
|
||||
|
||||
fail:
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma ide diagnostic ignored "hicpp-signed-bitwise"
|
||||
|
||||
extern "C"
|
||||
const bfd_target pdb_vec =
|
||||
{
|
||||
"pdb", /* Name. */
|
||||
bfd_target_pdb_flavour, /* Flavour. */
|
||||
BFD_ENDIAN_LITTLE, /* Byteorder. */
|
||||
BFD_ENDIAN_LITTLE, /* Header_byteorder. */
|
||||
|
||||
/* FIXME: These might not be correct */
|
||||
(HAS_RELOC | EXEC_P | /* Object flags. */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
|
||||
(SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_DATA
|
||||
| SEC_DEBUGGING
|
||||
| SEC_ROM | SEC_HAS_CONTENTS), /* Section_flags. */
|
||||
0, /* Symbol_leading_char. */
|
||||
'/', /* AR_pad_char. */
|
||||
15, /* AR_max_namelen. */
|
||||
0, /* match priority. */
|
||||
|
||||
bfd_getl64, bfd_getl_signed_64, bfd_putb64,
|
||||
bfd_getl32, bfd_getl_signed_32, bfd_putb32,
|
||||
bfd_getl16, bfd_getl_signed_16, bfd_putb16, /* Data. */
|
||||
bfd_getl64, bfd_getl_signed_64, bfd_putb64,
|
||||
bfd_getl32, bfd_getl_signed_32, bfd_putb32,
|
||||
bfd_getl16, bfd_getl_signed_16, bfd_putb16, /* Headers. */
|
||||
|
||||
{ /* bfd_check_format. */
|
||||
_bfd_dummy_target,
|
||||
bfd_pdb_check_format, /* bfd_check_format. */
|
||||
_bfd_dummy_target,
|
||||
_bfd_dummy_target,
|
||||
},
|
||||
{ /* bfd_set_format. */
|
||||
_bfd_bool_bfd_false_error,
|
||||
_bfd_bool_bfd_false,
|
||||
_bfd_bool_bfd_false_error,
|
||||
_bfd_bool_bfd_false_error,
|
||||
},
|
||||
{ /* bfd_write_contents. */
|
||||
_bfd_bool_bfd_false_error,
|
||||
_bfd_bool_bfd_false,
|
||||
_bfd_bool_bfd_false_error,
|
||||
_bfd_bool_bfd_false_error,
|
||||
},
|
||||
|
||||
BFD_JUMP_TABLE_GENERIC (bfd_pdb),
|
||||
BFD_JUMP_TABLE_COPY (_bfd_generic),
|
||||
BFD_JUMP_TABLE_CORE (_bfd_nocore),
|
||||
BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
|
||||
BFD_JUMP_TABLE_SYMBOLS (bfd_pdb),
|
||||
BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
|
||||
BFD_JUMP_TABLE_WRITE (_bfd_nowrite),
|
||||
BFD_JUMP_TABLE_LINK (_bfd_nolink),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
nullptr,
|
||||
|
||||
nullptr
|
||||
};
|
||||
|
||||
#pragma clang diagnostic pop
|
|
@ -0,0 +1,24 @@
|
|||
/* PDB support for BFD. */
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "bfd.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
#include <llvm/Support/ErrorOr.h>
|
||||
#include <llvm/Support/Error.h>
|
||||
#include <llvm/Support/MemoryBuffer.h>
|
||||
#include <llvm/Support/BinaryStream.h>
|
||||
#include <llvm/Support/Allocator.h>
|
||||
#include <llvm/DebugInfo/PDB/Native/PDBFile.h>
|
||||
#include <llvm/DebugInfo/PDB/Native/DbiStream.h>
|
||||
#include <llvm/DebugInfo/PDB/Native/NativeSession.h>
|
||||
#include <llvm/DebugInfo/PDB/IPDBSectionContrib.h>
|
||||
#include <llvm/DebugInfo/PDB/PDBSymbolCompiland.h>
|
||||
#include <llvm/DebugInfo/PDB/IPDBTable.h>
|
||||
#include <llvm/Object/COFF.h>
|
||||
|
||||
typedef struct pdb_data_struct {
|
||||
std::unique_ptr<llvm::pdb::NativeSession> session;
|
||||
} bfd_pdb_data_struct;
|
|
@ -1176,7 +1176,7 @@ _bfd_XXi_slurp_codeview_record (bfd * abfd, file_ptr where, unsigned long length
|
|||
memcpy (&(cvinfo->Signature[8]), &(cvinfo70->Signature[8]), 8);
|
||||
|
||||
cvinfo->SignatureLength = CV_INFO_SIGNATURE_LENGTH;
|
||||
// cvinfo->PdbFileName = cvinfo70->PdbFileName;
|
||||
strncpy(cvinfo->PdbFileName, cvinfo70->PdbFileName, sizeof(cvinfo->PdbFileName) - 1);
|
||||
|
||||
return cvinfo;
|
||||
}
|
||||
|
@ -1187,7 +1187,7 @@ _bfd_XXi_slurp_codeview_record (bfd * abfd, file_ptr where, unsigned long length
|
|||
cvinfo->Age = H_GET_32(abfd, cvinfo20->Age);
|
||||
memcpy (cvinfo->Signature, cvinfo20->Signature, 4);
|
||||
cvinfo->SignatureLength = 4;
|
||||
// cvinfo->PdbFileName = cvinfo20->PdbFileName;
|
||||
strncpy(cvinfo->PdbFileName, cvinfo20->PdbFileName, sizeof(cvinfo->PdbFileName) - 1);
|
||||
|
||||
return cvinfo;
|
||||
}
|
||||
|
@ -2726,9 +2726,9 @@ pe_print_debugdata (bfd * abfd, void * vfile)
|
|||
sprintf (&signature[i*2], "%02x", cvinfo->Signature[i] & 0xff);
|
||||
|
||||
/* xgettext:c-format */
|
||||
fprintf (file, _("(format %c%c%c%c signature %s age %ld)\n"),
|
||||
fprintf (file, _("(format %c%c%c%c signature %s age %ld pdb_file %s)\n"),
|
||||
buffer[0], buffer[1], buffer[2], buffer[3],
|
||||
signature, cvinfo->Age);
|
||||
signature, cvinfo->Age, cvinfo->PdbFileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -165,7 +165,8 @@ DESCRIPTION
|
|||
. bfd_target_mach_o_flavour,
|
||||
. bfd_target_pef_flavour,
|
||||
. bfd_target_pef_xlib_flavour,
|
||||
. bfd_target_sym_flavour
|
||||
. bfd_target_sym_flavour,
|
||||
. bfd_target_pdb_flavour
|
||||
.};
|
||||
.
|
||||
.enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
|
||||
|
@ -955,6 +956,8 @@ extern const bfd_target core_ptrace_vec;
|
|||
extern const bfd_target core_sco5_vec;
|
||||
extern const bfd_target core_trad_vec;
|
||||
|
||||
extern const bfd_target pdb_vec;
|
||||
|
||||
static const bfd_target * const _bfd_target_vector[] =
|
||||
{
|
||||
#ifdef SELECT_VECS
|
||||
|
@ -1412,6 +1415,8 @@ static const bfd_target * const _bfd_target_vector[] =
|
|||
&core_trad_vec,
|
||||
#endif
|
||||
|
||||
&pdb_vec,
|
||||
|
||||
NULL /* end of list marker */
|
||||
};
|
||||
const bfd_target * const *bfd_target_vector = _bfd_target_vector;
|
||||
|
@ -1799,6 +1804,7 @@ bfd_flavour_name (enum bfd_flavour flavour)
|
|||
case bfd_target_pef_flavour: return "PEF";
|
||||
case bfd_target_pef_xlib_flavour: return "PEF_XLIB";
|
||||
case bfd_target_sym_flavour: return "SYM";
|
||||
case bfd_target_pdb_flavour: return "PDB";
|
||||
/* There is no "default" case here so that -Wswitch (part of -Wall)
|
||||
catches missing entries. */
|
||||
}
|
||||
|
|
|
@ -560,7 +560,8 @@ CONFIG_DEP_SUBDIR = $(addsuffix /$(DEPDIR),$(CONFIG_SRC_SUBDIR))
|
|||
# should be according to Posix).
|
||||
DEFS = @DEFS@
|
||||
GDB_CFLAGS = -I. -I$(srcdir) -I$(srcdir)/config \
|
||||
-DLOCALEDIR="\"$(localedir)\"" $(DEFS)
|
||||
-DLOCALEDIR="\"$(localedir)\"" $(DEFS) \
|
||||
@RADARE_CFLAGS@ @LLVM_LDFLAGS@
|
||||
|
||||
# MH_CFLAGS, if defined, has host-dependent CFLAGS from the config directory.
|
||||
GLOBAL_CFLAGS = $(MH_CFLAGS)
|
||||
|
@ -612,7 +613,8 @@ CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(LIBCTF) $(ZLIB) \
|
|||
@LIBS@ @GUILE_LIBS@ @PYTHON_LIBS@ \
|
||||
$(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) $(LIBIPT) \
|
||||
$(LIBIBERTY) $(WIN32LIBS) $(LIBGNU) $(LIBICONV) $(LIBMPFR) \
|
||||
$(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS)
|
||||
$(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS) \
|
||||
@RADARE_LIBS@ @LLVM_LIBS@
|
||||
CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) $(LIBCTF) \
|
||||
$(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU)
|
||||
|
||||
|
@ -1167,7 +1169,8 @@ COMMON_SFILES = \
|
|||
varobj.c \
|
||||
xml-support.c \
|
||||
xml-syscall.c \
|
||||
xml-tdesc.c
|
||||
xml-tdesc.c \
|
||||
pdb.c
|
||||
|
||||
# Links made at configuration time should not be specified here, since
|
||||
# SFILES is used in building the distribution archive.
|
||||
|
@ -1574,7 +1577,8 @@ HFILES_NO_SRCDIR = \
|
|||
tui/tui-windata.h \
|
||||
tui/tui-wingeneral.h \
|
||||
tui/tui-winsource.h \
|
||||
x86-tdep.h
|
||||
x86-tdep.h \
|
||||
pdb.h
|
||||
|
||||
# Header files that already have srcdir in them, or which are in objdir.
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
|
||||
# generated automatically by aclocal 1.16.2 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
|
||||
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -12,9 +12,353 @@
|
|||
# PARTICULAR PURPOSE.
|
||||
|
||||
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
|
||||
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
||||
# serial 11 (pkg-config-0.29.1)
|
||||
|
||||
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
||||
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
|
||||
dnl
|
||||
dnl This program is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2 of the License, or
|
||||
dnl (at your option) any later version.
|
||||
dnl
|
||||
dnl This program is distributed in the hope that it will be useful, but
|
||||
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
dnl General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with this program; if not, write to the Free Software
|
||||
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
dnl 02111-1307, USA.
|
||||
dnl
|
||||
dnl As a special exception to the GNU General Public License, if you
|
||||
dnl distribute this file as part of a program that contains a
|
||||
dnl configuration script generated by Autoconf, you may include it under
|
||||
dnl the same distribution terms that you use for the rest of that
|
||||
dnl program.
|
||||
|
||||
dnl PKG_PREREQ(MIN-VERSION)
|
||||
dnl -----------------------
|
||||
dnl Since: 0.29
|
||||
dnl
|
||||
dnl Verify that the version of the pkg-config macros are at least
|
||||
dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
|
||||
dnl installed version of pkg-config, this checks the developer's version
|
||||
dnl of pkg.m4 when generating configure.
|
||||
dnl
|
||||
dnl To ensure that this macro is defined, also add:
|
||||
dnl m4_ifndef([PKG_PREREQ],
|
||||
dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
|
||||
dnl
|
||||
dnl See the "Since" comment for each macro you use to see what version
|
||||
dnl of the macros you require.
|
||||
m4_defun([PKG_PREREQ],
|
||||
[m4_define([PKG_MACROS_VERSION], [0.29.1])
|
||||
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
|
||||
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
|
||||
])dnl PKG_PREREQ
|
||||
|
||||
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
|
||||
dnl ----------------------------------
|
||||
dnl Since: 0.16
|
||||
dnl
|
||||
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
|
||||
dnl first found in the path. Checks that the version of pkg-config found
|
||||
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
|
||||
dnl used since that's the first version where most current features of
|
||||
dnl pkg-config existed.
|
||||
AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
||||
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
||||
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
|
||||
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
|
||||
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
|
||||
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
|
||||
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
|
||||
|
||||
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
|
||||
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
|
||||
fi
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
_pkg_min_version=m4_default([$1], [0.9.0])
|
||||
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
PKG_CONFIG=""
|
||||
fi
|
||||
fi[]dnl
|
||||
])dnl PKG_PROG_PKG_CONFIG
|
||||
|
||||
dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
dnl -------------------------------------------------------------------
|
||||
dnl Since: 0.18
|
||||
dnl
|
||||
dnl Check to see whether a particular set of modules exists. Similar to
|
||||
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
|
||||
dnl
|
||||
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||
dnl only at the first occurence in configure.ac, so if the first place
|
||||
dnl it's called might be skipped (such as if it is within an "if", you
|
||||
dnl have to call PKG_CHECK_EXISTS manually
|
||||
AC_DEFUN([PKG_CHECK_EXISTS],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
|
||||
m4_default([$2], [:])
|
||||
m4_ifvaln([$3], [else
|
||||
$3])dnl
|
||||
fi])
|
||||
|
||||
dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
|
||||
dnl ---------------------------------------------
|
||||
dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
|
||||
dnl pkg_failed based on the result.
|
||||
m4_define([_PKG_CONFIG],
|
||||
[if test -n "$$1"; then
|
||||
pkg_cv_[]$1="$$1"
|
||||
elif test -n "$PKG_CONFIG"; then
|
||||
PKG_CHECK_EXISTS([$3],
|
||||
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
|
||||
test "x$?" != "x0" && pkg_failed=yes ],
|
||||
[pkg_failed=yes])
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi[]dnl
|
||||
])dnl _PKG_CONFIG
|
||||
|
||||
dnl _PKG_SHORT_ERRORS_SUPPORTED
|
||||
dnl ---------------------------
|
||||
dnl Internal check to see if pkg-config supports short errors.
|
||||
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
||||
_pkg_short_errors_supported=yes
|
||||
else
|
||||
_pkg_short_errors_supported=no
|
||||
fi[]dnl
|
||||
])dnl _PKG_SHORT_ERRORS_SUPPORTED
|
||||
|
||||
|
||||
dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
||||
dnl [ACTION-IF-NOT-FOUND])
|
||||
dnl --------------------------------------------------------------
|
||||
dnl Since: 0.4.0
|
||||
dnl
|
||||
dnl Note that if there is a possibility the first call to
|
||||
dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
|
||||
dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
|
||||
AC_DEFUN([PKG_CHECK_MODULES],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
|
||||
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
|
||||
|
||||
pkg_failed=no
|
||||
AC_MSG_CHECKING([for $1])
|
||||
|
||||
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
|
||||
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
|
||||
|
||||
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
|
||||
and $1[]_LIBS to avoid the need to call pkg-config.
|
||||
See the pkg-config man page for more details.])
|
||||
|
||||
if test $pkg_failed = yes; then
|
||||
AC_MSG_RESULT([no])
|
||||
_PKG_SHORT_ERRORS_SUPPORTED
|
||||
if test $_pkg_short_errors_supported = yes; then
|
||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
|
||||
else
|
||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
|
||||
fi
|
||||
# Put the nasty error message in config.log where it belongs
|
||||
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
|
||||
|
||||
m4_default([$4], [AC_MSG_ERROR(
|
||||
[Package requirements ($2) were not met:
|
||||
|
||||
$$1_PKG_ERRORS
|
||||
|
||||
Consider adjusting the PKG_CONFIG_PATH environment variable if you
|
||||
installed software in a non-standard prefix.
|
||||
|
||||
_PKG_TEXT])[]dnl
|
||||
])
|
||||
elif test $pkg_failed = untried; then
|
||||
AC_MSG_RESULT([no])
|
||||
m4_default([$4], [AC_MSG_FAILURE(
|
||||
[The pkg-config script could not be found or is too old. Make sure it
|
||||
is in your PATH or set the PKG_CONFIG environment variable to the full
|
||||
path to pkg-config.
|
||||
|
||||
_PKG_TEXT
|
||||
|
||||
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
|
||||
])
|
||||
else
|
||||
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
||||
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
|
||||
AC_MSG_RESULT([yes])
|
||||
$3
|
||||
fi[]dnl
|
||||
])dnl PKG_CHECK_MODULES
|
||||
|
||||
|
||||
dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
||||
dnl [ACTION-IF-NOT-FOUND])
|
||||
dnl ---------------------------------------------------------------------
|
||||
dnl Since: 0.29
|
||||
dnl
|
||||
dnl Checks for existence of MODULES and gathers its build flags with
|
||||
dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
|
||||
dnl and VARIABLE-PREFIX_LIBS from --libs.
|
||||
dnl
|
||||
dnl Note that if there is a possibility the first call to
|
||||
dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
|
||||
dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
|
||||
dnl configure.ac.
|
||||
AC_DEFUN([PKG_CHECK_MODULES_STATIC],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
_save_PKG_CONFIG=$PKG_CONFIG
|
||||
PKG_CONFIG="$PKG_CONFIG --static"
|
||||
PKG_CHECK_MODULES($@)
|
||||
PKG_CONFIG=$_save_PKG_CONFIG[]dnl
|
||||
])dnl PKG_CHECK_MODULES_STATIC
|
||||
|
||||
|
||||
dnl PKG_INSTALLDIR([DIRECTORY])
|
||||
dnl -------------------------
|
||||
dnl Since: 0.27
|
||||
dnl
|
||||
dnl Substitutes the variable pkgconfigdir as the location where a module
|
||||
dnl should install pkg-config .pc files. By default the directory is
|
||||
dnl $libdir/pkgconfig, but the default can be changed by passing
|
||||
dnl DIRECTORY. The user can override through the --with-pkgconfigdir
|
||||
dnl parameter.
|
||||
AC_DEFUN([PKG_INSTALLDIR],
|
||||
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
|
||||
m4_pushdef([pkg_description],
|
||||
[pkg-config installation directory @<:@]pkg_default[@:>@])
|
||||
AC_ARG_WITH([pkgconfigdir],
|
||||
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
|
||||
[with_pkgconfigdir=]pkg_default)
|
||||
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
|
||||
m4_popdef([pkg_default])
|
||||
m4_popdef([pkg_description])
|
||||
])dnl PKG_INSTALLDIR
|
||||
|
||||
|
||||
dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
|
||||
dnl --------------------------------
|
||||
dnl Since: 0.27
|
||||
dnl
|
||||
dnl Substitutes the variable noarch_pkgconfigdir as the location where a
|
||||
dnl module should install arch-independent pkg-config .pc files. By
|
||||
dnl default the directory is $datadir/pkgconfig, but the default can be
|
||||
dnl changed by passing DIRECTORY. The user can override through the
|
||||
dnl --with-noarch-pkgconfigdir parameter.
|
||||
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
|
||||
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
|
||||
m4_pushdef([pkg_description],
|
||||
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
|
||||
AC_ARG_WITH([noarch-pkgconfigdir],
|
||||
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
|
||||
[with_noarch_pkgconfigdir=]pkg_default)
|
||||
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
|
||||
m4_popdef([pkg_default])
|
||||
m4_popdef([pkg_description])
|
||||
])dnl PKG_NOARCH_INSTALLDIR
|
||||
|
||||
|
||||
dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
|
||||
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
dnl -------------------------------------------
|
||||
dnl Since: 0.28
|
||||
dnl
|
||||
dnl Retrieves the value of the pkg-config variable for the given module.
|
||||
AC_DEFUN([PKG_CHECK_VAR],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
|
||||
|
||||
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
|
||||
AS_VAR_COPY([$1], [pkg_cv_][$1])
|
||||
|
||||
AS_VAR_IF([$1], [""], [$5], [$4])dnl
|
||||
])dnl PKG_CHECK_VAR
|
||||
|
||||
dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
|
||||
dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
|
||||
dnl [DESCRIPTION], [DEFAULT])
|
||||
dnl ------------------------------------------
|
||||
dnl
|
||||
dnl Prepare a "--with-" configure option using the lowercase
|
||||
dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
|
||||
dnl PKG_CHECK_MODULES in a single macro.
|
||||
AC_DEFUN([PKG_WITH_MODULES],
|
||||
[
|
||||
m4_pushdef([with_arg], m4_tolower([$1]))
|
||||
|
||||
m4_pushdef([description],
|
||||
[m4_default([$5], [build with ]with_arg[ support])])
|
||||
|
||||
m4_pushdef([def_arg], [m4_default([$6], [auto])])
|
||||
m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
|
||||
m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
|
||||
|
||||
m4_case(def_arg,
|
||||
[yes],[m4_pushdef([with_without], [--without-]with_arg)],
|
||||
[m4_pushdef([with_without],[--with-]with_arg)])
|
||||
|
||||
AC_ARG_WITH(with_arg,
|
||||
AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
|
||||
[AS_TR_SH([with_]with_arg)=def_arg])
|
||||
|
||||
AS_CASE([$AS_TR_SH([with_]with_arg)],
|
||||
[yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
|
||||
[auto],[PKG_CHECK_MODULES([$1],[$2],
|
||||
[m4_n([def_action_if_found]) $3],
|
||||
[m4_n([def_action_if_not_found]) $4])])
|
||||
|
||||
m4_popdef([with_arg])
|
||||
m4_popdef([description])
|
||||
m4_popdef([def_arg])
|
||||
|
||||
])dnl PKG_WITH_MODULES
|
||||
|
||||
dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
|
||||
dnl [DESCRIPTION], [DEFAULT])
|
||||
dnl -----------------------------------------------
|
||||
dnl
|
||||
dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
|
||||
dnl check._[VARIABLE-PREFIX] is exported as make variable.
|
||||
AC_DEFUN([PKG_HAVE_WITH_MODULES],
|
||||
[
|
||||
PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
|
||||
|
||||
AM_CONDITIONAL([HAVE_][$1],
|
||||
[test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
|
||||
])dnl PKG_HAVE_WITH_MODULES
|
||||
|
||||
dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
|
||||
dnl [DESCRIPTION], [DEFAULT])
|
||||
dnl ------------------------------------------------------
|
||||
dnl
|
||||
dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
|
||||
dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
|
||||
dnl and preprocessor variable.
|
||||
AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
|
||||
[
|
||||
PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
|
||||
|
||||
AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
|
||||
[AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
|
||||
])dnl PKG_HAVE_DEFINE_WITH_MODULES
|
||||
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -66,7 +410,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
|
|||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -97,7 +441,7 @@ AC_CONFIG_COMMANDS_PRE(
|
|||
Usually this means the macro was only invoked conditionally.]])
|
||||
fi])])
|
||||
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -121,7 +465,7 @@ AC_SUBST([install_sh])])
|
|||
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
|
||||
# From Jim Meyering
|
||||
|
||||
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -154,7 +498,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
|||
]
|
||||
)
|
||||
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -182,7 +526,7 @@ fi
|
|||
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# Copyright (C) 2006-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
#include "psymtab.h"
|
||||
#include "build-id.h"
|
||||
|
||||
#include "pdb.h"
|
||||
|
||||
/* The objfile we are currently reading. */
|
||||
|
||||
static struct objfile *coffread_objfile;
|
||||
|
@ -445,7 +447,7 @@ is_import_fixup_symbol (struct coff_symbol *cs,
|
|||
static struct minimal_symbol *
|
||||
record_minimal_symbol (minimal_symbol_reader &reader,
|
||||
struct coff_symbol *cs, CORE_ADDR address,
|
||||
enum minimal_symbol_type type, int section,
|
||||
enum minimal_symbol_type type, int section,
|
||||
struct objfile *objfile)
|
||||
{
|
||||
/* We don't want TDESC entry points in the minimal symbol table. */
|
||||
|
@ -543,7 +545,7 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
|||
int symtab_offset;
|
||||
int stringtab_offset;
|
||||
int stabstrsize;
|
||||
|
||||
|
||||
info = coff_objfile_data_key.get (objfile);
|
||||
symfile_bfd = abfd; /* Kludge for swap routines. */
|
||||
|
||||
|
@ -631,6 +633,9 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
|||
|
||||
coff_symtab_read (reader, (long) symtab_offset, num_symbols, objfile);
|
||||
|
||||
/* Try reading additional symbols from PDB. */
|
||||
read_pdb(objfile, reader);
|
||||
|
||||
/* Install any minimal symbols that have been collected as the
|
||||
current minimal symbols for this objfile. */
|
||||
|
||||
|
@ -712,15 +717,24 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
|||
std::string debugfile = find_separate_debug_file_by_buildid (objfile);
|
||||
|
||||
if (debugfile.empty ())
|
||||
debugfile = find_separate_debug_file_by_debuglink (objfile);
|
||||
debugfile = find_separate_debug_file_by_debuglink (objfile);
|
||||
|
||||
if (!debugfile.empty ())
|
||||
{
|
||||
gdb_bfd_ref_ptr debug_bfd (symfile_bfd_open (debugfile.c_str ()));
|
||||
{
|
||||
gdb_bfd_ref_ptr debug_bfd (symfile_bfd_open (debugfile.c_str ()));
|
||||
|
||||
symbol_file_add_separate (debug_bfd.get (), debugfile.c_str (),
|
||||
symfile_flags, objfile);
|
||||
}
|
||||
symbol_file_add_separate (debug_bfd.get (), debugfile.c_str (),
|
||||
symfile_flags, objfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
gdb_bfd_ref_ptr debug_bfd (try_load_pdb_bfd (objfile));
|
||||
if (debug_bfd.get ())
|
||||
{
|
||||
//symbol_file_add_separate (debug_bfd.get (), debug_bfd->filename,
|
||||
// symfile_flags, objfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1053,7 +1067,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
|
|||
newobj = push_context (depth, fcn_start_addr);
|
||||
fcn_cs_saved.c_name = getsymname (&fcn_sym_saved);
|
||||
newobj->name =
|
||||
process_coff_symbol (&fcn_cs_saved,
|
||||
process_coff_symbol (&fcn_cs_saved,
|
||||
&fcn_aux_saved, objfile);
|
||||
}
|
||||
else if (strcmp (cs->c_name, ".ef") == 0)
|
||||
|
@ -1304,7 +1318,7 @@ init_stringtab (bfd *abfd, long offset, gdb::unique_xmalloc_ptr<char> *storage)
|
|||
if (length == sizeof length) /* Empty table -- just the count. */
|
||||
return 0;
|
||||
|
||||
val = bfd_bread (stringtab + sizeof lengthbuf,
|
||||
val = bfd_bread (stringtab + sizeof lengthbuf,
|
||||
length - sizeof lengthbuf, abfd);
|
||||
if (val != length - sizeof lengthbuf || stringtab[length - 1] != '\0')
|
||||
return -1;
|
||||
|
@ -1464,8 +1478,8 @@ patch_type (struct type *type, struct type *real_type)
|
|||
TYPE_FIELDS (target) = (struct field *) TYPE_ALLOC (target,
|
||||
field_size);
|
||||
|
||||
memcpy (TYPE_FIELDS (target),
|
||||
TYPE_FIELDS (real_target),
|
||||
memcpy (TYPE_FIELDS (target),
|
||||
TYPE_FIELDS (real_target),
|
||||
field_size);
|
||||
|
||||
if (TYPE_NAME (real_target))
|
||||
|
@ -1674,7 +1688,7 @@ process_coff_symbol (struct coff_symbol *cs,
|
|||
/* If we are giving a name to a type such as
|
||||
"pointer to foo" or "function returning foo", we
|
||||
better not set the TYPE_NAME. If the program
|
||||
contains "typedef char *caddr_t;", we don't want
|
||||
contains "typedef char *caddr_t;", we don't want
|
||||
all variables of type char * to print as caddr_t.
|
||||
This is not just a consequence of GDB's type
|
||||
management; CC and GCC (at least through version
|
||||
|
@ -1822,9 +1836,9 @@ decode_type (struct coff_symbol *cs, unsigned int c_type,
|
|||
return the type that the function returns. */
|
||||
|
||||
static struct type *
|
||||
decode_function_type (struct coff_symbol *cs,
|
||||
decode_function_type (struct coff_symbol *cs,
|
||||
unsigned int c_type,
|
||||
union internal_auxent *aux,
|
||||
union internal_auxent *aux,
|
||||
struct objfile *objfile)
|
||||
{
|
||||
if (aux->x_sym.x_tagndx.l == 0)
|
||||
|
@ -1837,9 +1851,9 @@ decode_function_type (struct coff_symbol *cs,
|
|||
/* Basic C types. */
|
||||
|
||||
static struct type *
|
||||
decode_base_type (struct coff_symbol *cs,
|
||||
decode_base_type (struct coff_symbol *cs,
|
||||
unsigned int c_type,
|
||||
union internal_auxent *aux,
|
||||
union internal_auxent *aux,
|
||||
struct objfile *objfile)
|
||||
{
|
||||
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
||||
|
|
|
@ -623,6 +623,15 @@ enable_option_checking=no
|
|||
ac_header_list=
|
||||
ac_subst_vars='LTLIBOBJS
|
||||
LIBOBJS
|
||||
LLVM_LIBS
|
||||
LLVM_LDFLAGS
|
||||
LLVM_CXXFLAGS
|
||||
LLVM_CONFIG_FOUND
|
||||
RADARE_LIBS
|
||||
RADARE_CFLAGS
|
||||
PKG_CONFIG_LIBDIR
|
||||
PKG_CONFIG_PATH
|
||||
PKG_CONFIG
|
||||
GCORE_TRANSFORM_NAME
|
||||
GDB_TRANSFORM_NAME
|
||||
XSLTPROC
|
||||
|
@ -928,7 +937,12 @@ MAKEINFO
|
|||
MAKEINFOFLAGS
|
||||
YACC
|
||||
YFLAGS
|
||||
XMKMF'
|
||||
XMKMF
|
||||
PKG_CONFIG
|
||||
PKG_CONFIG_PATH
|
||||
PKG_CONFIG_LIBDIR
|
||||
RADARE_CFLAGS
|
||||
RADARE_LIBS'
|
||||
ac_subdirs_all='testsuite
|
||||
gdbtk
|
||||
gdbserver'
|
||||
|
@ -1601,7 +1615,7 @@ Optional Packages:
|
|||
--with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
|
||||
--with-curses use the curses library instead of the termcap
|
||||
library
|
||||
--with-pkgversion=PKG Use PKG in the version string in place of "GDB"
|
||||
--with-pkgversion=PKG Use PKG in the version string in place of "gdb-msvc"
|
||||
--with-bugurl=URL Direct users to URL to report a bug
|
||||
--with-system-zlib use installed libz
|
||||
--with-gnu-ld assume the C compiler uses GNU ld default=no
|
||||
|
@ -1668,6 +1682,14 @@ Some influential environment variables:
|
|||
This script will default YFLAGS to the empty string to avoid a
|
||||
default value of `-d' given by some make applications.
|
||||
XMKMF Path to xmkmf, Makefile generator for X Window System
|
||||
PKG_CONFIG path to pkg-config utility
|
||||
PKG_CONFIG_PATH
|
||||
directories to add to pkg-config's search path
|
||||
PKG_CONFIG_LIBDIR
|
||||
path overriding pkg-config's built-in search path
|
||||
RADARE_CFLAGS
|
||||
C compiler flags for RADARE, overriding pkg-config
|
||||
RADARE_LIBS linker flags for RADARE, overriding pkg-config
|
||||
|
||||
Use these variables to override the choices made by `configure' or to help
|
||||
it to find libraries and programs with nonstandard names/locations.
|
||||
|
@ -7053,7 +7075,7 @@ if test "${with_pkgversion+set}" = set; then :
|
|||
*) PKGVERSION="($withval) " ;;
|
||||
esac
|
||||
else
|
||||
PKGVERSION="(GDB) "
|
||||
PKGVERSION="(gdb-msvc) "
|
||||
|
||||
fi
|
||||
|
||||
|
@ -19007,6 +19029,265 @@ ac_config_files="$ac_config_files gcore"
|
|||
ac_config_files="$ac_config_files Makefile gdb-gdb.gdb gdb-gdb.py doc/Makefile data-directory/Makefile"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
|
||||
if test -n "$ac_tool_prefix"; then
|
||||
# Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
|
||||
set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_path_PKG_CONFIG+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
case $PKG_CONFIG in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
|
||||
$as_echo "$PKG_CONFIG" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
if test -z "$ac_cv_path_PKG_CONFIG"; then
|
||||
ac_pt_PKG_CONFIG=$PKG_CONFIG
|
||||
# Extract the first word of "pkg-config", so it can be a program name with args.
|
||||
set dummy pkg-config; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
case $ac_pt_PKG_CONFIG in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
|
||||
if test -n "$ac_pt_PKG_CONFIG"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
|
||||
$as_echo "$ac_pt_PKG_CONFIG" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
if test "x$ac_pt_PKG_CONFIG" = x; then
|
||||
PKG_CONFIG=""
|
||||
else
|
||||
case $cross_compiling:$ac_tool_warned in
|
||||
yes:)
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
|
||||
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
|
||||
ac_tool_warned=yes ;;
|
||||
esac
|
||||
PKG_CONFIG=$ac_pt_PKG_CONFIG
|
||||
fi
|
||||
else
|
||||
PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
|
||||
fi
|
||||
|
||||
fi
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
_pkg_min_version=0.9.0
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
|
||||
$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
PKG_CONFIG=""
|
||||
fi
|
||||
fi
|
||||
|
||||
pkg_failed=no
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RADARE" >&5
|
||||
$as_echo_n "checking for RADARE... " >&6; }
|
||||
|
||||
if test -n "$RADARE_CFLAGS"; then
|
||||
pkg_cv_RADARE_CFLAGS="$RADARE_CFLAGS"
|
||||
elif test -n "$PKG_CONFIG"; then
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"r_bin r_util\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "r_bin r_util") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
pkg_cv_RADARE_CFLAGS=`$PKG_CONFIG --cflags "r_bin r_util" 2>/dev/null`
|
||||
test "x$?" != "x0" && pkg_failed=yes
|
||||
else
|
||||
pkg_failed=yes
|
||||
fi
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi
|
||||
if test -n "$RADARE_LIBS"; then
|
||||
pkg_cv_RADARE_LIBS="$RADARE_LIBS"
|
||||
elif test -n "$PKG_CONFIG"; then
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"r_bin r_util\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "r_bin r_util") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
pkg_cv_RADARE_LIBS=`$PKG_CONFIG --libs "r_bin r_util" 2>/dev/null`
|
||||
test "x$?" != "x0" && pkg_failed=yes
|
||||
else
|
||||
pkg_failed=yes
|
||||
fi
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test $pkg_failed = yes; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
||||
_pkg_short_errors_supported=yes
|
||||
else
|
||||
_pkg_short_errors_supported=no
|
||||
fi
|
||||
if test $_pkg_short_errors_supported = yes; then
|
||||
RADARE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "r_bin r_util" 2>&1`
|
||||
else
|
||||
RADARE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "r_bin r_util" 2>&1`
|
||||
fi
|
||||
# Put the nasty error message in config.log where it belongs
|
||||
echo "$RADARE_PKG_ERRORS" >&5
|
||||
|
||||
as_fn_error $? "Package requirements (r_bin r_util) were not met:
|
||||
|
||||
$RADARE_PKG_ERRORS
|
||||
|
||||
Consider adjusting the PKG_CONFIG_PATH environment variable if you
|
||||
installed software in a non-standard prefix.
|
||||
|
||||
Alternatively, you may set the environment variables RADARE_CFLAGS
|
||||
and RADARE_LIBS to avoid the need to call pkg-config.
|
||||
See the pkg-config man page for more details." "$LINENO" 5
|
||||
elif test $pkg_failed = untried; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
|
||||
is in your PATH or set the PKG_CONFIG environment variable to the full
|
||||
path to pkg-config.
|
||||
|
||||
Alternatively, you may set the environment variables RADARE_CFLAGS
|
||||
and RADARE_LIBS to avoid the need to call pkg-config.
|
||||
See the pkg-config man page for more details.
|
||||
|
||||
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
|
||||
See \`config.log' for more details" "$LINENO" 5; }
|
||||
else
|
||||
RADARE_CFLAGS=$pkg_cv_RADARE_CFLAGS
|
||||
RADARE_LIBS=$pkg_cv_RADARE_LIBS
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
|
||||
fi
|
||||
|
||||
# Extract the first word of "llvm-config", so it can be a program name with args.
|
||||
set dummy llvm-config; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_prog_LLVM_CONFIG_FOUND+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test -n "$LLVM_CONFIG_FOUND"; then
|
||||
ac_cv_prog_LLVM_CONFIG_FOUND="$LLVM_CONFIG_FOUND" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_LLVM_CONFIG_FOUND="yes"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
fi
|
||||
fi
|
||||
LLVM_CONFIG_FOUND=$ac_cv_prog_LLVM_CONFIG_FOUND
|
||||
if test -n "$LLVM_CONFIG_FOUND"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLVM_CONFIG_FOUND" >&5
|
||||
$as_echo "$LLVM_CONFIG_FOUND" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
if test x"$LLVM_CONFIG_FOUND" != x"yes"; then :
|
||||
as_fn_error $? "Please make sure llvm-config is in your PATH." "$LINENO" 5
|
||||
fi
|
||||
LLVM_CXXFLAGS=$(llvm-config --cxxflags)
|
||||
|
||||
LLVM_LDFLAGS=$(llvm-config --ldflags)
|
||||
|
||||
LLVM_LIBS=$(llvm-config --libs)
|
||||
|
||||
|
||||
cat >confcache <<\_ACEOF
|
||||
# This file is a shell script that caches the results of configure
|
||||
# tests run on this system so they can be shared between configure
|
||||
|
|
|
@ -429,7 +429,7 @@ AC_ARG_ENABLE([codesign],
|
|||
[CODESIGN_CERT=$enableval])
|
||||
AC_SUBST([CODESIGN_CERT])
|
||||
|
||||
ACX_PKGVERSION([GDB])
|
||||
ACX_PKGVERSION([gdb-msvc])
|
||||
ACX_BUGURL([http://www.gnu.org/software/gdb/bugs/])
|
||||
AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
|
||||
AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
|
||||
|
@ -2233,4 +2233,12 @@ GDB_AC_TRANSFORM([gcore], [GCORE_TRANSFORM_NAME])
|
|||
AC_CONFIG_FILES([gcore], [chmod +x gcore])
|
||||
AC_CONFIG_FILES([Makefile gdb-gdb.gdb gdb-gdb.py doc/Makefile data-directory/Makefile])
|
||||
|
||||
PKG_CHECK_MODULES([RADARE], [r_bin r_util])
|
||||
|
||||
AC_CHECK_PROG(LLVM_CONFIG_FOUND, llvm-config, yes)
|
||||
AS_IF([test x"$LLVM_CONFIG_FOUND" != x"yes"], [AC_MSG_ERROR([Please make sure llvm-config is in your PATH.])])
|
||||
AC_SUBST([LLVM_CXXFLAGS], [$(llvm-config --cxxflags)])
|
||||
AC_SUBST([LLVM_LDFLAGS], [$(llvm-config --ldflags)])
|
||||
AC_SUBST([LLVM_LIBS], [$(llvm-config --libs)])
|
||||
|
||||
AC_OUTPUT
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
|
||||
# generated automatically by aclocal 1.16.2 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
|
||||
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -14,7 +14,7 @@
|
|||
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -48,7 +48,7 @@ fi])])
|
|||
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
|
||||
# From Jim Meyering
|
||||
|
||||
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -81,7 +81,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
|||
]
|
||||
)
|
||||
|
||||
# Copyright (C) 2006-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2020 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
|
|
@ -0,0 +1,414 @@
|
|||
/* Includes code from radare2:
|
||||
radare - LGPL - Copyright 2014 - inisider
|
||||
(https://github.com/radareorg/radare2) */
|
||||
|
||||
/*
|
||||
|
||||
HACK: Honestly, this whole thing is a hack:
|
||||
|
||||
1. radare's PDB functions aren't great for external use,
|
||||
2. few if any edge cases work,
|
||||
3. we pretend our PDB symbols are minisyms, and
|
||||
4. no tests.
|
||||
|
||||
*/
|
||||
|
||||
#include "pdb.h"
|
||||
|
||||
extern const bfd_target pdb_vec; //from targets.c
|
||||
|
||||
//BEGIN HACK (conflicting symbols)
|
||||
#undef QUIT
|
||||
|
||||
#include <libr/r_pdb.h>
|
||||
|
||||
#undef QUIT
|
||||
#define QUIT maybe_quit ()
|
||||
#undef B_SET
|
||||
//END HACK (conflicting symbols)
|
||||
|
||||
#include "objfiles.h"
|
||||
#include "gdb/fileio.h"
|
||||
|
||||
#include "gdbsupport/pathstuff.h"
|
||||
#include <regex>
|
||||
#include <fstream>
|
||||
#include <cassert>
|
||||
|
||||
extern "C" {
|
||||
#include <coff/internal.h>
|
||||
#include <coff/x86_64.h> //this is really dumb but oh well
|
||||
#include <coff/pe.h>
|
||||
#include <libcoff.h>
|
||||
#include <libpei.h>
|
||||
}
|
||||
|
||||
#include "psympriv.h"
|
||||
|
||||
#include "bfd/pdb-types.h"
|
||||
|
||||
struct find_section_by_name_args {
|
||||
const char *name;
|
||||
asection **resultp;
|
||||
};
|
||||
|
||||
static void
|
||||
find_section_by_name_filter (bfd *abfd, asection *sect, void *obj)
|
||||
{
|
||||
(void) abfd;
|
||||
|
||||
auto *args = (struct find_section_by_name_args *) obj;
|
||||
|
||||
if (strcmp (sect->name, args->name) == 0)
|
||||
*args->resultp = sect;
|
||||
}
|
||||
|
||||
static struct bfd_section *
|
||||
section_by_name (const char *name, struct objfile *objfile)
|
||||
{
|
||||
asection *sect = nullptr;
|
||||
struct find_section_by_name_args args{};
|
||||
args.name = name;
|
||||
args.resultp = §
|
||||
bfd_map_over_sections (objfile->obfd, find_section_by_name_filter, &args);
|
||||
return sect;
|
||||
}
|
||||
|
||||
static std::unique_ptr<R_PDB>
|
||||
get_r_pdb (const std::string & path)
|
||||
{
|
||||
R_PDB pdb = {nullptr};
|
||||
if (std::ifstream (path).good ())
|
||||
{
|
||||
if (init_pdb_parser (&pdb, path.c_str ()))
|
||||
return std::make_unique<R_PDB> (pdb);
|
||||
}
|
||||
else if (path.rfind ("target:", 0) == 0)
|
||||
{
|
||||
auto target = find_target_at (process_stratum);
|
||||
if (!target)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void *buffer;
|
||||
size_t length;
|
||||
|
||||
{ //begin read PDB into buffer
|
||||
int errno;
|
||||
|
||||
auto fd = target->fileio_open (nullptr,
|
||||
path.c_str () + sizeof ("target:") - 1,
|
||||
FILEIO_O_RDONLY,
|
||||
0 /* mode */,
|
||||
true /* warn_if_slow */,
|
||||
&errno);
|
||||
|
||||
if (fd == -1)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct stat st{};
|
||||
if (target->fileio_fstat (fd, &st, &errno) == -1)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
length = st.st_size;
|
||||
buffer = xmalloc (length);
|
||||
|
||||
file_ptr pos = 0, bytes;
|
||||
while (length > pos)
|
||||
{
|
||||
bytes = target->fileio_pread (fd,
|
||||
(gdb_byte *) buffer + pos,
|
||||
length - pos,
|
||||
pos,
|
||||
&errno);
|
||||
if (bytes == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (bytes == -1)
|
||||
{
|
||||
xfree (buffer);
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos += bytes;
|
||||
}
|
||||
}
|
||||
assert (pos == length);
|
||||
|
||||
target->fileio_close (fd, &errno);
|
||||
} //end read PDB into buffer
|
||||
|
||||
auto r_buffer = r_buf_new_with_bytes ((const ut8 *) buffer, length);
|
||||
if (init_pdb_parser_with_buf (&pdb, r_buffer))
|
||||
{
|
||||
xfree (buffer);
|
||||
return std::make_unique<R_PDB> (pdb);
|
||||
}
|
||||
|
||||
xfree (buffer);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static gdb::optional<std::string>
|
||||
get_codeview_pdb_path (objfile *objfile)
|
||||
{
|
||||
gdb::optional<std::string> nullopt;
|
||||
|
||||
bfd *abfd = objfile->obfd;
|
||||
|
||||
pe_data_type *pe = pe_data (abfd);
|
||||
struct internal_extra_pe_aouthdr *extra = &pe->pe_opthdr;
|
||||
|
||||
bfd_size_type size = extra->DataDirectory[PE_DEBUG_DATA].Size;
|
||||
if (size == 0)
|
||||
return nullopt;
|
||||
bfd_vma addr = extra->DataDirectory[PE_DEBUG_DATA].VirtualAddress + extra->ImageBase;
|
||||
|
||||
asection *section;
|
||||
for (section = abfd->sections; section != nullptr; section = section->next)
|
||||
{
|
||||
if ((addr >= section->vma) && (addr < (section->vma + section->size)))
|
||||
break;
|
||||
}
|
||||
if (section == nullptr || !(section->flags & SEC_HAS_CONTENTS) || section->size < size)
|
||||
return nullopt;
|
||||
|
||||
bfd_size_type data_offset;
|
||||
data_offset = addr - section->vma;
|
||||
if (size > (section->size - data_offset))
|
||||
return nullopt;
|
||||
|
||||
bfd_byte *data = nullptr;
|
||||
if (!bfd_malloc_and_get_section (abfd, section, &data))
|
||||
return nullopt;
|
||||
|
||||
for (auto i = 0; i < size / sizeof (struct external_IMAGE_DEBUG_DIRECTORY); i++)
|
||||
{
|
||||
struct external_IMAGE_DEBUG_DIRECTORY *ext
|
||||
= &((struct external_IMAGE_DEBUG_DIRECTORY *) (data + data_offset))[i];
|
||||
struct internal_IMAGE_DEBUG_DIRECTORY idd{};
|
||||
|
||||
_bfd_pei_swap_debugdir_in (abfd, ext, &idd);
|
||||
|
||||
if (idd.Type == PE_IMAGE_DEBUG_TYPE_CODEVIEW)
|
||||
{
|
||||
char buffer[256 + 1] ATTRIBUTE_ALIGNED_ALIGNOF (CODEVIEW_INFO);
|
||||
auto *cvinfo = (CODEVIEW_INFO *) buffer;
|
||||
|
||||
if (!_bfd_pei_slurp_codeview_record (abfd, (file_ptr) idd.PointerToRawData,
|
||||
idd.SizeOfData, cvinfo))
|
||||
continue;
|
||||
|
||||
return std::string (cvinfo->PdbFileName);
|
||||
}
|
||||
}
|
||||
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
static std::vector<std::string>
|
||||
get_pdb_paths (struct objfile *objfile)
|
||||
{
|
||||
std::vector<std::string> paths;
|
||||
|
||||
auto codeview_pdb_path = get_codeview_pdb_path (objfile);
|
||||
if (!codeview_pdb_path)
|
||||
return paths; //if there is no CodeView PDB path, we assume no PDB exists
|
||||
|
||||
//TODO: Only push_back 'target:' paths if we have a remote target
|
||||
|
||||
paths.push_back (*codeview_pdb_path);
|
||||
paths.push_back ("target:" + *codeview_pdb_path);
|
||||
|
||||
auto real_path = gdb_realpath (objfile->original_name);
|
||||
auto naive_pdb_path = std::regex_replace (std::string (real_path.get ()),
|
||||
std::regex ("\\.[^.]*$"),
|
||||
".pdb");
|
||||
naive_pdb_path = std::regex_replace (naive_pdb_path,
|
||||
std::regex ("target:"),
|
||||
"");
|
||||
|
||||
paths.push_back (naive_pdb_path);
|
||||
paths.push_back ("target:" + naive_pdb_path);
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
static std::tuple<std::unique_ptr<R_PDB>, std::string>
|
||||
load_pdb (objfile *objfile)
|
||||
{
|
||||
auto paths = get_pdb_paths (objfile);
|
||||
|
||||
if (paths.empty ()) return {nullptr, std::string ()};
|
||||
|
||||
for (auto & path : paths)
|
||||
{
|
||||
auto p = get_r_pdb (path);
|
||||
if (p)
|
||||
return {std::move (p), path};
|
||||
}
|
||||
|
||||
return {nullptr, std::string ()};
|
||||
}
|
||||
|
||||
gdb_bfd_ref_ptr
|
||||
try_load_pdb_bfd (objfile *objfile)
|
||||
{
|
||||
auto paths = get_pdb_paths (objfile);
|
||||
|
||||
if (paths.empty ()) return nullptr;
|
||||
|
||||
for (auto & path : paths)
|
||||
{
|
||||
try
|
||||
{
|
||||
gdb_bfd_ref_ptr debug_bfd (symfile_bfd_open (path.c_str ()));
|
||||
if (debug_bfd.get () && debug_bfd.get ()->xvec == &pdb_vec)
|
||||
{
|
||||
return debug_bfd;
|
||||
}
|
||||
}
|
||||
catch (gdb_exception_error & error)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
read_pdb (struct objfile *objfile, minimal_symbol_reader & reader)
|
||||
{
|
||||
std::unique_ptr<R_PDB> pdb;
|
||||
std::string pdb_path;
|
||||
std::tie (pdb, pdb_path) = load_pdb (objfile);
|
||||
|
||||
if (!pdb)
|
||||
return;
|
||||
|
||||
if (pdb->pdb_parse (pdb.get ()))
|
||||
{
|
||||
SStreamParseFunc *omap = nullptr, *sctns = nullptr, *sctns_orig = nullptr, *gsym = nullptr, *tmp;
|
||||
SIMAGE_SECTION_HEADER *sctn_header;
|
||||
SGDATAStream *gsym_data_stream;
|
||||
SPEStream *pe_stream = nullptr;
|
||||
SGlobal *gdata;
|
||||
RListIter *it;
|
||||
RList *l;
|
||||
|
||||
l = pdb->pdb_streams2;
|
||||
it = r_list_iterator (l);
|
||||
while (r_list_iter_next (it))
|
||||
{
|
||||
tmp = (SStreamParseFunc *) r_list_iter_get (it);
|
||||
switch (tmp->type)
|
||||
{
|
||||
case ePDB_STREAM_SECT__HDR_ORIG:
|
||||
sctns_orig = tmp;
|
||||
break;
|
||||
case ePDB_STREAM_SECT_HDR:
|
||||
sctns = tmp;
|
||||
break;
|
||||
case ePDB_STREAM_OMAP_FROM_SRC:
|
||||
omap = tmp;
|
||||
break;
|
||||
case ePDB_STREAM_GSYM:
|
||||
gsym = tmp;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!gsym)
|
||||
{
|
||||
eprintf ("There is no global symbols in current PDB.\n");
|
||||
return;
|
||||
}
|
||||
gsym_data_stream = (SGDATAStream *) gsym->stream;
|
||||
if ((omap != nullptr) && (sctns_orig != nullptr))
|
||||
{
|
||||
pe_stream = (SPEStream *) sctns_orig->stream;
|
||||
}
|
||||
else if (sctns)
|
||||
{
|
||||
pe_stream = (SPEStream *) sctns->stream;
|
||||
}
|
||||
if (!pe_stream)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
printf_filtered (_("Reading symbols from %s...\n"), pdb_path.c_str ());
|
||||
|
||||
it = r_list_iterator (gsym_data_stream->globals_list);
|
||||
while (r_list_iter_next (it))
|
||||
{
|
||||
gdata = (SGlobal *) r_list_iter_get (it);
|
||||
sctn_header = (SIMAGE_SECTION_HEADER *) r_list_get_n (pe_stream->sections_hdrs,
|
||||
gdata->segment - 1);
|
||||
if (sctn_header)
|
||||
{
|
||||
asection *sect = section_by_name (sctn_header->name, objfile);
|
||||
|
||||
auto section = sect ? sect->index : -1;
|
||||
auto section_address = sect ? bfd_section_vma (sect) : 0;
|
||||
auto address = section_address + gdata->offset;
|
||||
if (address == 0)
|
||||
continue; //we don't want to record unresolved symbols or something?
|
||||
auto type = mst_text; //FIXME
|
||||
reader.record_with_info (gdata->name.name, address, type, section);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pdb->finish_pdb_parse (pdb.get ());
|
||||
}
|
||||
|
||||
static void
|
||||
pdb_sym_new_init (objfile *objfile)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
pdb_sym_init (objfile *objfile)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
pdb_sym_read (objfile *objfile, symfile_add_flags symfile_flags)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
pdb_sym_finish (objfile *objfile)
|
||||
{
|
||||
}
|
||||
|
||||
const struct sym_fns pdb_sym_fns = {
|
||||
pdb_sym_new_init,
|
||||
pdb_sym_init,
|
||||
pdb_sym_read,
|
||||
nullptr, /* sym_read_psymbols */
|
||||
pdb_sym_finish,
|
||||
default_symfile_offsets,
|
||||
default_symfile_segments,
|
||||
nullptr, /* sym_read_linetable */
|
||||
default_symfile_relocate,
|
||||
nullptr, /* sym_probe_fns */
|
||||
&psym_functions
|
||||
};
|
||||
|
||||
void
|
||||
_initialize_pdb ()
|
||||
{
|
||||
add_symtab_fns (bfd_target_pdb_flavour, &pdb_sym_fns);
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
#include "defs.h"
|
||||
#include "symtab.h"
|
||||
#include "minsyms.h"
|
||||
#include "gdb_bfd.h"
|
||||
|
||||
extern void
|
||||
read_pdb (struct objfile *objfile, minimal_symbol_reader & reader);
|
||||
|
||||
extern gdb_bfd_ref_ptr
|
||||
try_load_pdb_bfd (objfile *objfile);
|
|
@ -1366,6 +1366,8 @@ print_gdb_version (struct ui_file *stream, bool interactive)
|
|||
|
||||
fprintf_filtered (stream,
|
||||
"Copyright (C) 2020 Free Software Foundation, Inc.\n");
|
||||
fprintf_filtered (stream,
|
||||
"Copyright (C) 2020 Les De Ridder (MSVC patches) <https://lesderid.net>\n");
|
||||
|
||||
/* Following the copyright is a brief statement that the program is
|
||||
free software, that users are free to copy and change it on
|
||||
|
|
|
@ -1 +1 @@
|
|||
9.2
|
||||
9.2+0.2
|
||||
|
|
|
@ -167,7 +167,7 @@ typedef struct _CODEVIEW_INFO
|
|||
char Signature[CV_INFO_SIGNATURE_LENGTH];
|
||||
unsigned int SignatureLength;
|
||||
unsigned long Age;
|
||||
// char PdbFileName[];
|
||||
char PdbFileName[220]; //HACK
|
||||
} CODEVIEW_INFO;
|
||||
|
||||
/* Default image base for NT. */
|
||||
|
|
|
@ -57,9 +57,10 @@ extern "C" {
|
|||
#define DMGL_GNAT (1 << 15)
|
||||
#define DMGL_DLANG (1 << 16)
|
||||
#define DMGL_RUST (1 << 17) /* Rust wraps GNU_V3 style mangling. */
|
||||
#define DMGL_MSVC (1 << 30)
|
||||
|
||||
/* If none of these are set, use 'current_demangling_style' as the default. */
|
||||
#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT|DMGL_DLANG|DMGL_RUST)
|
||||
#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT|DMGL_DLANG|DMGL_RUST|DMGL_MSVC)
|
||||
|
||||
/* Disable a limit on the depth of recursion in mangled strings.
|
||||
Note if this limit is disabled then stack exhaustion is possible when
|
||||
|
@ -89,7 +90,8 @@ extern enum demangling_styles
|
|||
java_demangling = DMGL_JAVA,
|
||||
gnat_demangling = DMGL_GNAT,
|
||||
dlang_demangling = DMGL_DLANG,
|
||||
rust_demangling = DMGL_RUST
|
||||
rust_demangling = DMGL_RUST,
|
||||
msvc_demangling = DMGL_MSVC
|
||||
} current_demangling_style;
|
||||
|
||||
/* Define string names for the various demangling styles. */
|
||||
|
@ -101,6 +103,7 @@ extern enum demangling_styles
|
|||
#define GNAT_DEMANGLING_STYLE_STRING "gnat"
|
||||
#define DLANG_DEMANGLING_STYLE_STRING "dlang"
|
||||
#define RUST_DEMANGLING_STYLE_STRING "rust"
|
||||
#define MSVC_DEMANGLING_STYLE_STRING "msvc"
|
||||
|
||||
/* Some macros to test what demangling style is active. */
|
||||
|
||||
|
@ -111,6 +114,7 @@ extern enum demangling_styles
|
|||
#define GNAT_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNAT)
|
||||
#define DLANG_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_DLANG)
|
||||
#define RUST_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_RUST)
|
||||
#define MSVC_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_MSVC)
|
||||
|
||||
/* Provide information about the available demangle styles. This code is
|
||||
pulled from gdb into libiberty because it is useful to binutils also. */
|
||||
|
@ -180,6 +184,9 @@ rust_demangle_sym (char *sym);
|
|||
extern char *
|
||||
rust_demangle (const char *mangled, int options);
|
||||
|
||||
extern char*
|
||||
msvc_demangle(const char* mangled, int options);
|
||||
|
||||
enum gnu_v3_ctor_kinds {
|
||||
gnu_v3_complete_object_ctor = 1,
|
||||
gnu_v3_base_object_ctor,
|
||||
|
|
|
@ -145,6 +145,7 @@ CFILES = alloca.c argv.c asprintf.c atexit.c \
|
|||
physmem.c putenv.c \
|
||||
random.c regex.c rename.c rindex.c \
|
||||
rust-demangle.c \
|
||||
msvc-demangle.cpp \
|
||||
safe-ctype.c setenv.c setproctitle.c sha1.c sigsetmask.c \
|
||||
simple-object.c simple-object-coff.c simple-object-elf.c \
|
||||
simple-object-mach-o.c simple-object-xcoff.c \
|
||||
|
@ -183,6 +184,7 @@ REQUIRED_OFILES = \
|
|||
./pex-common.$(objext) ./pex-one.$(objext) \
|
||||
./@pexecute@.$(objext) ./vprintf-support.$(objext) \
|
||||
./rust-demangle.$(objext) \
|
||||
./msvc-demangle.$(objext) \
|
||||
./safe-ctype.$(objext) \
|
||||
./simple-object.$(objext) ./simple-object-coff.$(objext) \
|
||||
./simple-object-elf.$(objext) ./simple-object-mach-o.$(objext) \
|
||||
|
@ -1200,6 +1202,15 @@ $(CONFIGURED_OFILES): stamp-picdir stamp-noasandir
|
|||
else true; fi
|
||||
$(COMPILE.c) $(srcdir)/rust-demangle.c $(OUTPUT_OPTION)
|
||||
|
||||
./msvc-demangle.$(objext): $(srcdir)/msvc-demangle.cpp
|
||||
if [ x"$(PICFLAG)" != x ]; then \
|
||||
$(COMPILE.c) $(PICFLAG) $(srcdir)/msvc-demangle.cpp -o pic/$@; \
|
||||
else true; fi
|
||||
if [ x"$(NOASANFLAG)" != x ]; then \
|
||||
$(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/msvc-demangle.cpp -o noasan/$@; \
|
||||
else true; fi
|
||||
$(COMPILE.c) $(srcdir)/msvc-demangle.cpp $(OUTPUT_OPTION)
|
||||
|
||||
./safe-ctype.$(objext): $(srcdir)/safe-ctype.c $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/safe-ctype.h
|
||||
if [ x"$(PICFLAG)" != x ]; then \
|
||||
|
|
|
@ -53,6 +53,7 @@ void * realloc ();
|
|||
|
||||
#include "libiberty.h"
|
||||
#include "rust-demangle.h"
|
||||
#include "msvc-demangle.h"
|
||||
|
||||
enum demangling_styles current_demangling_style = auto_demangling;
|
||||
|
||||
|
@ -100,6 +101,12 @@ const struct demangler_engine libiberty_demanglers[] =
|
|||
"Rust style demangling"
|
||||
}
|
||||
,
|
||||
{
|
||||
MSVC_DEMANGLING_STYLE_STRING,
|
||||
msvc_demangling,
|
||||
"MSVC style demangling"
|
||||
}
|
||||
,
|
||||
{
|
||||
NULL, unknown_demangling, NULL
|
||||
}
|
||||
|
@ -161,8 +168,12 @@ cplus_demangle (const char *mangled, int options)
|
|||
options |= (int) current_demangling_style & DMGL_STYLE_MASK;
|
||||
|
||||
/* The V3 ABI demangling is implemented elsewhere. */
|
||||
if (GNU_V3_DEMANGLING || RUST_DEMANGLING || AUTO_DEMANGLING)
|
||||
if (GNU_V3_DEMANGLING || RUST_DEMANGLING || MSVC_DEMANGLING || AUTO_DEMANGLING)
|
||||
{
|
||||
ret = msvc_demangle (mangled, options);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = cplus_demangle_v3 (mangled, options);
|
||||
if (GNU_V3_DEMANGLING)
|
||||
return ret;
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
#define HAVE_DECL_BASENAME 1
|
||||
#include "demangle.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <regex>
|
||||
|
||||
#include <llvm/Config/llvm-config.h>
|
||||
#include <llvm/Demangle/Demangle.h>
|
||||
|
||||
extern "C"
|
||||
char* msvc_demangle(const char* sym, int options)
|
||||
{
|
||||
auto mangled = sym;
|
||||
auto suffix = std::strchr(sym, '!');
|
||||
if (suffix != 0) {
|
||||
mangled = suffix + 1;
|
||||
}
|
||||
|
||||
auto flags = llvm::MSDemangleFlags(llvm::MSDF_NoAccessSpecifier | llvm::MSDF_NoCallingConvention);
|
||||
if (!(options & DMGL_ANSI)) {
|
||||
/* TODO: Wait for LLVM's demangler to get a flag for this */;
|
||||
}
|
||||
|
||||
//HACK: We should probably not do this on DMGL_AUTO, but the GNU C++
|
||||
// demangler also omits the return type even without
|
||||
// DMGL_RET_DROP...
|
||||
if ((options & (DMGL_RET_DROP | DMGL_AUTO))) {
|
||||
flags = llvm::MSDemangleFlags(flags | llvm::MSDF_NoReturnType);
|
||||
}
|
||||
|
||||
#if LLVM_VERSION_MAJOR > 10
|
||||
auto demangled = llvm::microsoftDemangle(mangled, nullptr, nullptr, nullptr, nullptr, flags);
|
||||
#else
|
||||
auto demangled = llvm::microsoftDemangle(mangled, nullptr, nullptr, nullptr, flags);
|
||||
#endif
|
||||
if (demangled == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto result = std::string(demangled);
|
||||
|
||||
//TODO: Use OF_NoTagSpecifier (not currently available as a MSDF_* flag)
|
||||
result = std::regex_replace(result, std::regex("(class|struct|union|enum) "), "");
|
||||
|
||||
result = std::regex_replace(result, std::regex(" (\\*|&)"), "$1");
|
||||
|
||||
if (!(options & DMGL_PARAMS)) {
|
||||
result = std::regex_replace(result, std::regex(" \(.*\)"), "");
|
||||
}
|
||||
|
||||
return strdup(result.c_str());
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
char* msvc_demangle(const char* sym, int options);
|
Loading…
Reference in New Issue