public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Harmstone <mark@harmstone.com>
To: binutils@sourceware.org
Cc: Mark Harmstone <mark@harmstone.com>
Subject: [PATCH 1/2] pdb: Allow loading by gdb
Date: Tue,  9 May 2023 01:32:46 +0100	[thread overview]
Message-ID: <20230509003247.24156-1-mark@harmstone.com> (raw)

These are the first patches adding support to allow GDB to load Microsoft's
PDB debugging files.

Add a new bfd_flavour value, and expose PDB files as objects, so that
they get accepted by add-symbol-file.

---
 bfd/bfd-in2.h | 3 ++-
 bfd/pdb.c     | 6 ++++--
 bfd/targets.c | 4 +++-
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 7be18db20a8..e9b3e8e9a21 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -7410,7 +7410,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 };
diff --git a/bfd/pdb.c b/bfd/pdb.c
index 7fefd8140fa..c48fb459b9f 100644
--- a/bfd/pdb.c
+++ b/bfd/pdb.c
@@ -62,6 +62,8 @@ pdb_archive_p (bfd *abfd)
   return _bfd_no_cleanup;
 }
 
+#define pdb_object_p pdb_archive_p
+
 static bfd *
 pdb_get_elt_at_index (bfd *abfd, symindex sym_index)
 {
@@ -774,7 +776,7 @@ pdb_write_contents (bfd *abfd)
 const bfd_target pdb_vec =
 {
   "pdb",
-  bfd_target_unknown_flavour,
+  bfd_target_pdb_flavour,
   BFD_ENDIAN_LITTLE,		/* target byte order */
   BFD_ENDIAN_LITTLE,		/* target headers byte order */
   0,				/* object flags */
@@ -793,7 +795,7 @@ const bfd_target pdb_vec =
 
   {				/* bfd_check_format */
     _bfd_dummy_target,
-    _bfd_dummy_target,
+    pdb_object_p,
     pdb_archive_p,
     _bfd_dummy_target
   },
diff --git a/bfd/targets.c b/bfd/targets.c
index 3dbcd088966..a36e6f0f439 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -169,7 +169,8 @@ EXTERNAL
 .  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 };
@@ -1859,6 +1860,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.  */
     }
-- 
2.39.2


             reply	other threads:[~2023-05-09  0:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-09  0:32 Mark Harmstone [this message]
2023-05-09  0:32 ` [PATCH 2/2] gdb: Allow reading of enum definitions in PDB files Mark Harmstone
2023-05-11 13:41   ` Tom Tromey
2023-05-10  0:56 ` [PATCH 1/2] pdb: Allow loading by gdb Alan Modra
2023-05-15  1:04   ` Mark Harmstone
2023-05-15  1:26     ` Alan Modra
2023-05-16 15:03     ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230509003247.24156-1-mark@harmstone.com \
    --to=mark@harmstone.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).