From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31338 invoked by alias); 3 Dec 2013 16:17:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 31310 invoked by uid 89); 3 Dec 2013 16:17:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.3 required=5.0 tests=AWL,BAYES_50,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RDNS_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-pb0-f48.google.com Received: from Unknown (HELO mail-pb0-f48.google.com) (209.85.160.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 03 Dec 2013 16:17:32 +0000 Received: by mail-pb0-f48.google.com with SMTP id md12so21344902pbc.35 for ; Tue, 03 Dec 2013 08:17:24 -0800 (PST) X-Received: by 10.68.254.132 with SMTP id ai4mr39380950pbd.51.1386087444665; Tue, 03 Dec 2013 08:17:24 -0800 (PST) Received: from sspiff.sspiff.org.gmail.com (173-13-178-50-sfba.hfc.comcastbusiness.net. [173.13.178.50]) by mx.google.com with ESMTPSA id lh13sm40181377pab.4.2013.12.03.08.17.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Dec 2013 08:17:23 -0800 (PST) From: Doug Evans To: Tom Tromey , gdb-patches@sourceware.org, binutils@sourceware.org Subject: Re: [PATCH] include/gdb/section-scripts.h: New file. References: <87eh5vwaa3.fsf@fleche.redhat.com> Date: Tue, 03 Dec 2013 16:17:00 -0000 In-Reply-To: (Doug Evans's message of "Mon, 2 Dec 2013 09:00:50 -0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2013-12/txt/msg00086.txt.bz2 Doug Evans writes: > On Mon, Dec 2, 2013 at 7:19 AM, Tom Tromey wrote: >>>>>>> "Doug" == Doug Evans writes: >> >> Doug> This patch creates a file to use when adding values to >> Doug> .debug_gdb_scripts. >> >> I don't see why this needs to go in include. > > So you would have code that puts contents in this section using magic numbers? > Eh? This doesn't make any sense. Why does dwarf2.def exist (for example) ? > [The dwarf format is far more complicated, obvously. But I didn't > know there was > a threshold of magic numbers was required before a header was allowed.] > >> I think it would be more helpful to document the format of this section >> in the manual. > > Documentation can always be improved, but there is something there already. > I do need to spiff it up, that's coming ... > >> Doug> +/* Native GDB scripts are not currently supported in .debug_gdb_scripts, >> Doug> + but we reserve a value for it. */ >> Doug> +/*#define SECTION_SCRIPT_ID_GDB_FILE 2*/ >> >> There's no need either to reserve a value or to add commented out code. > > I'm curious how I would apply this rule in general. For reference sake, here's a patch I want to check in afterwards. 2013-12-03 Doug Evans * auto-load.c: #include "gdb/section-scripts.h". (source_section_scripts): Replace magic number. testsuite/ * gdb.python/py-section-script.c: #include "symcat.h", "gdb/section-scripts.h". * gdb.python/py-section-script.exp: Pass -I${srcdir}/../../include to gcc. diff --git a/gdb/auto-load.c b/gdb/auto-load.c index 02b08be..0521e3a 100644 --- a/gdb/auto-load.c +++ b/gdb/auto-load.c @@ -18,6 +18,7 @@ along with this program. If not, see . */ #include "defs.h" +#include "gdb/section-scripts.h" #include "auto-load.h" #include "progspace.h" #include "python/python.h" @@ -895,7 +896,7 @@ source_section_scripts (struct objfile *objfile, const char *section_name, but that can change. */ const struct script_language *language = gdbpy_script_language_defn (); - if (*p != 1) + if (*p != SECTION_SCRIPT_ID_PYTHON_FILE) { warning (_("Invalid entry in %s section"), section_name); /* We could try various heuristics to find the next valid entry, diff --git a/gdb/testsuite/gdb.python/py-section-script.c b/gdb/testsuite/gdb.python/py-section-script.c index db1daea..b635f13 100644 --- a/gdb/testsuite/gdb.python/py-section-script.c +++ b/gdb/testsuite/gdb.python/py-section-script.c @@ -18,10 +18,13 @@ /* Put the path to the pretty-printer script in .debug_gdb_scripts so gdb will automagically loaded it. */ +#include "symcat.h" +#include "gdb/section-scripts.h" + #define DEFINE_GDB_SCRIPT(script_name) \ asm("\ .pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n\ -.byte 1\n\ +.byte " XSTRING (SECTION_SCRIPT_ID_PYTHON_FILE) "\n\ .asciz \"" script_name "\"\n\ .popsection \n\ "); diff --git a/gdb/testsuite/gdb.python/py-section-script.exp b/gdb/testsuite/gdb.python/py-section-script.exp index 66f1117..945647d 100644 --- a/gdb/testsuite/gdb.python/py-section-script.exp +++ b/gdb/testsuite/gdb.python/py-section-script.exp @@ -39,7 +39,7 @@ set remote_python_file [gdb_remote_download host \ set quoted_name "\"$remote_python_file\"" if {[build_executable $testfile.exp $testfile $srcfile \ - [list debug additional_flags=-DSCRIPT_FILE=$quoted_name]] == -1} { + [list debug "additional_flags=-I${srcdir}/../../include -DSCRIPT_FILE=$quoted_name"]] == -1} { return -1 }