From: Tom Tromey Date: Fri, 31 Jan 2025 18:28:48 +0000 (-0700) Subject: Move producer_is_realview to producer.c X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2e8e54fc54c196f49f4b975dc88997b79bae92e9;p=thirdparty%2Fbinutils-gdb.git Move producer_is_realview to producer.c This moves the producer_is_realview to producer.c. --- diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c index 17f3932a990..c11e45bc2bf 100644 --- a/gdb/dwarf2/frame.c +++ b/gdb/dwarf2/frame.c @@ -32,6 +32,7 @@ #include "value.h" #include "record.h" #include "extract-store-integer.h" +#include "producer.h" #include "complaints.h" #include "dwarf2/frame.h" diff --git a/gdb/producer.c b/gdb/producer.c index 2ca701f5c7c..ad3a3541e73 100644 --- a/gdb/producer.c +++ b/gdb/producer.c @@ -195,6 +195,30 @@ producer_is_clang (const char *producer, int *major, int *minor) return false; } +/* See producer.h. */ + +bool +producer_is_realview (const char *producer) +{ + static const char *const arm_idents[] = { + "ARM C Compiler, ADS", + "Thumb C Compiler, ADS", + "ARM C++ Compiler, ADS", + "Thumb C++ Compiler, ADS", + "ARM/Thumb C/C++ Compiler, RVCT", + "ARM C/C++ Compiler, RVCT" + }; + + if (producer == NULL) + return false; + + for (const char *ident : arm_idents) + if (startswith (producer, ident)) + return true; + + return false; +} + #if defined GDB_SELF_TEST namespace selftests { namespace producer { diff --git a/gdb/producer.h b/gdb/producer.h index 5cdb7ee3435..1f85bda1ed6 100644 --- a/gdb/producer.h +++ b/gdb/producer.h @@ -50,4 +50,8 @@ extern bool producer_is_llvm (const char *producer); Sets MAJOR and MINOR accordingly, if not NULL. */ extern bool producer_is_clang (const char *producer, int *major, int *minor); +/* Return true if the supplied producer string matches the ARM + RealView compiler (armcc). */ +extern bool producer_is_realview (const char *producer); + #endif /* GDB_PRODUCER_H */ diff --git a/gdb/symtab.c b/gdb/symtab.c index c8bcab7f8ff..e6f6a996790 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -6636,31 +6636,6 @@ main_language (void) return info->language_of_main; } -/* Return 1 if the supplied producer string matches the ARM RealView - compiler (armcc). */ - -bool -producer_is_realview (const char *producer) -{ - static const char *const arm_idents[] = { - "ARM C Compiler, ADS", - "Thumb C Compiler, ADS", - "ARM C++ Compiler, ADS", - "Thumb C++ Compiler, ADS", - "ARM/Thumb C/C++ Compiler, RVCT", - "ARM C/C++ Compiler, RVCT" - }; - - if (producer == NULL) - return false; - - for (const char *ident : arm_idents) - if (startswith (producer, ident)) - return true; - - return false; -} - /* The next index to hand out in response to a registration request. */ diff --git a/gdb/symtab.h b/gdb/symtab.h index cd9220c319e..7927380fca3 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -2750,10 +2750,6 @@ extern struct block_symbol const char *name, const domain_search_flags domain); -/* Return 1 if the supplied producer string matches the ARM RealView - compiler (armcc). */ -bool producer_is_realview (const char *producer); - extern unsigned int symtab_create_debug; /* Print a "symtab-create" debug statement. */