diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-09-09 19:41:14 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-09-09 19:41:14 +0000 |
commit | df15bd07dfd59a5176e0fa7699ab1179205491d9 (patch) | |
tree | 7ff7b013450ce8006dc803be209e036bc4a5f693 /gdb/utils.c | |
parent | ddf17726b28e169d5ec0252a777a9c528c6a772f (diff) | |
download | gdb-df15bd07dfd59a5176e0fa7699ab1179205491d9.zip gdb-df15bd07dfd59a5176e0fa7699ab1179205491d9.tar.gz gdb-df15bd07dfd59a5176e0fa7699ab1179205491d9.tar.bz2 |
gdb/
Code cleanup.
* amd64-tdep.c (amd64_skip_prologue): Move the XMM code to ...
(amd64_skip_xmm_prologue): ... this new function. Describe its
parameters. No longer use amd64_prologue_line_bug.
* defs.h (producer_is_gcc_ge_4): New declaration.
* dwarf2read.c (producer_is_gcc_ge_4): Move to utils.c.
(process_full_comp_unit): Update its caller. Remove
amd64_prologue_line_bug initialization.
* symtab.h (struct symtab): Remove field amd64_prologue_line_bug.
* utils.c (producer_is_gcc_ge_4): Moved here from dwarf2read.c.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r-- | gdb/utils.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/gdb/utils.c b/gdb/utils.c index a979cc4..21682d0 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -3691,6 +3691,50 @@ make_bpstat_clear_actions_cleanup (void) return make_cleanup (do_bpstat_clear_actions_cleanup, NULL); } +/* Check for GCC >= 4.x according to the symtab->producer string. Return minor + version (x) of 4.x in such case. If it is not GCC or it is GCC older than + 4.x return -1. If it is GCC 5.x or higher return INT_MAX. */ + +int +producer_is_gcc_ge_4 (const char *producer) +{ + const char *cs; + int major, minor; + + if (producer == NULL) + { + /* For unknown compilers expect their behavior is not compliant. For GCC + this case can also happen for -gdwarf-4 type units supported since + gcc-4.5. */ + + return -1; + } + + /* Skip any identifier after "GNU " - such as "C++" or "Java". */ + + if (strncmp (producer, "GNU ", strlen ("GNU ")) != 0) + { + /* For non-GCC compilers expect their behavior is not compliant. */ + + return -1; + } + cs = &producer[strlen ("GNU ")]; + while (*cs && !isdigit (*cs)) + cs++; + if (sscanf (cs, "%d.%d", &major, &minor) != 2) + { + /* Not recognized as GCC. */ + + return -1; + } + + if (major < 4) + return -1; + if (major > 4) + return INT_MAX; + return minor; +} + /* Provide a prototype to silence -Wmissing-prototypes. */ extern initialize_file_ftype _initialize_utils; |