From b6577aab8a7e97470c5ff96000f3d0dbdb2c1ee1 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Fri, 30 Jan 2015 20:49:51 -0800 Subject: [PATCH] Add producer string to output of info source. gdb/ChangeLog: * NEWS: "info source" command now display producer string if present. * source.c (source_info): Print producer string if present. gdb/doc/ChangeLog: * gdb.texinfo (Symbols) : Output now contains producer string if present. --- gdb/ChangeLog | 5 +++++ gdb/NEWS | 4 ++++ gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdb.texinfo | 3 +++ gdb/source.c | 10 ++++++++-- 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 71ed80cf535..58f5a7b3b7c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2015-01-30 Doug Evans + + * NEWS: "info source" command now display producer string if present. + * source.c (source_info): Print producer string if present. + 2015-01-30 Simon Marchi * varobj.c (varobj_delete): Fix comment. diff --git a/gdb/NEWS b/gdb/NEWS index bd85967aa56..2fca5f20691 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -3,6 +3,10 @@ *** Changes since GDB 7.9 +* The "info source" command now displays the producer string if it was + present in the debug info. This typically includes the compiler version + and may include things like its command line arguments. + * Python Scripting ** gdb.Objfile objects have a new attribute "username", diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index be563f5ce2c..82197b10cd4 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2015-01-30 Doug Evans + + * gdb.texinfo (Symbols) : Output now contains producer + string if present. + 2015-01-27 Doug Evans * python.texi (Objfiles In Python): Document Objfile.username. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 277df2589a1..2e58a535585 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -16300,6 +16300,9 @@ its length, in lines, @item which programming language it is written in, @item +if the debug information provides it, the program that compiled the file +(which may include, e.g., the compiler version and command line arguments), +@item whether the executable includes debugging information for that file, and if so, what format the information is in (e.g., STABS, Dwarf 2, etc.), and @item diff --git a/gdb/source.c b/gdb/source.c index 574d9fa5000..49c9d83e112 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -654,12 +654,15 @@ static void source_info (char *ignore, int from_tty) { struct symtab *s = current_source_symtab; + struct compunit_symtab *cust; if (!s) { printf_filtered (_("No current source file.\n")); return; } + + cust = SYMTAB_COMPUNIT (s); printf_filtered (_("Current source file is %s\n"), s->filename); if (SYMTAB_DIRNAME (s) != NULL) printf_filtered (_("Compilation directory is %s\n"), SYMTAB_DIRNAME (s)); @@ -670,10 +673,13 @@ source_info (char *ignore, int from_tty) s->nlines == 1 ? "" : "s"); printf_filtered (_("Source language is %s.\n"), language_str (s->language)); + printf_filtered (_("Producer is %s.\n"), + COMPUNIT_PRODUCER (cust) != NULL + ? COMPUNIT_PRODUCER (cust) : _("unknown")); printf_filtered (_("Compiled with %s debugging format.\n"), - COMPUNIT_DEBUGFORMAT (SYMTAB_COMPUNIT (s))); + COMPUNIT_DEBUGFORMAT (cust)); printf_filtered (_("%s preprocessor macro info.\n"), - COMPUNIT_MACRO_TABLE (SYMTAB_COMPUNIT (s)) != NULL + COMPUNIT_MACRO_TABLE (cust) != NULL ? "Includes" : "Does not include"); } -- 2.30.2