From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 4D0D63853802 for ; Mon, 24 Oct 2022 00:28:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4D0D63853802 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=harmstone.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-x42e.google.com with SMTP id a14so10883598wru.5 for ; Sun, 23 Oct 2022 17:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=0oXDdJMvy0Caq1Re9vzpFzAo79P9gmmPl5TTpRfK8qg=; b=Ggma0TlI1qizBsA/EAEPENm+JOubS4IeWVVAP29HL8fkY7JYI3xRrk+ohcW2KW8UiE c0KOrqQ4Qw4JGgt+tv09hfvjS2WqBhiUZDIRBvTZp8FeE1i+AExDjBi4mN+IZQWxTHj+ O9ET/4y4P9Tgg1ZhWY4h0hv1/UCz9ru9MHOOGPzQxhsQXFTOnywRtTx3Jwr5bepV+4er Vob/lUqhteA1xOeDnS40ZgiSPZeSREDqp1YYkIjZJSz7Hdbtqt3rAlL8+4iTCbNLeFsl PIsE5yHhBzCfAVxyx8t0G6cVgUSTX21rNgZhilIwpoerFF5F0sKRItD3vQG/1t3FFwaz DW+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=0oXDdJMvy0Caq1Re9vzpFzAo79P9gmmPl5TTpRfK8qg=; b=fTBkXBrFHH3ckoqE0s4e9+oLncQUeaB0GQ5mxd5Sj8Jm30hghakKy8Bvue0IoAXIFU s0XBZE7T8xuME9jcFFMPTmOW3IRcbvO565glUTNEaP9NJ7x3L9SV7BAaZXopTBYg0t9u FfZRnefkZR/OWc1JalIC+SpMl5K3HWUhBp3f/TYVQ9Tm1wwLWvJzTnSDHZVDWBeUP1uB 2IIOnhfZoCnPT7SyHPl1D2YPgRhw80E+AZ64dHrCLesYSDaFblCHF/4i0xBmStwfKfW0 K9QaHRCe0FlLrGCIq0spRLmLfOFeRoTNoAVPkr90PCkPbDKwWzsafvPed5o43qpLvVy8 WLdA== X-Gm-Message-State: ACrzQf0DlRH/P+S+U7ivTFT3C6qhpJxFo9kkVSZO+CEXjnVYeV3zBwRf 9BqBWvTJU6IBLkgoU3lcebqI92/Epic= X-Google-Smtp-Source: AMsMyM4sEltT+iWaq3sBfEnYIeWlo6CSYyziFxh73ew3KZw7wuSNXwbVxvuooMYoos0Pn6nTLgNIMA== X-Received: by 2002:a5d:43c5:0:b0:236:6ff9:9167 with SMTP id v5-20020a5d43c5000000b002366ff99167mr1681052wrr.160.1666571331630; Sun, 23 Oct 2022 17:28:51 -0700 (PDT) Received: from beren.harmstone.com ([2a02:8010:64ea:0:8eb8:7eff:fe53:9d5f]) by smtp.gmail.com with ESMTPSA id f15-20020a05600c154f00b003b4a68645e9sm6735567wmg.34.2022.10.23.17.28.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Oct 2022 17:28:51 -0700 (PDT) Sender: Mark Harmstone From: Mark Harmstone To: gcc-patches@gcc.gnu.org, martin@martin.st Cc: Mark Harmstone Subject: [PATCH] Add -gcodeview option Date: Mon, 24 Oct 2022 01:28:28 +0100 Message-Id: <20221024002828.28861-1-mark@harmstone.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Both current lld and the next version of ld have an option -pdb, which creates a PDB file which Microsoft's debuggers can use. This patch adds a -gcodeview option, which passes this to the linker. I do intend to expand this so it also creates the .debug$S and .debug$T sections which would make this useful - I submitted patches for this a while back, but they need to be rewritten to parse the DWARF DIEs rather than using debug_hooks. Clang also has -gcodeview, but AFAICS only uses it for .debug$S and .debug$T, and doesn't use it for linker options (though IMO it probably should). --- gcc/common.opt | 4 ++++ gcc/doc/invoke.texi | 7 +++++++ gcc/gcc.cc | 4 ++++ gcc/opts.cc | 3 +++ 4 files changed, 18 insertions(+) diff --git a/gcc/common.opt b/gcc/common.opt index 8a0dafc522d..77103f961d8 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -3253,6 +3253,10 @@ gas-locview-support Common Driver Var(dwarf2out_as_locview_support) Assume assembler support for view in (DWARF2+) .loc directives. +gcodeview +Common Driver JoinedOrMissing +Generate debug information in CodeView format. + gcoff Common Driver WarnRemoved Does nothing. Preserved for backward compatibility. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index ff6c338bedb..2d29fd2611d 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -483,6 +483,7 @@ Objective-C and Objective-C++ Dialects}. -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol -gas-loc-support -gno-as-loc-support @gol -gas-locview-support -gno-as-locview-support @gol +-gcodeview @gol -gcolumn-info -gno-column-info -gdwarf32 -gdwarf64 @gol -gstatement-frontiers -gno-statement-frontiers @gol -gvariable-location-views -gno-variable-location-views @gol @@ -10358,6 +10359,12 @@ assembler (GAS) to fail with an error. Produce debugging information in Alpha/VMS debug format (if that is supported). This is the format used by DEBUG on Alpha/VMS systems. +@item -gcodeview +@opindex gcodeview +Produce debugging information in CodeView debug format (if that is +supported). This is the format used by Microsoft Visual C++ on +Windows. + @item -g@var{level} @itemx -ggdb@var{level} @itemx -gstabs@var{level} diff --git a/gcc/gcc.cc b/gcc/gcc.cc index bb07cc244e3..2820f325282 100644 --- a/gcc/gcc.cc +++ b/gcc/gcc.cc @@ -4608,6 +4608,10 @@ driver_handle_option (struct gcc_options *opts, do_save = false; break; + case OPT_gcodeview: + add_infile ("-pdb=", "*"); + break; + default: /* Various driver options need no special processing at this point, having been handled in a prescan above or being diff --git a/gcc/opts.cc b/gcc/opts.cc index 3a89da2dd03..e2633ee5439 100644 --- a/gcc/opts.cc +++ b/gcc/opts.cc @@ -3089,6 +3089,9 @@ common_handle_option (struct gcc_options *opts, set_debug_level (NO_DEBUG, 2, arg, opts, opts_set, loc); break; + case OPT_gcodeview: + break; + case OPT_gstabs: case OPT_gstabs_: set_debug_level (DBX_DEBUG, code == OPT_gstabs_, arg, opts, opts_set, -- 2.37.3