aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2015-01-25 11:20:39 +0100
committerMark Wielaard <mjw@redhat.com>2015-01-29 13:39:01 +0100
commit38360086aea4f956dcd4ba406318595ea11f7dea (patch)
tree7cab1d6ca85a5eb23cbc4f22e22a473b025dbb3c /gdb/dwarf2read.c
parent0f81d3f0a799c6e8c2a89d7f519916e3c9c0f65e (diff)
downloadgdb-38360086aea4f956dcd4ba406318595ea11f7dea.zip
gdb-38360086aea4f956dcd4ba406318595ea11f7dea.tar.gz
gdb-38360086aea4f956dcd4ba406318595ea11f7dea.tar.bz2
Merge GCC producer parsers. Allow digits in identifiers.
Both dwarf2read.c (checkproducer) and utils.c (producer_is_gcc_ge_4) implemented a GCC producer parser that tried to extract the major and minor version of GCC. Merge them into one GCC producer parser used by both. Also allow digits in the identifier after "GNU " such as used by GCC5 like: "GNU C11 5.0.0 20150123 (experimental) -mtune=generic -march=x86-64 -gdwarf-5" gdb/ChangeLog: * dwarf2read.c (checkproducer): Call producer_is_gcc. * utils.c (producer_is_gcc_ge_4): Likewise. (producer_is_gcc): New function. * utils.h (producer_is_gcc): New declaration.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index ccbaede..89b8dfe 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -12266,7 +12266,7 @@ static void
check_producer (struct dwarf2_cu *cu)
{
const char *cs;
- int major, minor, release;
+ int major, minor;
if (cu->producer == NULL)
{
@@ -12279,22 +12279,10 @@ check_producer (struct dwarf2_cu *cu)
combination. gcc-4.5.x -gdwarf-4 binaries have DW_AT_accessibility
interpreted incorrectly by GDB now - GCC PR debug/48229. */
}
- else if (strncmp (cu->producer, "GNU ", strlen ("GNU ")) == 0)
+ else if ((major = producer_is_gcc (cu->producer, &minor)) > 0)
{
- /* Skip any identifier after "GNU " - such as "C++" or "Java". */
-
- cs = &cu->producer[strlen ("GNU ")];
- while (*cs && !isdigit (*cs))
- cs++;
- if (sscanf (cs, "%d.%d.%d", &major, &minor, &release) != 3)
- {
- /* Not recognized as GCC. */
- }
- else
- {
- cu->producer_is_gxx_lt_4_6 = major < 4 || (major == 4 && minor < 6);
- cu->producer_is_gcc_lt_4_3 = major < 4 || (major == 4 && minor < 3);
- }
+ cu->producer_is_gxx_lt_4_6 = major < 4 || (major == 4 && minor < 6);
+ cu->producer_is_gcc_lt_4_3 = major < 4 || (major == 4 && minor < 3);
}
else if (strncmp (cu->producer, "Intel(R) C", strlen ("Intel(R) C")) == 0)
cu->producer_is_icc = 1;