break;
if (inst.opcode->iclass == addsub_imm
- && (inst.opcode->op == OP_ADD
- || strcmp ("sub", inst.opcode->name) == 0))
+ && (inst.opcode->op == OP_ADD || streq ("sub", inst.opcode->name)))
{
unsigned rd = inst.operands[0].reg.regno;
unsigned rn = inst.operands[1].reg.regno;
seen_stack_set = true;
}
else if (inst.opcode->iclass == addsub_ext
- && strcmp ("sub", inst.opcode->name) == 0)
+ && streq ("sub", inst.opcode->name))
{
unsigned rd = inst.operands[0].reg.regno;
unsigned rn = inst.operands[1].reg.regno;
<< inst.operands[1].shifter.amount);
}
else if (inst.opcode->iclass == log_shift
- && strcmp (inst.opcode->name, "orr") == 0)
+ && streq (inst.opcode->name, "orr"))
{
unsigned rd = inst.operands[0].reg.regno;
unsigned rn = inst.operands[1].reg.regno;
else if ((inst.opcode->iclass == ldstpair_off
|| (inst.opcode->iclass == ldstpair_indexed
&& inst.operands[2].addr.preind))
- && strcmp ("stp", inst.opcode->name) == 0)
+ && streq ("stp", inst.opcode->name))
{
/* STP with addressing mode Pre-indexed and Base register. */
unsigned rt1;
&& (inst.opcode->op == OP_STR_POS
|| inst.opcode->op == OP_STRF_POS)))
&& inst.operands[1].addr.base_regno == AARCH64_SP_REGNUM
- && strcmp ("str", inst.opcode->name) == 0)
+ && streq ("str", inst.opcode->name))
{
/* STR (immediate) */
unsigned int rt = inst.operands[0].reg.regno;
primary : primary DOT_ID
{
- if (strcmp ($2.ptr, "all") == 0)
+ if (streq ($2.ptr, "all"))
ada_wrap<ada_unop_ind_operation> ();
else
{
type = language_lookup_primitive_type (par_state->language (),
par_state->gdbarch (),
name);
- if (type == NULL && strcmp ("system__address", name) == 0)
+ if (type == NULL && streq ("system__address", name))
type = type_system_address (par_state);
if (type != NULL)
{
int len = strlen (target);
- return
- (strncmp (field_name, target, len) == 0
- && (field_name[len] == '\0'
- || (startswith (field_name + len, "___")
- && strcmp (field_name + strlen (field_name) - 6,
- "___XVN") != 0)));
+ return (strncmp (field_name, target, len) == 0
+ && (field_name[len] == '\0'
+ || (startswith (field_name + len, "___")
+ && !streq (field_name + strlen (field_name) - 6,
+ "___XVN"))));
}
return false;
len1 = strlen (str);
len2 = strlen (suffix);
- return len1 >= len2 && strcmp (str + len1 - len2, suffix) == 0;
+ return len1 >= len2 && streq (str + len1 - len2, suffix);
}
/* The contents of value VAL, treated as a value of type TYPE. The
the field type should be a meaningless integer type whose name
is not equal to the field name. */
if (index_desc_type->field (0).type ()->name () != NULL
- && strcmp (index_desc_type->field (0).type ()->name (),
- index_desc_type->field (0).name ()) == 0)
+ && streq (index_desc_type->field (0).type ()->name (),
+ index_desc_type->field (0).name ()))
return;
/* Fixup each field of INDEX_DESC_TYPE. */
/* We let an anonymous enum type match a non-anonymous one. */
if (type1->name () != nullptr
&& type2->name () != nullptr
- && strcmp (type1->name (), type2->name ()) != 0)
+ && !streq (type1->name (), type2->name ()))
continue;
if (ada_identical_enum_types_p (type1, type2))
return i;
if (type0 == NULL || type1 == NULL
|| type0->code () != type1->code ())
return false;
- if ((type0->code () == TYPE_CODE_STRUCT
- || type0->code () == TYPE_CODE_ENUM)
+ if ((type0->code () == TYPE_CODE_STRUCT || type0->code () == TYPE_CODE_ENUM)
&& ada_type_name (type0) != NULL && ada_type_name (type1) != NULL
- && strcmp (ada_type_name (type0), ada_type_name (type1)) == 0)
+ && streq (ada_type_name (type0), ada_type_name (type1)))
return true;
return false;
{
const char *name0 = sym0->linkage_name ();
const char *name1 = sym1->linkage_name ();
- return (strcmp (name0, name1) == 0
+ return (streq (name0, name1)
&& sym0->value_address () == sym1->value_address ());
}
{
const char *name = ada_type_name (type);
- return (name != NULL && strcmp (name, "<variable, no debug info>") == 0);
+ return (name != NULL && streq (name, "<variable, no debug info>"));
}
/* Return true if TYPE1 and TYPE2 are two enumeration types
if (j != i
&& !syms[j].symbol->type ()->is_stub ()
&& syms[j].symbol->linkage_name () != NULL
- && strcmp (syms[i].symbol->linkage_name (),
- syms[j].symbol->linkage_name ()) == 0)
+ && streq (syms[i].symbol->linkage_name (),
+ syms[j].symbol->linkage_name ()))
remove_p = true;
}
}
{
if (i != j
&& syms[j].symbol->linkage_name () != NULL
- && strcmp (syms[i].symbol->linkage_name (),
- syms[j].symbol->linkage_name ()) == 0
+ && streq (syms[i].symbol->linkage_name (),
+ syms[j].symbol->linkage_name ())
&& (syms[i].symbol->loc_class ()
== syms[j].symbol->loc_class ())
- && syms[i].symbol->value_address ()
- == syms[j].symbol->value_address ())
+ && (syms[i].symbol->value_address ()
+ == syms[j].symbol->value_address ()))
remove_p = true;
}
}
/* "TKB" suffixes are used for subprograms implementing task bodies. */
- if (strcmp (str, "TKB") == 0)
+ if (streq (str, "TKB"))
return true;
#if 0
return false;
if (str[2] == '_')
{
- if (strcmp (str + 3, "JM") == 0)
+ if (streq (str + 3, "JM"))
return true;
/* FIXME: brobecker/2004-09-30: GNAT will soon stop using
the LJM suffix in favor of the JM one. But we will
still accept LJM as a valid suffix for a reasonable
amount of time, just to allow ourselves to debug programs
compiled using an older version of GNAT. */
- if (strcmp (str + 3, "LJM") == 0)
+ if (streq (str + 3, "LJM"))
return true;
if (str[3] != 'X')
return false;
if (name == NULL)
return false;
- return (strcmp (name, "ada__tags__dispatch_table") == 0);
+ return (streq (name, "ada__tags__dispatch_table"));
}
/* Return true if TYPE is an interface tag. */
if (name == nullptr)
return false;
- return (strcmp (name, "ada__tags__interface_tag") == 0);
+ return (streq (name, "ada__tags__interface_tag"));
}
/* True if field number FIELD_NUM in struct or union type TYPE is supposed
{
const char *name = ada_type_name (type->target_type ());
- return (name != NULL
- && strcmp (name, "ada__tags__dispatch_table") == 0);
+ return name != nullptr && streq (name, "ada__tags__dispatch_table");
}
}
{
const char *name = type->field (field_num).name ();
- if (name != NULL && strcmp (name, "RETVAL") == 0)
+ if (name != NULL && streq (name, "RETVAL"))
{
/* This happens in functions with "out" or "in out" parameters
which are passed by copy. For such functions, GNAT describes
return (name != NULL
&& (startswith (name, "PARENT")
- || strcmp (name, "REP") == 0
+ || streq (name, "REP")
|| startswith (name, "_parent")
|| name[0] == 'S' || name[0] == 'R' || name[0] == 'O'));
}
}
/* If the names match, stop. */
- if (strcmp (result_name, name) == 0)
+ if (streq (result_name, name))
break;
/* Otherwise, look at the next item on the list, if any. */
{
int len = strlen (ada_type_name (type));
- if (len > 6 && strcmp (ada_type_name (type) + len - 6, "___XVE") == 0)
+ if (len > 6 && streq (ada_type_name (type) + len - 6, "___XVE"))
return type;
else
return ada_find_parallel_type (type, "___XVE");
return (name != NULL
&& (type->code () == TYPE_CODE_INT
|| type->code () == TYPE_CODE_RANGE)
- && (strcmp (name, "character") == 0
- || strcmp (name, "wide_character") == 0
- || strcmp (name, "wide_wide_character") == 0
- || strcmp (name, "unsigned char") == 0));
+ && (streq (name, "character")
+ || streq (name, "wide_character")
+ || streq (name, "wide_wide_character")
+ || streq (name, "unsigned char")));
}
/* True if TYPE appears to be an Ada string type. */
return (type->code () == TYPE_CODE_STRUCT
&& type->num_fields () == 1
- && strcmp (type->field (0).name (), "F") == 0);
+ && streq (type->field (0).name (), "F"));
}
/* If there is an ___XVS-convention type parallel to SUBTYPE, return
const char *ename = field.name ();
size_t elen = strlen (ename);
- if (elen >= len && strcmp (name, ename + elen - len) == 0)
+ if (elen >= len && streq (name, ename + elen - len))
return field.loc_enumval ();
}
return val;
bool
ada_is_system_address_type (struct type *type)
{
- return (type->name () && strcmp (type->name (), "system__address") == 0);
+ return (type->name () && streq (type->name (), "system__address"));
}
\f
= find_frame_funname (fi, &func_lang, NULL);
if (func_name != NULL)
{
- if (strcmp (func_name.get (),
- data->exception_info->catch_exception_sym) == 0)
+ if (streq (func_name.get (),
+ data->exception_info->catch_exception_sym))
break; /* We found the frame we were looking for... */
}
fi = get_prev_frame (fi);
for (const char *name : standard_exc)
{
- if (strcmp (name, excep_string) == 0)
+ if (streq (name, excep_string))
{
is_standard_exc = true;
break;
&& sym->loc_class () != LOC_BLOCK
&& sym->loc_class () != LOC_CONST
&& sym->loc_class () != LOC_UNRESOLVED
- && type_name != NULL && strcmp (type_name, "exception") == 0);
+ && type_name != nullptr && streq (type_name, "exception"));
}
/* Given a global symbol SYM, return non-zero iff SYM is a non-standard
return false;
for (const char *name : standard_exc)
- if (strcmp (sym->linkage_name (), name) == 0)
+ if (streq (sym->linkage_name (), name))
return false; /* A standard exception. */
/* Numeric_Error is also a standard exception, so exclude it.
See the STANDARD_EXC description for more details as to why
this exception is not listed in that array. */
- if (strcmp (sym->linkage_name (), "numeric_error") == 0)
+ if (streq (sym->linkage_name (), "numeric_error"))
return false;
return true;
bool
ada_exc_info::operator== (const ada_exc_info &other) const
{
- return addr == other.addr && strcmp (name, other.name) == 0;
+ return addr == other.addr && streq (name, other.name);
}
/* Sort EXCEPTIONS using compare_ada_exception_info as the comparison
const lookup_name_info &lookup_name,
completion_match_result *comp_match_res)
{
- return strcmp (symbol_search_name, ada_lookup_name (lookup_name)) == 0;
+ return streq (symbol_search_name, ada_lookup_name (lookup_name));
}
/* Build the Ada lookup name for LOOKUP_NAME. */
/* On amd64-DICOS, the Load Module's "header" section is 72
bytes. */
- if (strcmp (target_name, "elf64-x86-64") == 0
- && dicos_load_module_p (abfd, 72))
+ if (streq (target_name, "elf64-x86-64") && dicos_load_module_p (abfd, 72))
return GDB_OSABI_DICOS;
return GDB_OSABI_UNKNOWN;
find_pc_partial_function (pc, &name, NULL, NULL);
/* If we have a NAME, we can check for the trampoline function */
- if (name != NULL && strcmp (name, "trampoline") == 0)
+ if (name != NULL && streq (name, "trampoline"))
return 1;
return amd64_gnu_sigtramp_start (this_frame) != 0;
if (name == NULL || strstr (name, "sigaction") != NULL)
return (amd64_linux_sigtramp_start (this_frame) != 0);
- return (strcmp ("__restore_rt", name) == 0);
+ return (streq ("__restore_rt", name));
}
/* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>. */
return 0;
find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
- return (name && ((strcmp (name, "calltrap") == 0)
- || (strcmp (name, "osyscall1") == 0)
- || (strcmp (name, "Xsyscall") == 0)
- || (startswith (name, "Xintr"))));
+ return (name != nullptr
+ && (streq (name, "calltrap") || streq (name, "osyscall1")
+ || streq (name, "Xsyscall") || startswith (name, "Xintr")));
}
static const struct frame_unwind_legacy amd64obsd_trapframe_unwind (
bound_minimal_symbol s = lookup_minimal_symbol_by_pc (call_dest);
if (s.minsym != NULL
&& s.minsym->linkage_name () != NULL
- && strcmp (s.minsym->linkage_name (), "__main") == 0)
+ && streq (s.minsym->linkage_name (), "__main"))
pc += 5;
}
}
/* Cygwin uses elf core dumps. Do not claim all ELF executables,
check whether there is a .reg section of proper size. */
- if (strcmp (target_name, "elf64-x86-64") == 0)
+ if (streq (target_name, "elf64-x86-64"))
{
asection *section = bfd_get_section_by_name (abfd, ".reg");
if (section != nullptr
/* Check if this is a bfloat16 type. It has the same size as the
IEEE half float type, so we use the base type name to tell them
apart. */
- if (name != nullptr && strcmp (name, "__bf16") == 0
+ if (name != nullptr && streq (name, "__bf16")
&& len == gdbarch_bfloat16_bit (gdbarch))
format = gdbarch_bfloat16_format (gdbarch);
else if (len == gdbarch_half_bit (gdbarch))
{
struct gdbarch_info info;
- if (strcmp (set_architecture_string, "auto") == 0)
+ if (streq (set_architecture_string, "auto"))
{
target_architecture_user = NULL;
if (!gdbarch_update_p (current_inferior (), info))
{
const char *name = bfd_asymbol_name (sym);
- if (strcmp (name, "_vm_stack") == 0
- || strcmp (name, "__p4_stack") == 0)
+ if (streq (name, "_vm_stack") || streq (name, "__p4_stack"))
pikeos_stack_found = 1;
- if (strcmp (name, "_vm_stack_size") == 0
- || strcmp (name, "__p4_stack_end") == 0)
+ if (streq (name, "_vm_stack_size") || streq (name, "__p4_stack_end"))
pikeos_stack_size_found = 1;
}
return 1;
/* If the user wants to override the symbol table, let him. */
- if (strcmp (arm_force_mode_string, "arm") == 0)
+ if (streq (arm_force_mode_string, "arm"))
return 0;
- if (strcmp (arm_force_mode_string, "thumb") == 0)
+ if (streq (arm_force_mode_string, "thumb"))
return 1;
/* ARM v6-M and v7-M are always in Thumb mode. */
return (MSYMBOL_IS_SPECIAL (sym.minsym));
/* If the user wants to override the fallback mode, let them. */
- if (strcmp (arm_fallback_mode_string, "arm") == 0)
+ if (streq (arm_fallback_mode_string, "arm"))
return 0;
- if (strcmp (arm_fallback_mode_string, "thumb") == 0)
+ if (streq (arm_fallback_mode_string, "thumb"))
return 1;
/* If we couldn't find any symbol, but we're talking to a running
int offset = strlen (name) - 2;
for (regno = 0; regno <= 14; regno++)
- if (strcmp (&name[offset], table[regno]) == 0)
+ if (streq (&name[offset], table[regno]))
return get_frame_register_unsigned (frame, regno);
}
int fp_model;
for (fp_model = ARM_FLOAT_AUTO; fp_model != ARM_FLOAT_LAST; fp_model++)
- if (strcmp (current_fp_model, fp_model_strings[fp_model]) == 0)
+ if (streq (current_fp_model, fp_model_strings[fp_model]))
{
arm_fp_model = (enum arm_float_model) fp_model;
break;
int arm_abi;
for (arm_abi = ARM_ABI_AUTO; arm_abi != ARM_ABI_LAST; arm_abi++)
- if (strcmp (arm_abi_string, arm_abi_strings[arm_abi]) == 0)
+ if (streq (arm_abi_string, arm_abi_strings[arm_abi]))
{
arm_abi_global = (enum arm_abi_kind) arm_abi;
break;
static const char *
arm_gnu_triplet_regexp (struct gdbarch *gdbarch)
{
- if (strcmp (gdbarch_bfd_arch_info (gdbarch)->arch_name, "arm") == 0)
+ if (streq (gdbarch_bfd_arch_info (gdbarch)->arch_name, "arm"))
return "arm(v[^- ]*)?";
return gdbarch_bfd_arch_info (gdbarch)->arch_name;
}
size_t offset = strlen ("reg-names-");
const char *style = disasm_options->name[i];
valid_disassembly_styles[j++] = &style[offset];
- if (strcmp (&style[offset], "std") == 0)
+ if (streq (&style[offset], "std"))
disassembly_style = &style[offset];
length = snprintf (rdptr, rest, "%s - %s\n", &style[offset],
disasm_options->description[i]);
if (s.minsym != NULL
&& s.minsym->linkage_name () != NULL
- && strcmp (s.minsym->linkage_name (), "__gccmain") == 0)
+ && streq (s.minsym->linkage_name (), "__gccmain"))
pc += 4;
}
{
const char *target_name = bfd_get_target (abfd);
- if (strcmp (target_name, "pei-arm-wince-little") == 0)
+ if (streq (target_name, "pei-arm-wince-little"))
return GDB_OSABI_WINCE;
return GDB_OSABI_UNKNOWN;
if (debug_auto_load)
{
- if (strcmp (in_vec.get (), original.get ()) == 0)
+ if (streq (in_vec.get (), original.get ()))
auto_load_debug_printf ("Using directory \"%s\".",
in_vec.get ());
else
}
/* If gdb_realpath returns a different content, append it. */
- if (strcmp (real_path.get (), in_vec.get ()) != 0)
+ if (!streq (real_path.get (), in_vec.get ()))
{
auto_load_debug_printf ("And canonicalized as \"%s\".",
real_path.get ());
if (*filename_realp == NULL)
{
*filename_realp = gdb_realpath (filename);
- if (debug_auto_load && strcmp (filename_realp->get (), filename) != 0)
+ if (debug_auto_load && !streq (filename_realp->get (), filename))
auto_load_debug_printf ("Resolved file \"%s\" as \"%s\".",
filename, filename_realp->get ());
}
- if (strcmp (filename_realp->get (), filename) != 0)
+ if (!streq (filename_realp->get (), filename))
for (const gdb::unique_xmalloc_ptr<char> &p : auto_load_safe_path_vec)
if (filename_is_in_pattern (filename_realp->get (), p.get ()))
{
const struct loaded_script *ea = (const struct loaded_script *) a;
const struct loaded_script *eb = (const struct loaded_script *) b;
- return strcmp (ea->name, eb->name) == 0 && ea->language == eb->language;
+ return streq (ea->name, eb->name) && ea->language == eb->language;
}
/* Initialize the table to track loaded scripts.
(bfd_get_debug_link_info (parent->obfd.get (), &crc32));
if (debuglink.get () != nullptr
- && strcmp (debuglink.get (), lbasename (realname.get ())) != 0)
+ && !streq (debuglink.get (), lbasename (realname.get ())))
{
/* Replace the last component of the parent's path with the
debuglink name. */
uiout->text ("\n");
/* If the name isn't the full path, print it too. */
- if (script->full_path != NULL
- && strcmp (script->name, script->full_path) != 0)
+ if (script->full_path != NULL && !streq (script->name, script->full_path))
{
uiout->text ("\tfull name: ");
uiout->field_string ("full_path", script->full_path);
const char* name,
type_instance_flags *type_flags_ptr)
{
- if (strcmp (name, "flash") == 0)
+ if (streq (name, "flash"))
{
*type_flags_ptr = AVR_TYPE_INSTANCE_FLAG_ADDRESS_CLASS_FLASH;
return true;
if (this_name)
{
- if (strcmp (field, this_name) == 0)
+ if (streq (field, this_name))
{
/* Note that bytecodes for the struct's base (aka
"this") will have been generated already, which will
{
const char *t_field_name = t->field (i).name ();
- if (t_field_name && strcmp (t_field_name, fieldname) == 0)
+ if (t_field_name && streq (t_field_name, fieldname))
{
if (t->field (i).is_static ())
{
agent_expr_up agent;
arg = exp;
- if (!eval && strcmp (arg, "$_ret") == 0)
+ if (!eval && streq (arg, "$_ret"))
{
agent = gen_trace_for_return_address (pc, get_current_arch (),
trace_string);
*size = kind;
- if (strcmp (target_shortname (), "sim") == 0)
+ if (streq (target_shortname (), "sim"))
return bfin_sim_breakpoint;
else
return bfin_breakpoint;
{
const char *result = gdb_signal_to_name (sig);
- if (strcmp (result, "?") == 0)
+ if (streq (result, "?"))
result = plongest (sig);
return result;
if ((condition == nullptr) != (extracted_condition.get () == nullptr)
|| (condition != nullptr
- && strcmp (condition, extracted_condition.get ()) != 0)
+ && !streq (condition, extracted_condition.get ()))
|| (rest == nullptr) != (extracted_rest.get () == nullptr)
- || (rest != nullptr && strcmp (rest, extracted_rest.get ()) != 0)
+ || (rest != nullptr && !streq (rest, extracted_rest.get ()))
|| thread != extracted_thread
|| inferior != extracted_inferior
|| task != extracted_task
static bool
command_line_is_silent (struct command_line *cmd)
{
- return cmd && (strcmp ("silent", cmd->line) == 0);
+ return cmd && (streq ("silent", cmd->line));
}
/* Sets the $_hit_bpnum and $_hit_locno to bpnum and locno.
total_width = 0;
for (i = 1; uiout->query_table_field (i, &width, &align, &text); i++)
{
- if (strcmp (text, col_name) == 0)
+ if (streq (text, col_name))
return total_width;
total_width += width + 1;
if (*dprintf_args != '"')
error (_("Bad format string, missing '\"'."));
- if (strcmp (dprintf_style, dprintf_style_gdb) == 0)
+ if (streq (dprintf_style, dprintf_style_gdb))
printf_line = xstrprintf ("printf %s", dprintf_args);
- else if (strcmp (dprintf_style, dprintf_style_call) == 0)
+ else if (streq (dprintf_style, dprintf_style_call))
{
if (dprintf_function.empty ())
error (_("No function supplied for dprintf call"));
dprintf_function.c_str (),
dprintf_args);
}
- else if (strcmp (dprintf_style, dprintf_style_agent) == 0)
+ else if (streq (dprintf_style, dprintf_style_agent))
{
if (target_can_run_breakpoint_commands ())
printf_line = xstrprintf ("agent-printf %s", dprintf_args);
{
for (bp_location &l : b->locations ())
if (l.function_name
- && strcmp (e.function_name.get (),
- l.function_name.get ()) == 0)
+ && streq (e.function_name.get (), l.function_name.get ()))
{
l.enabled = e.enabled;
break;
}
sig_write ("\n");
- return function != nullptr && strcmp (function, "main") == 0;
+ return function != nullptr && streq (function, "main");
}
/* Write a backtrace to GDB's stderr in an async safe manner. This is a
/* If the minimal symbol changed, we certainly switched functions. */
if (mfun != NULL && msym != NULL
- && strcmp (mfun->linkage_name (), msym->linkage_name ()) != 0)
+ && !streq (mfun->linkage_name (), msym->linkage_name ()))
return 1;
/* If the symbol changed, we certainly switched functions. */
const char *bfname, *fname;
/* Check the function name. */
- if (strcmp (fun->linkage_name (), sym->linkage_name ()) != 0)
+ if (!streq (fun->linkage_name (), sym->linkage_name ()))
return 1;
/* Check the location of those functions, as well. */
create a stack back trace with the same function names but
different frame id's. This will confuse stepping. */
fname = ftrace_print_function_name (bfun);
- if (strcmp (fname, "_dl_runtime_resolve") == 0)
+ if (streq (fname, "_dl_runtime_resolve"))
return ftrace_new_tailcall (btinfo, mfun, fun);
return ftrace_new_return (btinfo, mfun, fun);
return;
}
- if (arg == NULL || *arg == 0 || strcmp (arg, "+") == 0)
+ if (arg == NULL || *arg == 0 || streq (arg, "+"))
{
from = to;
size = end - from;
to = from + size;
}
- else if (strcmp (arg, "-") == 0)
+ else if (streq (arg, "-"))
{
to = from;
goto done;
}
- if (!strcmp (name, "wchar_t"))
+ if (streq (name, "wchar_t"))
{
result = C_WIDE_CHAR;
goto done;
}
- if (!strcmp (name, "char16_t"))
+ if (streq (name, "char16_t"))
{
result = C_CHAR_16;
goto done;
}
- if (!strcmp (name, "char32_t"))
+ if (streq (name, "char32_t"))
{
result = C_CHAR_32;
goto done;
|| code == TYPE_CODE_METHODPTR
|| TYPE_IS_REFERENCE (type))))
gdb_puts (" ", stream);
- need_post_space = (varstring != NULL && strcmp (varstring, "") != 0);
+ need_post_space = (varstring != NULL && !streq (varstring, ""));
c_type_print_varspec_prefix (type, stream, show, 0, need_post_space,
language, flags, podata);
}
gdb_printf (stream, "typedef ");
type_print (type, "", stream, -1);
if ((new_symbol->type ())->name () == 0
- || strcmp ((new_symbol->type ())->name (),
- new_symbol->linkage_name ()) != 0
+ || !streq ((new_symbol->type ())->name (), new_symbol->linkage_name ())
|| new_symbol->type ()->code () == TYPE_CODE_TYPEDEF)
gdb_printf (stream, " %s", new_symbol->print_name ());
gdb_printf (stream, ";");
int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
const char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
const char *name = type->name ();
- int is_constructor = name && strcmp (method_name,
- name) == 0;
+ int is_constructor = name != nullptr && streq (method_name, name);
for (j = 0; j < len2; j++)
{
static int
textual_name (const char *name)
{
- return (!strcmp (name, "wchar_t")
- || !strcmp (name, "char16_t")
- || !strcmp (name, "char32_t"));
+ return (streq (name, "wchar_t")
+ || streq (name, "char16_t")
+ || streq (name, "char32_t"));
}
/* Apply a heuristic to decide whether an array of TYPE or a pointer
if (original_type->code () == TYPE_CODE_PTR
&& original_type->name () == NULL
&& original_type->target_type ()->name () != NULL
- && (strcmp (original_type->target_type ()->name (),
- "char") == 0
+ && (streq (original_type->target_type ()->name (), "char")
|| textual_name (original_type->target_type ()->name ())))
{
/* Print nothing. */
static iconv_t
phony_iconv_open (const char *to, const char *from)
{
- if (strcmp (to, "wchar_t") && strcmp (to, GDB_DEFAULT_HOST_CHARSET))
+ if (!streq (to, "wchar_t") && !streq (to, GDB_DEFAULT_HOST_CHARSET))
return -1;
- if (!strcmp (from, "UTF-32BE") || !strcmp (from, "UTF-32"))
+ if (streq (from, "UTF-32BE") || streq (from, "UTF-32"))
return 1;
- if (!strcmp (from, "UTF-32LE"))
+ if (streq (from, "UTF-32LE"))
return 2;
- if (strcmp (from, "wchar_t") && strcmp (from, GDB_DEFAULT_HOST_CHARSET))
+ if (!streq (from, "wchar_t") && !streq (from, GDB_DEFAULT_HOST_CHARSET))
return -1;
return 0;
struct cmd_list_element *c,
const char *value)
{
- if (!strcmp (value, "auto"))
+ if (streq (value, "auto"))
gdb_printf (file,
_("The host character set is \"auto; currently %s\".\n"),
auto_host_charset_name);
show_target_charset_name (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- if (!strcmp (value, "auto"))
+ if (streq (value, "auto"))
gdb_printf (file,
_("The target character set is \"auto; "
"currently %s\".\n"),
struct cmd_list_element *c,
const char *value)
{
- if (!strcmp (value, "auto"))
+ if (streq (value, "auto"))
gdb_printf (file,
_("The target wide character set is \"auto; "
"currently %s\".\n"),
target_wide_charset_be_name = NULL;
target_wide = target_wide_charset_name;
- if (!strcmp (target_wide, "auto"))
+ if (streq (target_wide, "auto"))
target_wide = gdbarch_auto_wide_charset (gdbarch);
len = strlen (target_wide);
const char *target_cset = target_charset (gdbarch);
const char *target_wide_cset = target_wide_charset_name;
- if (!strcmp (target_wide_cset, "auto"))
+ if (streq (target_wide_cset, "auto"))
target_wide_cset = gdbarch_auto_wide_charset (gdbarch);
desc = iconv_open (target_wide_cset, host_cset);
const char *
host_charset (void)
{
- if (!strcmp (host_charset_name, "auto"))
+ if (streq (host_charset_name, "auto"))
return auto_host_charset_name;
return host_charset_name;
}
const char *
target_charset (struct gdbarch *gdbarch)
{
- if (!strcmp (target_charset_name, "auto"))
+ if (streq (target_charset_name, "auto"))
return default_auto_charset ();
return target_charset_name;
}
return target_wide_charset_le_name;
}
- if (!strcmp (target_wide_charset_name, "auto"))
+ if (streq (target_wide_charset_name, "auto"))
return gdbarch_auto_wide_charset (gdbarch);
return target_wide_charset_name;
unsigned int space_request;
/* Often, the host and target charsets will be the same. */
- if (!strcmp (from, to))
+ if (streq (from, to))
{
obstack_grow (output, bytes, num_bytes);
return;
/* Solaris will return `646' here -- but the Solaris iconv then does
not accept this. Darwin (and maybe FreeBSD) may return "" here,
which GNU libiconv doesn't like (infinite loop). */
- if (!strcmp (auto_host_charset_name, "646") || !*auto_host_charset_name)
+ if (streq (auto_host_charset_name, "646") || !*auto_host_charset_name)
auto_host_charset_name = "ASCII";
auto_target_charset_name = auto_host_charset_name;
#elif defined (USE_WIN32API)
auto_target_charset_name = auto_host_charset_name;
/* Windows Terminal supports Emoji when using UTF-8 output. */
- if (strcmp (w32_host_default_charset, "UTF-8") != 0)
+ if (!streq (w32_host_default_charset, "UTF-8"))
no_emojis ();
}
#endif
/* Recall that the first element is always "auto". */
host_charset_name = charset_enum[0];
- gdb_assert (strcmp (host_charset_name, "auto") == 0);
+ gdb_assert (streq (host_charset_name, "auto"));
add_setshow_enum_cmd ("charset", class_support,
charset_enum, &host_charset_name, _("\
Set the host and target character sets."), _("\
/* Recall that the first element is always "auto". */
target_charset_name = charset_enum[0];
- gdb_assert (strcmp (target_charset_name, "auto") == 0);
+ gdb_assert (streq (target_charset_name, "auto"));
add_setshow_enum_cmd ("target-charset", class_support,
charset_enum, &target_charset_name, _("\
Set the target character set."), _("\
/* Recall that the first element is always "auto". */
target_wide_charset_name = charset_enum[0];
- gdb_assert (strcmp (target_wide_charset_name, "auto") == 0);
+ gdb_assert (streq (target_wide_charset_name, "auto"));
add_setshow_enum_cmd ("target-wide-charset", class_support,
charset_enum, &target_wide_charset_name,
_("\
error (_("Error finding name of working directory: %s"),
safe_strerror (errno));
- if (strcmp (cwd.get (), current_directory) != 0)
+ if (!streq (cwd.get (), current_directory))
gdb_printf (_("Working directory %ps\n (canonically %ps).\n"),
styled_string (file_name_style.style (),
current_directory),
if (alias_cmd != nullptr
&& alias_cmd->prefix == prefix_cmd
- && strcmp (alias_name, alias_cmd->name) == 0)
+ && streq (alias_name, alias_cmd->name))
error (_("Alias already exists: %s"), alias);
/* Check ALIAS differs from the found CMD. */
- if (cmd->prefix == prefix_cmd
- && strcmp (alias_name, cmd->name) == 0)
+ if (cmd->prefix == prefix_cmd && streq (alias_name, cmd->name))
error (_("Alias %s is the name of an existing command"), alias);
}
}
for (iter = *previous_chain_ptr; iter; iter = *previous_chain_ptr)
{
- if (strcmp (iter->name, name) == 0)
+ if (streq (iter->name, name))
{
if (iter->destroyer)
iter->destroyer (iter, iter->context ());
gdb_assert (alias.is_alias ());
/* Alias is user documented if it has an allocated documentation
that differs from the aliased command. */
- return (alias.doc_allocated
- && strcmp (alias.doc, alias.alias_target->doc) != 0);
+ return alias.doc_allocated && !streq (alias.doc, alias.alias_target->doc);
}
/* Print the definition of alias C using title style for alias
return;
}
- if (strcmp (command, "all") == 0)
+ if (streq (command, "all"))
{
help_all (stream);
return;
const char *tem = name;
struct cmd_list_element *cmd = lookup_cmd (&tem, list, "", NULL, -1,
ignore_help_classes);
- if (cmd != nullptr && strcmp (name, cmd->name) != 0)
+ if (cmd != nullptr && !streq (name, cmd->name))
cmd = nullptr;
return cmd;
}
read_memory (lo, buf.data (), count);
/* Have everything. Open/write the data. */
- if (file_format == NULL || strcmp (file_format, "binary") == 0)
+ if (file_format == NULL || streq (file_format, "binary"))
dump_binary_file (filename.get (), mode, buf.data (), count);
else
dump_bfd_file (filename.get (), mode, file_format, lo, buf.data (), count);
error (_("Invalid expression."));
/* Have everything. Open/write the data. */
- if (file_format == NULL || strcmp (file_format, "binary") == 0)
+ if (file_format == NULL || streq (file_format, "binary"))
dump_binary_file (filename.get (), mode, val->contents ().data (),
val->type ()->length ());
else
*args = skip_spaces (*args);
completion_info.word = *args;
- if (strcmp (*args, "-") == 0)
+ if (streq (*args, "-"))
{
complete_on_options (options_group, tracker, *args + 1,
completion_info.word);
}
- else if (strcmp (*args, "--") == 0)
+ else if (streq (*args, "--"))
{
tracker.add_completion (make_unique_xstrdup (*args));
}
}
/* Check lines are identical. */
- if (a->line != nullptr && strcmp (a->line, b->line) != 0)
+ if (a->line != nullptr && !streq (a->line, b->line))
return false;
/* Check body_list_0. */
/* Windows doesn't by default define $TERM, but can support styles
regardless. */
#ifndef _WIN32
- if (term == nullptr || strcmp (term, "dumb") == 0)
+ if (term == nullptr || streq (term, "dumb"))
return false;
#else
/* But if they do define $TERM, let us behave the same as on Posix
platforms, for the benefit of programs which invoke GDB as their
back-end. */
- if (term != nullptr && strcmp (term, "dumb") == 0)
+ if (term != nullptr && streq (term, "dumb"))
return false;
#endif
return false;
if (emoji_styling == AUTO_BOOLEAN_TRUE)
return true;
- return strcmp (host_charset (), "UTF-8") == 0;
+ return streq (host_charset (), "UTF-8");
}
/* See cli-style.h. */
static int
read_pe_section_index (const char *section_name)
{
- if (strcmp (section_name, ".text") == 0)
+ if (streq (section_name, ".text"))
{
return PE_SECTION_INDEX_TEXT;
}
- else if (strcmp (section_name, ".data") == 0)
+ else if (streq (section_name, ".data"))
{
return PE_SECTION_INDEX_DATA;
}
- else if (strcmp (section_name, ".bss") == 0)
+ else if (streq (section_name, ".bss"))
{
return PE_SECTION_INDEX_BSS;
}
section_data[PE_SECTION_INDEX_BSS].ms_type = mst_bss;
section_data[PE_SECTION_INDEX_BSS].section_name = ".bss";
- is_pe64 = (strcmp (target, "pe-x86-64") == 0
- || strcmp (target, "pei-x86-64") == 0
- || strcmp (target, "pe-aarch64") == 0
- || strcmp (target, "pei-aarch64") == 0
- || strcmp (target, "pei-aarch64-little") == 0);
- is_pe32 = (strcmp (target, "pe-i386") == 0
- || strcmp (target, "pei-i386") == 0
- || strcmp (target, "pe-arm-wince-little") == 0
- || strcmp (target, "pei-arm-wince-little") == 0);
+ is_pe64 = (streq (target, "pe-x86-64")
+ || streq (target, "pei-x86-64")
+ || streq (target, "pe-aarch64")
+ || streq (target, "pei-aarch64")
+ || streq (target, "pei-aarch64-little"));
+ is_pe32 = (streq (target, "pe-i386")
+ || streq (target, "pei-i386")
+ || streq (target, "pe-arm-wince-little")
+ || streq (target, "pei-arm-wince-little"));
/* Possibly print a debug message about DLL not having a valid format. */
auto maybe_print_debug_msg = [&] () -> void {
|| bfd_read (sname, sizeof (sname), dll) != sizeof (sname))
return maybe_print_debug_msg ();
- if ((strcmp (sname, ".edata") == 0)
+ if (streq (sname, ".edata")
|| (vaddr <= export_opthdrrva && export_opthdrrva < vaddr + vsize))
{
- if (strcmp (sname, ".edata") != 0)
+ if (!streq (sname, ".edata"))
{
if (debug_coff_pe_read)
gdb_printf (gdb_stdlog, _("Export RVA for dll "
target = bfd_get_target (abfd);
- is_pe64 = (strcmp (target, "pe-x86-64") == 0
- || strcmp (target, "pei-x86-64") == 0
- || strcmp (target, "pe-aarch64") == 0
- || strcmp (target, "pei-aarch64") == 0
- || strcmp (target, "pei-aarch64-little") == 0);
- is_pe32 = (strcmp (target, "pe-i386") == 0
- || strcmp (target, "pei-i386") == 0
- || strcmp (target, "pe-arm-wince-little") == 0
- || strcmp (target, "pei-arm-wince-little") == 0);
+ is_pe64 = (streq (target, "pe-x86-64")
+ || streq (target, "pei-x86-64")
+ || streq (target, "pe-aarch64")
+ || streq (target, "pei-aarch64")
+ || streq (target, "pei-aarch64-little"));
+ is_pe32 = (streq (target, "pe-i386")
+ || streq (target, "pei-i386")
+ || streq (target, "pe-arm-wince-little")
+ || streq (target, "pei-arm-wince-little"));
if (!is_pe32 && !is_pe64)
{
|| bfd_read (sname, SCNNMLEN, abfd) != SCNNMLEN)
return DEFAULT_COFF_PE_TEXT_SECTION_OFFSET;
sname[SCNNMLEN] = '\0';
- if (strcmp (sname, ".text") == 0)
+ if (streq (sname, ".text"))
return vaddr;
}
struct value *regval;
CORE_ADDR inferior_addr;
- if (strcmp (reg_name, COMPILE_I_SIMPLE_REGISTER_DUMMY) == 0)
+ if (streq (reg_name, COMPILE_I_SIMPLE_REGISTER_DUMMY))
continue;
if ((reg_bitpos % 8) != 0 || reg_bitsize != 0)
continue;
sym->flags = BSF_GLOBAL;
sym->section = bfd_abs_section_ptr;
- if (strcmp (sym->name, "_GLOBAL_OFFSET_TABLE_") == 0)
+ if (streq (sym->name, "_GLOBAL_OFFSET_TABLE_"))
{
if (compile_debug)
gdb_printf (gdb_stdlog,
sym->value = 0;
continue;
}
- if (strcmp (sym->name, ".TOC.") == 0)
+ if (streq (sym->name, ".TOC."))
{
/* Handle the .TOC. symbol as the linker would do. Set the .TOC.
sections value to 0x8000 (see bfd/elf64-ppc.c TOC_BASE_OFF);
for (destv = argv; *argv != NULL; argv++)
{
/* -fpreprocessed may get in commonly from ccache. */
- if (strcmp (*argv, "-fpreprocessed") == 0)
+ if (streq (*argv, "-fpreprocessed"))
{
xfree (*argv);
continue;
regname += 2;
for (regnum = 0; regnum < gdbarch_num_regs (gdbarch); regnum++)
- if (strcmp (regname, gdbarch_register_name (gdbarch, regnum)) == 0)
+ if (streq (regname, gdbarch_register_name (gdbarch, regnum)))
return regnum;
error (_("Cannot find gdbarch register \"%s\"."), regname);
/* Return true of the name in this hash entry is STR. */
bool is_name_eq (const char *str) const
{
- return strcmp (m_name.get (), str) == 0;
+ return streq (m_name.get (), str);
}
/* Return the hash value based on the name of the entry. */
signame = gdb_signal_to_name ((enum gdb_signal) signum);
/* Ignore the unknown signal case. */
- if (!signame || strcmp (signame, "?") == 0)
+ if (!signame || streq (signame, "?"))
continue;
if (strncasecmp (signame, word, len) == 0)
if (!variable_size_section)
gdb_assert (supply_size == collect_size);
- if (strcmp (sect_name, ".reg") == 0)
+ if (streq (sect_name, ".reg"))
{
required = true;
if (human_name == NULL)
human_name = "general-purpose";
}
- else if (strcmp (sect_name, ".reg2") == 0)
+ else if (streq (sect_name, ".reg2"))
{
if (human_name == NULL)
human_name = "floating-point";
/* Since we copy the current ABI into current_cp_abi instead of
using a pointer, if auto is currently the default, we need to
reset it. */
- if (strcmp (current_cp_abi.shortname, "auto") == 0)
+ if (streq (current_cp_abi.shortname, "auto"))
switch_to_cp_abi ("auto");
}
int i;
for (i = 0; i < num_cp_abis; i++)
- if (strcmp (cp_abis[i]->shortname, short_name) == 0)
+ if (streq (cp_abis[i]->shortname, short_name))
return cp_abis[i];
return NULL;
if (cptwo != nullptr)
two = cptwo.get ();
- SELF_CHECK (strcmp (one, two) == 0);
+ SELF_CHECK (streq (one, two));
}
static void
&& (len == 0
|| scope[len] == ':'
|| scope[len] == '\0'))
- : strcmp (scope, current->import_dest) == 0);
+ : streq (scope, current->import_dest));
/* If the import destination is the current scope or one of its
ancestors then it is applicable. */
with the sought out name. If there is a match pass
current->import_src as NAMESPACE to direct the search
towards the imported namespace. */
- if (current->declaration
- && strcmp (name, current->alias
- ? current->alias : current->declaration) == 0)
+ if (current->declaration != nullptr
+ && streq (name, (current->alias != nullptr
+ ? current->alias
+ : current->declaration)))
sym = cp_lookup_symbol_in_namespace (current->import_src,
current->declaration,
block, domain, 1);
/* Do not follow CURRENT if NAME matches its EXCLUDES. */
for (excludep = current->excludes; *excludep; excludep++)
- if (strcmp (name, *excludep) == 0)
+ if (streq (name, *excludep))
break;
if (*excludep)
continue;
- if (current->alias != NULL
- && strcmp (name, current->alias) == 0)
+ if (current->alias != nullptr && streq (name, current->alias))
/* If the import is creating an alias and the alias matches
the sought name. Pass current->import_src as the NAME to
direct the search towards the aliased namespace. */
/* These are the only two identifiers which canonicalize to other
than themselves or an error: unsigned -> unsigned int and
signed -> int. */
- if (string[0] == 'u' && strcmp (&string[1], "nsigned") == 0)
+ if (string[0] == 'u' && streq (&string[1], "nsigned"))
return 0;
- else if (string[0] == 's' && strcmp (&string[1], "igned") == 0)
+ else if (string[0] == 's' && streq (&string[1], "igned"))
return 0;
/* Identifier character [a-zA-Z0-9_]. */
{
const char *new_name = (*finder) (otype, data);
- if (new_name != nullptr && strcmp (new_name, name) != 0)
+ if (new_name != nullptr && !streq (new_name, name))
{
ret_comp->u.s_name.s = new_name;
ret_comp->u.s_name.len = strlen (new_name);
If the symbol is typedef and its type name is the same
as the symbol's name, e.g., "typedef struct foo foo;". */
- if (type->name () != nullptr
- && strcmp (type->name (), name) == 0)
+ if (type->name () != nullptr && streq (type->name (), name))
return 0;
is_anon = (type->name () == NULL
/* Finally, compare the original string with the computed
name, returning NULL if they are the same. */
- if (strcmp (us.get (), string) == 0)
+ if (streq (us.get (), string))
return nullptr;
return us;
if (info->added_parens)
maybe_strip_parens (us.get ());
- if (strcmp (us.get (), string) == 0)
+ if (streq (us.get (), string))
return nullptr;
return us;
/* skip any symbols that we've already considered. */
for (symbol *listed_sym : *overload_list)
- if (strcmp (sym->linkage_name (), listed_sym->linkage_name ()) == 0)
+ if (streq (sym->linkage_name (), listed_sym->linkage_name ()))
return;
/* Get the demangled name without parameters */
return;
/* skip symbols that cannot match */
- if (strcmp (sym_name.get (), oload_name) != 0)
+ if (!streq (sym_name.get (), oload_name))
return;
overload_list->push_back (sym);
if (current->alias != NULL || current->declaration != NULL)
continue;
- if (strcmp (the_namespace, current->import_dest) == 0)
+ if (streq (the_namespace, current->import_dest))
{
/* Mark this import as searched so that the recursive call
does not search it again. */
gdb::unique_xmalloc_ptr<char> result
= cp_remove_params_if_any (name, completion_mode);
- if ((expected == NULL) != (result == NULL)
- || (expected != NULL
- && strcmp (result.get (), expected) != 0))
+ if ((expected == nullptr) != (result == nullptr)
+ || (expected != nullptr && !streq (result.get (), expected)))
{
error (_("%s:%d: make-paramless self-test failed: (completion=%d) "
"\"%s\" -> %s, expected %s"),
{
const char *type_name = type->name ();
- return (type_name != NULL && !strcmp (type_name, vtbl_ptr_name));
+ return (type_name != NULL && streq (type_name, vtbl_ptr_name));
}
/* Return truth value for the assertion that TYPE is of the type
/* Do not print leading '=' in case of anonymous
unions. */
- if (strcmp (type->field (i).name (), ""))
+ if (!streq (type->field (i).name (), ""))
gdb_puts (" = ", stream);
else
{
static int
csky_essential_reg_check (const struct csky_supported_tdesc_register *reg)
{
- if ((strcmp (reg->name , "pc") == 0)
- && (reg->num == CSKY_PC_REGNUM))
+ if (streq (reg->name, "pc") && reg->num == CSKY_PC_REGNUM)
return CSKY_TDESC_REGS_PC_NUMBERED;
- else if ((strcmp (reg->name , "r14") == 0)
- && (reg->num == CSKY_SP_REGNUM))
+ else if (streq (reg->name, "r14") && reg->num == CSKY_SP_REGNUM)
return CSKY_TDESC_REGS_SP_NUMBERED;
- else if ((strcmp (reg->name , "r15") == 0)
- && (reg->num == CSKY_LR_REGNUM))
+ else if (streq (reg->name, "r15") && reg->num == CSKY_LR_REGNUM)
return CSKY_TDESC_REGS_LR_NUMBERED;
else
return 0;
csky_fr0_fr15_reg_check (const struct csky_supported_tdesc_register *reg) {
int i = 0;
for (i = 0; i < 16; i++)
- {
- if ((strcmp (reg->name, csky_supported_fpu_regs[i].name) == 0)
- && (csky_supported_fpu_regs[i].num == reg->num))
- return (1 << i);
- }
+ if (streq (reg->name, csky_supported_fpu_regs[i].name)
+ && csky_supported_fpu_regs[i].num == reg->num)
+ return 1 << i;
return 0;
};
csky_fr16_fr31_reg_check (const struct csky_supported_tdesc_register *reg) {
int i = 0;
for (i = 0; i < 16; i++)
- {
- if ((strcmp (reg->name, csky_supported_fpu_regs[i + 16].name) == 0)
- && (csky_supported_fpu_regs[i + 16].num == reg->num))
- return (1 << i);
- }
+ if (streq (reg->name, csky_supported_fpu_regs[i + 16].name)
+ && csky_supported_fpu_regs[i + 16].num == reg->num)
+ return (1 << i);
return 0;
};
csky_vr0_vr15_reg_check (const struct csky_supported_tdesc_register *reg) {
int i = 0;
for (i = 0; i < 16; i++)
- {
- if ((strcmp (reg->name, csky_supported_fpu_regs[i + 32].name) == 0)
- && (csky_supported_fpu_regs[i + 32].num == reg->num))
- return (1 << i);
- }
+ if (streq (reg->name, csky_supported_fpu_regs[i + 32].name)
+ && csky_supported_fpu_regs[i + 32].num == reg->num)
+ return (1 << i);
return 0;
};
type = alloc.new_type (TYPE_CODE_ERROR, cet.cte_bits, name);
}
- if (name != nullptr && strcmp (name, "char") == 0)
+ if (name != nullptr && streq (name, "char"))
type->set_has_no_signedness (true);
return set_tid_type (ccp, tid, type);
if (kind == CTF_K_FUNCTION)
{
sym->set_domain (FUNCTION_DOMAIN);
- if (name != nullptr && strcmp (name, "main") == 0)
+ if (name != nullptr && streq (name, "main"))
set_objfile_main_name (objfile, name, language_c);
}
else
auto *iter_data = static_cast<ctf_archive_iter_data *> (arg);
ctf_per_objfile &per_objfile = iter_data->per_objfile;
- if (strcmp (name, ".ctf") != 0)
+ if (!streq (name, ".ctf"))
ctf_import (dict, per_objfile.parent_dict.get ());
objfile *objfile = per_objfile.objfile;
- if (strcmp (name, ".ctf") == 0)
+ if (streq (name, ".ctf"))
{
name = bfd_get_filename (objfile->obfd.get ());
ctf_debug_printf ("is parent, using name='%s'", name);
const char **excludep;
/* If the import destination is the current scope then search it. */
- if (!current->searched && strcmp (scope, current->import_dest) == 0)
+ if (!current->searched && streq (scope, current->import_dest))
{
/* Mark this import as searched so that the recursive call
does not search it again. */
with the sought out name. If there is a match pass
current->import_src as MODULE to direct the search towards
the imported module. */
- if (current->declaration
- && strcmp (name, current->alias
- ? current->alias : current->declaration) == 0)
+ if (current->declaration != nullptr
+ && streq (name, (current->alias != nullptr
+ ? current->alias
+ : current->declaration)))
sym = d_lookup_symbol_in_module (current->import_src,
current->declaration,
block, domain, 1);
/* Do not follow CURRENT if NAME matches its EXCLUDES. */
for (excludep = current->excludes; *excludep; excludep++)
- if (strcmp (name, *excludep) == 0)
+ if (streq (name, *excludep))
break;
if (*excludep)
continue;
/* If the import statement is creating an alias. */
if (current->alias != NULL)
{
- if (strcmp (name, current->alias) == 0)
+ if (streq (name, current->alias))
{
/* If the alias matches the sought name. Pass
current->import_src as the NAME to direct the
{
if (type->num_fields () == 2
&& type->field (0).type ()->code () == TYPE_CODE_INT
- && strcmp (type->field (0).name (), "length") == 0
- && strcmp (type->field (1).name (), "ptr") == 0
+ && streq (type->field (0).name (), "length")
+ && streq (type->field (1).name (), "ptr")
&& !val->bits_any_optimized_out (TARGET_CHAR_BIT * embedded_offset,
TARGET_CHAR_BIT * type->length ()))
{
return priv->task;
}
- if (strcmp (args, "gdb") == 0)
+ if (streq (args, "gdb"))
return mach_task_self ();
task = strtoul (args, &eptr, 0);
if (*eptr)
if (args != NULL)
{
- if (strcmp (args, "saved") == 0)
+ if (streq (args, "saved"))
{
if (inferior_ptid == null_ptid)
gdb_printf (_("No inferior running\n"));
disp_exception (&priv->exception_info);
return;
}
- else if (strcmp (args, "host") == 0)
+ else if (streq (args, "host"))
{
/* FIXME: This needs a privileged host port! */
kret = host_get_exception_ports
{
if (sym->name != NULL
&& symname[0] == sym->name[0]
- && strcmp (symname + 1, sym->name + 1) == 0)
+ && streq (symname + 1, sym->name + 1))
{
ret = 1;
break;
ignore the "TKB" suffix because searches for this task body
subprogram are going to be performed using `pck__t' (the encoded
version of the natural name `pck.t'). */
- if (strcmp (string, "TKB") == 0)
+ if (streq (string, "TKB"))
return hash;
break;
}
if (valid_options->arg[i]->values == NULL)
break;
for (j = 0; valid_options->arg[i]->values[j] != NULL; j++)
- if (strcmp (arg, valid_options->arg[i]->values[j]) == 0)
+ if (streq (arg, valid_options->arg[i]->values[j]))
{
found = true;
break;
if (found)
break;
}
- else if (strcmp (opt, valid_options->name[i]) == 0)
+ else if (streq (opt, valid_options->name[i]))
break;
if (valid_options->name[i] == NULL)
{
that sh_type == SHT_SUNW_dof. Therefore, in addition to the sh_type
check, we need to check for sections named .sframe. */
if (elf_section_data (sect)->this_hdr.sh_type == SHT_SUNW_dof
- && strcmp (bfd_section_name (sect), ".sframe") != 0)
+ && !streq (bfd_section_name (sect), ".sframe"))
{
bfd_byte *dof;
&& parent_entry.resolved == nullptr
&& m_main == nullptr
&& language_may_use_plain_main (lang)
- && strcmp (name, "main") == 0)
+ && streq (name, "main"))
m_main = result;
return result;
exception. */
if ((entry->lang != language_ada
&& entry->lang != language_cplus)
- || strcmp (entry->name, "main") == 0)
+ || streq (entry->name, "main"))
{
/* There won't be one better than this. */
return entry;
if (abbrev->tag == DW_TAG_namespace
&& m_language == language_cplus
- && strcmp (name, "::") == 0)
+ && streq (name, "::"))
{
/* GCC 4.0 and 4.1 had a bug (PR c++/28460) where they
generated bogus DW_TAG_namespace DIEs with a name of "::"
void
dwarf2_cu::set_producer (const char *producer)
{
- gdb_assert (m_producer == nullptr || strcmp (producer, m_producer) == 0);
+ gdb_assert (m_producer == nullptr || streq (producer, m_producer));
m_producer = producer;
int major, minor;
for (;;)
{
- if (m_data[index].name == NULL
- || strcmp (name, m_data[index].name) == 0)
+ if (m_data[index].name == nullptr || streq (name, m_data[index].name))
return m_data[index];
index = (index + step) & (m_data.size () - 1);
}
bool operator== (const c_str_view &other) const
{
- return strcmp (m_cstr, other.m_cstr) == 0;
+ return streq (m_cstr, other.m_cstr);
}
bool operator< (const c_str_view &other) const
flags |= IS_STATIC;
if (main_name != nullptr
&& tag == DW_TAG_subprogram
- && strcmp (name, main_name) == 0)
+ && streq (name, main_name))
{
flags |= IS_MAIN;
this_lang = main_lang;
if (search.comp_dir == nullptr || dwo_file->comp_dir == nullptr)
return search.comp_dir == dwo_file->comp_dir;
- return std::strcmp (search.comp_dir, dwo_file->comp_dir) == 0;
+ return streq (search.comp_dir, dwo_file->comp_dir);
}
/* See dwarf2/read.h. */
{
objfile *objfile = cu->per_objfile->objfile;
- if (strcmp (package_name.get (), this_package_name.get ()) != 0)
+ if (!streq (package_name.get (), this_package_name.get ()))
complaint (_("Symtab %s has objects from two different Go "
"packages: %s and %s"),
(sym->symtab () != NULL
/* Could be data-less variant, so keep going. */
disr_type = nullptr;
}
- else if (strcmp (disr_type->field (0).name (),
- "RUST$ENUM$DISR") != 0)
+ else if (!streq (disr_type->field (0).name (), "RUST$ENUM$DISR"))
{
/* Not a Rust enum. */
return;
{
const char *physname = dwarf2_compute_name (name, die, cu, 1);
- if (canon != NULL && strcmp (physname, canon) != 0)
+ if (canon != NULL && !streq (physname, canon))
{
/* It may not mean a bug in GDB. The compiler could also
compute DW_AT_linkage_name incorrectly. But in such case
dwp_name += ".dwp";
gdb_bfd_ref_ptr dbfd (open_dwp_file (per_bfd, dwp_name.c_str ()));
- if (dbfd == NULL
- && strcmp (objfile->original_name, objfile_name (objfile)) != 0)
+ if (dbfd == nullptr
+ && !streq (objfile->original_name, objfile_name (objfile)))
{
/* Try to find .dwp for the binary file after gdb_realpath resolving. */
dwp_name = objfile_name (objfile);
/* Look up member function name in fieldlist. */
for (i = 0; i < fip->fnfieldlists.size (); i++)
{
- if (strcmp (fip->fnfieldlists[i].name, fieldname) == 0)
+ if (streq (fip->fnfieldlists[i].name, fieldname))
{
flp = &fip->fnfieldlists[i];
break;
/* Check for __pfn and __delta members. */
if (type->field (0).name () == NULL
- || strcmp (type->field (0).name (), "__pfn") != 0
+ || !streq (type->field (0).name (), "__pfn")
|| type->field (1).name () == NULL
- || strcmp (type->field (1).name (), "__delta") != 0)
+ || !streq (type->field (1).name (), "__delta"))
return;
/* Find the type of the method. */
/* Check for P_ARRAY and P_BOUNDS members. */
if (type->field (0).name () == NULL
- || strcmp (type->field (0).name (), "P_ARRAY") != 0
+ || !streq (type->field (0).name (), "P_ARRAY")
|| type->field (1).name () == NULL
- || strcmp (type->field (1).name (), "P_BOUNDS") != 0)
+ || !streq (type->field (1).name (), "P_BOUNDS"))
return;
/* Make sure we're looking at a pointer to an array. */
i >= TYPE_N_BASECLASSES (type);
--i)
{
- if (strcmp (type->field (i).name (), "__vfp") == 0)
+ if (streq (type->field (i).name (), "__vfp"))
{
set_type_vptr_fieldno (type, i);
set_type_vptr_basetype (type, type);
if (follow_die_ref (die, attr, &arg_cu) == child_die)
is_this = 1;
}
- else if (name && strcmp (name, "this") == 0)
+ else if (name && streq (name, "this"))
/* Function definitions will have the argument names. */
is_this = 1;
else if (name == NULL && iparams == 0)
at least versions 14, 17, and 18. */
type_allocator alloc (objfile, cu->lang ());
if (bits == 0 && cu->producer_is_icc () && name != nullptr
- && strcmp (name, "void") == 0)
+ && streq (name, "void"))
type = alloc.copy_type (builtin_type (objfile)->builtin_void);
else
type = init_integer_type (alloc, bits, unsigned_p, name);
if (type->code () == TYPE_CODE_INT
&& name != nullptr
- && strcmp (name, "char") == 0)
+ && streq (name, "char"))
type->set_has_no_signedness (true);
maybe_set_alignment (cu, die, type);
const char *die_name = dwarf2_name (die, cu);
if (die_name != NULL
- && strcmp (die_name, actual_name.get ()) != 0)
+ && !streq (die_name, actual_name.get ()))
{
/* Strip off the class name from the full name.
We want the prefix. */
DW_TAG_namespace DIEs with a name of "::" for the global namespace.
Work around this problem here. */
if (cu->lang () == language_cplus
- && strcmp (parent_type->name (), "::") == 0)
+ && streq (parent_type->name (), "::"))
return "";
/* We give a name to even anonymous namespaces. */
return parent_type->name ();
{
/* For D, the 'main' function could be defined in any module, but it
should never be prefixed. */
- if (strcmp (suffix, "D main") == 0)
+ if (streq (suffix, "D main"))
{
prefix = "";
sep = "";
if (attr != nullptr
&& cu->producer_is_gcc ()
&& attr->as_string () != nullptr
- && strcmp (attr->as_string (), "<artificial>") == 0)
+ && streq (attr->as_string (), "<artificial>"))
cu->per_cu->lto_artificial = true;
switch (m_top_level_die->tag)
/* Return true if NAME matches either of this section's names. */
bool matches (const char *name) const
{
- return ((normal != nullptr && strcmp (name, normal) == 0)
- || (compressed != nullptr && strcmp (name, compressed) == 0));
+ return ((normal != nullptr && streq (name, normal))
+ || (compressed != nullptr && streq (name, compressed)));
}
};
static void
elf_locate_sections (asection *sectp, struct elfinfo *ei)
{
- if (strcmp (sectp->name, ".stab") == 0)
+ if (streq (sectp->name, ".stab"))
{
ei->stabsect = sectp;
}
- else if (strcmp (sectp->name, ".mdebug") == 0)
+ else if (streq (sectp->name, ".mdebug"))
{
ei->mdebugsect = sectp;
}
- else if (strcmp (sectp->name, ".ctf") == 0)
+ else if (streq (sectp->name, ".ctf"))
{
ei->ctfsect = sectp;
}
{
const char *atsign = strchr (sym->name, '@');
bool is_at_symbol = atsign != nullptr && atsign > sym->name;
- bool is_plt = is_at_symbol && strcmp (atsign, "@plt") == 0;
+ bool is_plt = is_at_symbol && streq (atsign, "@plt");
int len = is_at_symbol ? atsign - sym->name : 0;
if (is_at_symbol
/* Note we check the symbol's name instead of checking whether the
symbol is in the .plt section because some systems have @plt
symbols in the .text section. */
- if (len > 4 && strcmp (target_name + len - 4, "@plt") == 0)
+ if (len > 4 && streq (target_name + len - 4, "@plt"))
{
gnu_ifunc_debug_printf ("target \"%s\" is a PLT stub, not caching",
target_name);
return 0;
}
- if (strcmp (target_name, "_PROCEDURE_LINKAGE_TABLE_") == 0)
+ if (streq (target_name, "_PROCEDURE_LINKAGE_TABLE_"))
{
gnu_ifunc_debug_printf ("target is _PROCEDURE_LINKAGE_TABLE_, "
"not caching");
computed_type_name = 1;
}
/* Omit constructors from the completion list. */
- if (!type_name || strcmp (type_name, name))
+ if (!type_name || !streq (type_name, name))
output.emplace_back (concat (prefix, name, nullptr));
}
}
Which we will get with a newer readline, but this really is the
best we can do with older versions of readline. */
const char *value = rl_variable_value ("enable-bracketed-paste");
- if (value != nullptr && strcmp (value, "on") == 0
+ if (value != nullptr && streq (value, "on")
&& ((rl_readline_version >> 8) & 0xff) > 0x07)
printf_unfiltered ("\n");
printf_unfiltered ("quit\n");
;
mode = static_cast<enum exec_file_mismatch_mode>(1 + (int) mode))
{
- if (strcmp (exec_file_mismatch, exec_file_mismatch_names[mode]) == 0)
+ if (streq (exec_file_mismatch, exec_file_mismatch_names[mode]))
{
exec_file_mismatch_mode = mode;
return;
bfd *curr_bfd = current_program_space->exec_bfd ();
bool reload_p = (((prev_bfd != nullptr) == (curr_bfd != nullptr))
&& (prev_bfd == nullptr
- || (strcmp (bfd_get_filename (prev_bfd),
- bfd_get_filename (curr_bfd)) == 0)));
+ || (streq (bfd_get_filename (prev_bfd),
+ bfd_get_filename (curr_bfd)))));
gdb::observers::executable_changed.notify (current_program_space, reload_p);
}
int extension_len = strlen (extension);
return (file_len > extension_len
- && strcmp (&file[file_len - extension_len], extension) == 0);
+ && streq (&file[file_len - extension_len], extension));
}
/* Return the extension language of FILE, or NULL if
through as TYPE_CODE_INT since dbxstclass.h is so
C-oriented, we must change these to "character" from "char". */
- if (strcmp (type->name (), "char") == 0)
+ if (streq (type->name (), "char"))
gdb_printf (stream, "%*scharacter", level, "");
else
goto default_case;
gdb_assert (sym->loc_class () == LOC_COMMON_BLOCK);
- if (comname && (!sym->linkage_name ()
- || strcmp (comname, sym->linkage_name ()) != 0))
+ if (comname != nullptr
+ && (sym->linkage_name () == nullptr
+ || !streq (comname, sym->linkage_name ())))
continue;
if (*any_printed)
return nullptr;
if (ptrace (PT_LWPINFO, lwp, (caddr_t) &pl, sizeof pl) == -1)
return nullptr;
- if (strcmp (kp.ki_comm, pl.pl_tdname) == 0)
+ if (streq (kp.ki_comm, pl.pl_tdname))
return NULL;
xsnprintf (buf, sizeof buf, "%s", pl.pl_tdname);
return buf;
as its thread name instead of an empty name if a name
has not been set explicitly. Return a NULL name in
that case. */
- if (strcmp (buf, elf_tdata (&cbfd)->core->program) != 0)
+ if (!streq (buf, elf_tdata (&cbfd)->core->program))
return buf;
}
}
morestack_msym = lookup_minimal_symbol_by_pc (this_pc_in_block).minsym;
if (morestack_msym)
morestack_name = morestack_msym->linkage_name ();
- if (!morestack_name || strcmp (morestack_name, "__morestack") != 0)
+ if (!morestack_name || !streq (morestack_name, "__morestack"))
{
frame_debug_printf (" -> nullptr // this frame ID is inner");
this_frame->stop_reason = UNWIND_INNER_ID;
call_dest = pc + 4 * displ;
bound_minimal_symbol s = lookup_minimal_symbol_by_pc (call_dest);
- if (s.minsym != NULL
- && s.minsym->linkage_name () != NULL
- && strcmp (s.minsym->linkage_name (), "__main") == 0)
+ if (s.minsym != nullptr
+ && s.minsym->linkage_name () != nullptr
+ && streq (s.minsym->linkage_name (), "__main"))
{
pc += 4;
return pc;
const char* name,
type_instance_flags *type_flags_ptr)
{
- if (strcmp (name, "flash") == 0)
+ if (streq (name, "flash"))
{
*type_flags_ptr = TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1;
return true;
collect_size);
/* PRSTATUS still needs to be treated specially. */
- if (strcmp (sect_name, ".reg") == 0)
+ if (streq (sect_name, ".reg"))
data->note_data->reset (elfcore_write_prstatus
(data->obfd, data->note_data->release (),
data->note_size, data->lwp,
for (sec = abfd->sections; sec; sec = sec->next)
{
if (bfd_section_flags (sec) & SEC_DATA
- || strcmp (".bss", bfd_section_name (sec)) == 0)
+ || streq (".bss", bfd_section_name (sec)))
{
sec_vaddr = bfd_section_vma (sec);
sec_size = bfd_section_size (sec);
dem->demangling_style != unknown_demangling;
dem++)
{
- if (strcmp (current_demangling_style_string,
- dem->demangling_style_name) == 0)
+ if (streq (current_demangling_style_string, dem->demangling_style_name))
{
current_demangling_style = dem->demangling_style;
current_demangling_style_string = demangling_style_names[i];
= xstrdup (libiberty_demanglers[i].demangling_style_name);
if (current_demangling_style_string == NULL
- && strcmp (DEFAULT_DEMANGLING_STYLE, demangling_style_names[i]) == 0)
+ && streq (DEFAULT_DEMANGLING_STYLE, demangling_style_names[i]))
current_demangling_style_string = demangling_style_names[i];
}
&& gdata->size == s.size
&& gdata->inode == s.inode
&& gdata->device_id == s.device_id
- && strcmp (bfd_get_filename (abfd), s.filename) == 0);
+ && streq (bfd_get_filename (abfd), s.filename));
}
};
type_instance_flags type_flags;
/* Check for known address space delimiters. */
- if (!strcmp (space_identifier, "code"))
+ if (streq (space_identifier, "code"))
return TYPE_INSTANCE_FLAG_CODE_SPACE;
- else if (!strcmp (space_identifier, "data"))
+ else if (streq (space_identifier, "data"))
return TYPE_INSTANCE_FLAG_DATA_SPACE;
else if (gdbarch_address_class_name_to_type_flags_p (gdbarch)
&& gdbarch_address_class_name_to_type_flags (gdbarch,
class_types_same_p (const struct type *a, const struct type *b)
{
return (TYPE_MAIN_TYPE (a) == TYPE_MAIN_TYPE (b)
- || (a->name () && b->name ()
- && !strcmp (a->name (), b->name ())));
+ || (a->name () != nullptr
+ && b->name () != nullptr
+ && streq (a->name (), b->name ())));
}
/* If BASE is an ancestor of DCLASS return the distance between them.
stubs. The types won't point to the same address, but they
really are the same. */
- if (a->name () && b->name ()
- && strcmp (a->name (), b->name ()) == 0)
+ if (a->name () != nullptr
+ && b->name () != nullptr
+ && streq (a->name (), b->name ()))
return true;
/* Two function types are equal if their argument and return types
{
if (s == NULL || t == NULL)
return s == t;
- return strcmp (s, t) == 0;
+ return streq (s, t);
}
/* A helper function for check_types_worklist that checks two types for
_parse_bool_arg (const char *args, const char *t_val, const char *f_val,
const char *cmd_prefix)
{
- if (!args || strcmp (args, t_val) == 0)
+ if (!args || streq (args, t_val))
return 1;
- else if (strcmp (args, f_val) == 0)
+ else if (streq (args, f_val))
return 0;
else
error (_("Illegal argument for \"%s\" command, "
{
struct inf *inf = cur_inf ();
- if (!args || (!c_isdigit (*args) && strcmp (args, "none") != 0))
+ if (!args || (!c_isdigit (*args) && !streq (args, "none")))
error (_("Illegal argument to \"set signal-thread\" command.\n"
"Should be a thread ID, or \"none\"."));
- if (strcmp (args, "none") == 0)
+ if (streq (args, "none"))
inf->signal_thread = 0;
else
{
if (fieldtype->target_type () == basetype)
return 1;
- if (basetype->name () != NULL
- && fieldtype->target_type ()->name () != NULL
- && strcmp (basetype->name (),
- fieldtype->target_type ()->name ()) == 0)
- return 1;
- return 0;
+ return (basetype->name () != nullptr
+ && fieldtype->target_type ()->name () != nullptr
+ && streq (basetype->name (), fieldtype->target_type ()->name ()));
}
/* Compute the offset of the baseclass which is the INDEXth baseclass
type1 = check_typedef (type1);
if (type0->code () == TYPE_CODE_PTR
- && strcmp (type->field (0).name (), "__data") == 0
+ && streq (type->field (0).name (), "__data")
&& type1->code () == TYPE_CODE_INT
- && strcmp (type->field (1).name (), "__length") == 0)
+ && streq (type->field (1).name (), "__length"))
{
struct type *target_type = type0->target_type ();
if (target_type->code () == TYPE_CODE_INT
&& target_type->length () == 1
- && strcmp (target_type->name (), "uint8") == 0)
+ && streq (target_type->name (), "uint8"))
return 1;
}
}
static int
sixg_string_p (struct type *type)
{
- if (type->num_fields () == 2
- && type->name () != NULL
- && strcmp (type->name (), "string") == 0)
- return 1;
-
- return 0;
+ return (type->num_fields () == 2
+ && type->name () != nullptr
+ && streq (type->name (), "string"));
}
/* Classify the kind of Go object that TYPE is.
*method_type_is_pointerp = 0;
/* main.init is mangled specially. */
- if (strcmp (mangled_name, "__go_init_main") == 0)
+ if (streq (mangled_name, "__go_init_main"))
{
gdb::unique_xmalloc_ptr<char> package
= make_unique_xstrdup ("main");
}
/* main.main is mangled specially (missing prefix). */
- if (strcmp (mangled_name, "main.main") == 0)
+ if (streq (mangled_name, "main.main"))
{
gdb::unique_xmalloc_ptr<char> package
= make_unique_xstrdup ("main");
char cpu_string[80];
char cpu_brand[20];
unsigned brand_idx;
- int intel_p = strcmp (cpuid_vendor, "GenuineIntel") == 0;
- int amd_p = strcmp (cpuid_vendor, "AuthenticAMD") == 0;
- int hygon_p = strcmp (cpuid_vendor, "HygonGenuine") == 0;
+ int intel_p = streq (cpuid_vendor, "GenuineIntel");
+ int amd_p = streq (cpuid_vendor, "AuthenticAMD");
+ int hygon_p = streq (cpuid_vendor, "HygonGenuine");
unsigned cpu_family, cpu_model;
#if 0
ls_smob->address = address;
ls_smob->length = length;
- if (encoding == NULL || strcmp (encoding, "") == 0)
+ if (encoding == NULL || streq (encoding, ""))
ls_smob->encoding = NULL;
else
ls_smob->encoding = xstrdup (encoding);
gdbscm_throw (exception);
for (i = 0; enumeration[i]; ++i)
{
- if (strcmp (enumeration[i], str.get ()) == 0)
+ if (streq (enumeration[i], str.get ()))
break;
}
if (enumeration[i] == nullptr)
{
for (struct obj_section &sec : faddr_sec->objfile->sections ())
{
- if (strcmp (sec.the_bfd_section->name, ".dynamic") == 0)
+ if (streq (sec.the_bfd_section->name, ".dynamic"))
{
CORE_ADDR addr = sec.addr ();
CORE_ADDR endaddr = sec.endaddr ();
{
for (obj_section &osect : faddr_sect->objfile->sections ())
{
- if (strcmp (osect.the_bfd_section->name, ".dynamic") == 0)
+ if (streq (osect.the_bfd_section->name, ".dynamic"))
{
CORE_ADDR addr, endaddr;
unwind_sec;
unwind_sec = unwind_sec->next)
{
- if (strcmp (unwind_sec->name, "$UNWIND_START$") == 0
- || strcmp (unwind_sec->name, ".PARISC.unwind") == 0)
+ if (streq (unwind_sec->name, "$UNWIND_START$")
+ || streq (unwind_sec->name, ".PARISC.unwind"))
{
unwind_size = bfd_section_size (unwind_sec);
unwind_entries = unwind_size / UNWIND_ENTRY_SIZE;
unwind_sec;
unwind_sec = unwind_sec->next)
{
- if (strcmp (unwind_sec->name, "$UNWIND_START$") == 0
- || strcmp (unwind_sec->name, ".PARISC.unwind") == 0)
+ if (streq (unwind_sec->name, "$UNWIND_START$")
+ || streq (unwind_sec->name, ".PARISC.unwind"))
{
unwind_size = bfd_section_size (unwind_sec);
unwind_entries = unwind_size / UNWIND_ENTRY_SIZE;
for (obj_section &opd : sec->objfile->sections ())
{
- if (strcmp (opd.the_bfd_section->name, ".opd") == 0)
+ if (streq (opd.the_bfd_section->name, ".opd"))
{
for (CORE_ADDR addr = opd.addr ();
addr < opd.endaddr ();
const char *target_name = bfd_get_target (abfd);
/* On x86-DICOS, the Load Module's "header" section is 36 bytes. */
- if (strcmp (target_name, "elf32-i386") == 0
- && dicos_load_module_p (abfd, 36))
+ if (streq (target_name, "elf32-i386") && dicos_load_module_p (abfd, 36))
return GDB_OSABI_DICOS;
return GDB_OSABI_UNKNOWN;
find_pc_partial_function (pc, &name, NULL, NULL);
/* If we have a NAME, we can check for the trampoline function */
- if (name != NULL && strcmp (name, "trampoline") == 0)
+ if (name != NULL && streq (name, "trampoline"))
return 1;
return i386_gnu_sigtramp_start (this_frame) != 0;
static enum gdb_osabi
i386_coff_osabi_sniffer (bfd *abfd)
{
- if (strcmp (bfd_get_target (abfd), "coff-go32-exe") == 0
- || strcmp (bfd_get_target (abfd), "coff-go32") == 0)
+ if (streq (bfd_get_target (abfd), "coff-go32-exe")
+ || streq (bfd_get_target (abfd), "coff-go32"))
return GDB_OSABI_GO32;
return GDB_OSABI_UNKNOWN;
return (i386_linux_sigtramp_start (this_frame) != 0
|| i386_linux_rt_sigtramp_start (this_frame) != 0);
- return (strcmp ("__restore", name) == 0
- || strcmp ("__restore_rt", name) == 0);
+ return streq ("__restore", name) || streq ("__restore_rt", name);
}
/* Return true if the PC of THIS_FRAME is in a signal trampoline which
return 0;
find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
- return (name && (strcmp (name, "calltrap") == 0
- || strcmp (name, "syscall1") == 0
- || startswith (name, "Xintr")
- || startswith (name, "Xsoft")));
+ return (name != nullptr
+ && (streq (name, "calltrap")
+ || streq (name, "syscall1")
+ || startswith (name, "Xintr")
+ || startswith (name, "Xsoft")));
}
static const struct frame_unwind_legacy i386obsd_trapframe_unwind (
call_dest = pc + 5 + extract_signed_integer (buf, 4, byte_order);
call_dest = call_dest & 0xffffffffU;
bound_minimal_symbol s = lookup_minimal_symbol_by_pc (call_dest);
- if (s.minsym != NULL
- && s.minsym->linkage_name () != NULL
- && strcmp (s.minsym->linkage_name (), "__main") == 0)
+ if (s.minsym != nullptr
+ && s.minsym->linkage_name () != nullptr
+ && streq (s.minsym->linkage_name (), "__main"))
pc += 5;
}
}
const char *name;
find_pc_partial_function (pc, &name, NULL, NULL);
- return (name && strcmp ("_sigtramp", name) == 0);
+ return (name && streq ("_sigtramp", name));
}
\f
/* The origin of these symbols is currently unknown. */
find_pc_partial_function (pc, &name, NULL, NULL);
- return (name && (strcmp ("_sigreturn", name) == 0
- || strcmp ("sigvechandler", name) == 0));
+ return (name != nullptr
+ && (streq ("_sigreturn", name)
+ || streq ("sigvechandler", name)));
}
/* Assuming THIS_FRAME is for a SVR4 sigtramp routine, return the
i386_floatformat_for_type (struct gdbarch *gdbarch,
const char *name, int len)
{
- if (len == 128 && name)
- if (strcmp (name, "__float128") == 0
- || strcmp (name, "_Float128") == 0
- || strcmp (name, "complex _Float128") == 0
- || strcmp (name, "complex(kind=16)") == 0
- || strcmp (name, "COMPLEX(16)") == 0
- || strcmp (name, "complex*32") == 0
- || strcmp (name, "COMPLEX*32") == 0
- || strcmp (name, "quad complex") == 0
- || strcmp (name, "real(kind=16)") == 0
- || strcmp (name, "real*16") == 0
- || strcmp (name, "REAL*16") == 0
- || strcmp (name, "REAL(16)") == 0)
+ if (len == 128 && name != nullptr)
+ if (streq (name, "__float128")
+ || streq (name, "_Float128")
+ || streq (name, "complex _Float128")
+ || streq (name, "complex(kind=16)")
+ || streq (name, "COMPLEX(16)")
+ || streq (name, "complex*32")
+ || streq (name, "COMPLEX*32")
+ || streq (name, "quad complex")
+ || streq (name, "real(kind=16)")
+ || streq (name, "real*16")
+ || streq (name, "REAL*16")
+ || streq (name, "REAL(16)"))
return floatformats_ieee_quad;
return default_floatformat_for_type (gdbarch, name, len);
/* Cygwin uses elf core dumps. Do not claim all ELF executables,
check whether there is a .reg section of proper size. */
- if (strcmp (target_name, "elf32-i386") == 0)
+ if (streq (target_name, "elf32-i386"))
{
asection *section = bfd_get_section_by_name (abfd, ".reg");
if (section != nullptr
{
for (obj_section &osect : faddr_sect->objfile->sections ())
{
- if (strcmp (osect.the_bfd_section->name, ".dynamic") == 0)
+ if (streq (osect.the_bfd_section->name, ".dynamic"))
{
CORE_ADDR addr = osect.addr ();
CORE_ADDR endaddr = osect.endaddr ();
/* Return early if faddr is already a function descriptor. */
faddr_sect = find_pc_section (faddr);
- if (faddr_sect && strcmp (faddr_sect->the_bfd_section->name, ".opd") == 0)
+ if (faddr_sect && streq (faddr_sect->the_bfd_section->name, ".opd"))
return faddr;
if (faddr_sect != NULL)
{
for (obj_section &osect : faddr_sect->objfile->sections ())
{
- if (strcmp (osect.the_bfd_section->name, ".opd") == 0)
+ if (streq (osect.the_bfd_section->name, ".opd"))
{
CORE_ADDR addr = osect.addr ();
CORE_ADDR endaddr = osect.endaddr ();
s = find_pc_section (addr);
/* check if ADDR points to a function descriptor. */
- if (s && strcmp (s->the_bfd_section->name, ".opd") == 0)
+ if (s && streq (s->the_bfd_section->name, ".opd"))
return read_memory_unsigned_integer (addr, 8, byte_order);
/* Normally, functions live inside a section that is executable.
{
if (target_can_execute_reverse ())
{
- if (!strcmp (exec_direction, exec_forward))
+ if (streq (exec_direction, exec_forward))
execution_direction = EXEC_FORWARD;
- else if (!strcmp (exec_direction, exec_reverse))
+ else if (streq (exec_direction, exec_reverse))
execution_direction = EXEC_REVERSE;
}
else
{
/* Assert that no factory for NAME is already registered. */
for (const interp_factory &f : interpreter_factories)
- if (strcmp (f.name, name) == 0)
+ if (streq (f.name, name))
{
internal_error (_("interpreter factory already registered: \"%s\"\n"),
name);
interp_lookup_existing (struct ui *ui, const char *name)
{
for (interp &interp : ui->interp_list)
- if (strcmp (interp.name (), name) == 0)
+ if (streq (interp.name (), name))
return &interp;
return nullptr;
return interp;
for (const interp_factory &factory : interpreter_factories)
- if (strcmp (factory.name, name) == 0)
+ if (streq (factory.name, name))
{
interp = factory.func (factory.name);
interp_add (ui, interp);
interp *interp = current_ui->current_interpreter;
if (interp != NULL)
- return (strcmp (interp->name (), interp_name) == 0);
+ return (streq (interp->name (), interp_name));
return 0;
}
enum language flang = language_unknown;
/* "local" is a synonym of "auto". */
- if (strcmp (language, "auto") == 0
- || strcmp (language, "local") == 0)
+ if (streq (language, "auto") || streq (language, "local"))
{
/* Enter auto mode. Set to the current frame's language, if
known, or fallback to the initial language. */
/* Search the list of languages for a match. */
for (const auto &lang : language_defn::languages)
{
- if (strcmp (lang->name (), language) != 0)
+ if (!streq (lang->name (), language))
continue;
/* Found it! Go into manual mode, and use this language. */
set_range_command (const char *ignore,
int from_tty, struct cmd_list_element *c)
{
- if (strcmp (range, "on") == 0)
+ if (streq (range, "on"))
{
range_check = range_check_on;
range_mode = range_mode_manual;
}
- else if (strcmp (range, "warn") == 0)
+ else if (streq (range, "warn"))
{
range_check = range_check_warn;
range_mode = range_mode_manual;
}
- else if (strcmp (range, "off") == 0)
+ else if (streq (range, "off"))
{
range_check = range_check_off;
range_mode = range_mode_manual;
}
- else if (strcmp (range, "auto") == 0)
+ else if (streq (range, "auto"))
{
range_mode = range_mode_auto;
set_range_case ();
static void
set_case_command (const char *ignore, int from_tty, struct cmd_list_element *c)
{
- if (strcmp (case_sensitive, "on") == 0)
+ if (streq (case_sensitive, "on"))
{
case_sensitivity = case_sensitive_on;
case_mode = case_mode_manual;
}
- else if (strcmp (case_sensitive, "off") == 0)
+ else if (streq (case_sensitive, "off"))
{
case_sensitivity = case_sensitive_off;
case_mode = case_mode_manual;
}
- else if (strcmp (case_sensitive, "auto") == 0)
+ else if (streq (case_sensitive, "auto"))
{
case_mode = case_mode_auto;
set_range_case ();
language_enum (const char *str)
{
for (const auto &lang : language_defn::languages)
- if (strcmp (lang->name (), str) == 0)
+ if (streq (lang->name (), str))
return lang->la_language;
return language_unknown;
{
for (struct type_and_symbol &tas : primitive_types_and_symbols)
{
- if (strcmp (tas.type ()->name (), name) == 0)
+ if (streq (tas.type ()->name (), name))
return &tas;
}
add_alias_cmd ("ch", setshow_check_cmds.show, no_class, 1, &showlist);
range = type_or_range_names[3];
- gdb_assert (strcmp (range, "auto") == 0);
+ gdb_assert (streq (range, "auto"));
add_setshow_enum_cmd ("range", class_support, type_or_range_names,
&range,
_("Set range checking (on/warn/off/auto)."),
&setchecklist, &showchecklist);
case_sensitive = case_sensitive_names[2];
- gdb_assert (strcmp (case_sensitive, "auto") == 0);
+ gdb_assert (streq (case_sensitive, "auto"));
add_setshow_enum_cmd ("case-sensitive", class_support, case_sensitive_names,
&case_sensitive, _("\
Set case sensitivity in name search (on/off/auto)."), _("\
completions, advance the stream past the colon token and make
it part of the function name/token. */
- if (!parser->completion_quote_char
- && strcmp (parser->lexer.stream, ":") == 0)
+ if (!parser->completion_quote_char && streq (parser->lexer.stream, ":"))
{
completion_tracker tmp_tracker (false);
const char *source_filename
if (msymbol_type_is_static (item2.minsym->type ()))
continue;
- if (strcmp (item.minsym->linkage_name (),
- item2.minsym->linkage_name ()) != 0)
+ if (!streq (item.minsym->linkage_name (),
+ item2.minsym->linkage_name ()))
continue;
/* Found a global minsym with the same name as the
s != NULL;
s = strtok_r (NULL, " ", &saveptr))
{
- if (strcmp (s, "io") == 0)
+ if (streq (s, "io"))
v->io_page = 1;
- else if (strcmp (s, "ht") == 0)
+ else if (streq (s, "ht"))
v->uses_huge_tlb = 1;
- else if (strcmp (s, "dd") == 0)
+ else if (streq (s, "dd"))
v->exclude_coredump = 1;
- else if (strcmp (s, "sh") == 0)
+ else if (streq (s, "sh"))
v->shared_mapping = 1;
- else if (strcmp (s, "mt") == 0)
+ else if (streq (s, "mt"))
v->memory_tagging = 1;
- else if (strcmp (s, "ss") == 0)
+ else if (streq (s, "ss"))
v->shadow_stack_memory = 1;
}
}
If we managed to find it, then we assume the mapping is
anonymous. */
return (filename_len >= del_len
- && strcmp (filename + filename_len - del_len, deleted) == 0);
+ && streq (filename + filename_len - del_len, deleted));
}
if (*filename == '\0'
break;
}
- if (strcmp (keyword, "Anonymous:") == 0)
+ if (streq (keyword, "Anonymous:"))
{
/* Older Linux kernels did not support the
"Anonymous:" counter. Check it here. */
has_anonymous = 1;
}
- else if (strcmp (keyword, "VmFlags:") == 0)
+ else if (streq (keyword, "VmFlags:"))
decode_vmflags (line, &v);
- if (strcmp (keyword, "AnonHugePages:") == 0
- || strcmp (keyword, "Anonymous:") == 0)
+ if (streq (keyword, "AnonHugePages:")
+ || streq (keyword, "Anonymous:"))
{
unsigned long number;
if (rc)
break;
}
- else if (strcmp (this_dir, "$sdir") == 0)
+ else if (streq (this_dir, "$sdir"))
{
if (try_thread_db_load_from_sdir ())
{
for (this_pid_len = 0; pid != 0; pid /= 10)
this_pid_len++;
- if (i == 0 || strcmp (array[i - 1]->filename, array[i]->filename) != 0)
+ if (i == 0 || !streq (array[i - 1]->filename, array[i]->filename))
{
unique_filenames++;
max_filename_len = std::max (max_filename_len,
file_name_style.style ());
std::string pids;
- while (i < array.size () && strcmp (info->filename,
- array[i]->filename) == 0)
+ while (i < array.size () && streq (info->filename, array[i]->filename))
{
if (!pids.empty ())
pids += ", ";
type = check_typedef (type);
gdb_printf (stream, "TYPE ");
if (!new_symbol->type ()->name ()
- || strcmp ((new_symbol->type ())->name (),
- new_symbol->linkage_name ()) != 0)
+ || !streq ((new_symbol->type ())->name (), new_symbol->linkage_name ()))
gdb_printf (stream, "%s = ", new_symbol->print_name ());
else
gdb_printf (stream, "<builtin> = ");
if (type->field (i).type ()->code () != TYPE_CODE_SET)
return 0;
if (type->field (i).name () != NULL
- && (strcmp (type->field (i).name (), "") != 0))
+ && (!streq (type->field (i).name (), "")))
return 0;
range = type->field (i).type ()->index_type ();
if ((i > TYPE_N_BASECLASSES (type))
*/
if (type->num_fields () != 2)
return 0;
- if (strcmp (type->field (0).name (), "_m2_contents") != 0)
+ if (!streq (type->field (0).name (), "_m2_contents"))
return 0;
- if (strcmp (type->field (1).name (), "_m2_high") != 0)
+ if (!streq (type->field (1).name (), "_m2_high"))
return 0;
if (type->field (0).type ()->code () != TYPE_CODE_PTR)
return 0;
if (find_pc_partial_function (stop_pc, &name, &start, &end))
{
/* Are we stopped at the beginning of the trampoline function? */
- if (strcmp (name, "m32c_jsri16") == 0
- && stop_pc == start)
+ if (streq (name, "m32c_jsri16") && stop_pc == start)
{
/* Get the stack pointer. The return address is at the top,
and the target function's address is just below that. We
const char *ptr_msym_name = ptr_msym.minsym->linkage_name ();
int len = strlen (ptr_msym_name);
- if (len > 4
- && strcmp (ptr_msym_name + len - 4, ".plt") == 0)
+ if (len > 4 && streq (ptr_msym_name + len - 4, ".plt"))
{
/* We have a .plt symbol; try to find the symbol for the
corresponding function.
return (m32r_linux_sigtramp_start (pc, this_frame) != 0
|| m32r_linux_rt_sigtramp_start (pc, this_frame) != 0);
- return (strcmp ("__restore", name) == 0
- || strcmp ("__restore_rt", name) == 0);
+ return streq ("__restore", name) || streq ("__restore_rt", name);
}
/* From <asm/sigcontext.h>. */
asect && dsect;
asect = asect->next, dsect = dsect->next)
{
- if (strcmp (asect->name, dsect->name) != 0)
+ if (!streq (asect->name, dsect->name))
break;
bfd_set_section_size (dsect, bfd_section_size (asect));
}
if (startswith (bfd_sect_name, "LC_SEGMENT."))
bfd_sect_name += 11;
- if (strcmp (bfd_sect_name, "__TEXT") == 0
- || strcmp (bfd_sect_name, "__TEXT.__text") == 0)
+ if (streq (bfd_sect_name, "__TEXT")
+ || streq (bfd_sect_name, "__TEXT.__text"))
objfile->sect_index_text = sect_index;
}
}
macro_source_file *source,
int line)
{
- if (strcmp (name, macro_name) == 0)
+ if (streq (name, macro_name))
print_macro_definition (name, macro, source, line);
});
else
currently_rescanning (struct macro_name_list *list, const char *name)
{
for (; list; list = list->next)
- if (strcmp (name, list->name) == 0)
+ if (streq (name, list->name))
return 1;
return 0;
if (def->argc >= 1)
{
- if (strcmp (def->argv[def->argc - 1], "...") == 0)
+ if (streq (def->argv[def->argc - 1], "..."))
{
/* In C99-style varargs, substitution is done using
__VA_ARGS__. */
{
int len = strlen (def->argv[def->argc - 1]);
- if (len > 3
- && strcmp (def->argv[def->argc - 1] + len - 3, "...") == 0)
+ if (len > 3 && streq (def->argv[def->argc - 1] + len - 3, "..."))
{
/* In GNU-style varargs, the name of the
substitution parameter is the name of the formal
We just want to search within a given name's definitions. */
struct macro_key *found = (struct macro_key *) pred->key;
- if (strcmp (found->name, name) == 0)
+ if (streq (found->name, name))
n = pred;
}
}
definition changes). */
if (kind != found_def->kind)
same = 0;
- else if (strcmp (replacement, found_def->replacement))
+ else if (!streq (replacement, found_def->replacement))
same = 0;
else if (kind == macro_function_like)
{
save_auto_load = global_auto_load;
global_auto_load = 0;
- if (execarg != NULL
- && symarg != NULL
- && strcmp (execarg, symarg) == 0)
+ if (execarg != nullptr && symarg != nullptr && streq (execarg, symarg))
{
/* The exec file and the symbol-file are the same. If we can't
open it, better only print one error message.
error_no_arg (_("No mem"));
/* For "mem auto", switch back to using a target provided list. */
- if (strcmp (args, "auto") == 0)
+ if (streq (args, "auto"))
{
if (mem_use_target ())
return;
break;
case OPCODES_OPT:
opcodes_seen = true;
- if (strcmp (oarg, "none") == 0)
+ if (streq (oarg, "none"))
opcodes_mode = OPCODES_NONE;
- else if (strcmp (oarg, "display") == 0)
+ else if (streq (oarg, "display"))
opcodes_mode = OPCODES_DISPLAY;
- else if (strcmp (oarg, "bytes") == 0)
+ else if (streq (oarg, "bytes"))
opcodes_mode = OPCODES_BYTES;
else
error (_("-data-disassemble: unknown value for -opcodes argument"));
const char *name = argv[0];
std::string gen_name;
- if (strcmp (name, "-") == 0)
+ if (streq (name, "-"))
{
gen_name = varobj_gen_name ();
name = gen_name.c_str ();
else if (!c_isalpha (name[0]))
error (_("-var-create: name of object must begin with a letter"));
- if (strcmp (frame, "*") == 0)
+ if (streq (frame, "*"))
var_type = USE_CURRENT_FRAME;
- else if (strcmp (frame, "@") == 0)
+ else if (streq (frame, "@"))
var_type = USE_SELECTED_FRAME;
else
{
starting with '-'. */
if (argc == 1)
{
- if (strcmp (name, "-c") == 0)
+ if (streq (name, "-c"))
error (_("-var-delete: Missing required "
"argument after '-c': variable object name"));
if (*name == '-')
which would be the variable name. */
if (argc == 2)
{
- if (strcmp (name, "-c") != 0)
+ if (!streq (name, "-c"))
error (_("-var-delete: Invalid option."));
children_only_p = 1;
name = argv[1];
var = varobj_get_handle (argv[0]);
- if (strcmp (argv[1], "0") == 0)
+ if (streq (argv[1], "0"))
frozen = false;
- else if (strcmp (argv[1], "1") == 0)
+ else if (streq (argv[1], "1"))
frozen = true;
else
error (_("Invalid flag value"));
return -1;
arg = argv[*oind];
/* ``--''? */
- if (strcmp (arg, "--") == 0)
+ if (streq (arg, "--"))
{
*oind += 1;
*oarg = NULL;
/* Look the option up. */
for (opt = opts; opt->name != NULL; opt++)
{
- if (strcmp (opt->name, arg + 1) != 0)
+ if (!streq (opt->name, arg + 1))
continue;
if (opt->arg_p)
{
mi_cmd_exec_next (const char *command, const char *const *argv, int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
- if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
+ if (argc > 0 && streq (argv[0], "--reverse"))
mi_execute_async_cli_command ("reverse-next", argv + 1, argc - 1);
else
mi_execute_async_cli_command ("next", argv, argc);
int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
- if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
+ if (argc > 0 && streq (argv[0], "--reverse"))
mi_execute_async_cli_command ("reverse-nexti", argv + 1, argc - 1);
else
mi_execute_async_cli_command ("nexti", argv, argc);
mi_cmd_exec_step (const char *command, const char *const *argv, int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
- if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
+ if (argc > 0 && streq (argv[0], "--reverse"))
mi_execute_async_cli_command ("reverse-step", argv + 1, argc - 1);
else
mi_execute_async_cli_command ("step", argv, argc);
int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
- if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
+ if (argc > 0 && streq (argv[0], "--reverse"))
mi_execute_async_cli_command ("reverse-stepi", argv + 1, argc - 1);
else
mi_execute_async_cli_command ("stepi", argv, argc);
mi_cmd_exec_finish (const char *command, const char *const *argv, int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
- if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
+ if (argc > 0 && streq (argv[0], "--reverse"))
mi_execute_async_cli_command ("reverse-finish", argv + 1, argc - 1);
else
mi_execute_async_cli_command ("finish", argv, argc);
void
mi_cmd_exec_continue (const char *command, const char *const *argv, int argc)
{
- if (argc > 0 && strcmp (argv[0], "--reverse") == 0)
+ if (argc > 0 && streq (argv[0], "--reverse"))
exec_reverse_continue (argv + 1, argc - 1);
else
exec_continue (argv, argc);
available = 1;
break;
case RECURSE_OPT:
- if (strcmp (oarg, "0") == 0)
+ if (streq (oarg, "0"))
;
- else if (strcmp (oarg, "1") == 0)
+ else if (streq (oarg, "1"))
recurse = 1;
else
error (_("only '0' and '1' are valid values "
do_timings = 1;
else if (argc == 1)
{
- if (strcmp (argv[0], "yes") == 0)
+ if (streq (argv[0], "yes"))
do_timings = 1;
- else if (strcmp (argv[0], "no") == 0)
+ else if (streq (argv[0], "no"))
do_timings = 0;
else
goto usage_error;
gdb_puts (context->token.c_str (), mi->raw_stdout);
/* There's no particularly good reason why target-connect results
in not ^done. Should kill ^connected for MI3. */
- gdb_puts (strcmp (context->command.get (), "target-select") == 0
- ? "^connected" : "^done", mi->raw_stdout);
+ gdb_puts ((streq (context->command.get (), "target-select")
+ ? "^connected"
+ : "^done"),
+ mi->raw_stdout);
mi_out_put (uiout, mi->raw_stdout);
mi_out_rewind (uiout);
mi_print_timing_maybe (mi->raw_stdout);
using namespace std::chrono;
static steady_clock::time_point last_update;
static char *previous_sect_name = NULL;
- int new_section;
struct mi_interp *mi = as_mi_interp (current_interpreter ());
/* If the current interpreter is not an MI interpreter, then just
scoped_restore save_uiout
= make_scoped_restore (¤t_uiout, uiout.get ());
- new_section = (previous_sect_name ?
- strcmp (previous_sect_name, section_name) : 1);
- if (new_section)
+ if (previous_sect_name == nullptr
+ || !streq (previous_sect_name, section_name))
{
xfree (previous_sect_name);
previous_sect_name = xstrdup (section_name);
mode = argv[0];
- if (strcmp (mode, "none") == 0)
+ if (streq (mode, "none"))
{
tfind_1 (tfind_number, -1, 0, 0, 0);
return;
check_trace_running (current_trace_status ());
- if (strcmp (mode, "frame-number") == 0)
+ if (streq (mode, "frame-number"))
{
if (argc != 2)
error (_("frame number is required"));
tfind_1 (tfind_number, atoi (argv[1]), 0, 0, 0);
}
- else if (strcmp (mode, "tracepoint-number") == 0)
+ else if (streq (mode, "tracepoint-number"))
{
if (argc != 2)
error (_("tracepoint number is required"));
tfind_1 (tfind_tp, atoi (argv[1]), 0, 0, 0);
}
- else if (strcmp (mode, "pc") == 0)
+ else if (streq (mode, "pc"))
{
if (argc != 2)
error (_("PC is required"));
tfind_1 (tfind_pc, 0, parse_and_eval_address (argv[1]), 0, 0);
}
- else if (strcmp (mode, "pc-inside-range") == 0)
+ else if (streq (mode, "pc-inside-range"))
{
if (argc != 3)
error (_("Start and end PC are required"));
tfind_1 (tfind_range, 0, parse_and_eval_address (argv[1]),
parse_and_eval_address (argv[2]), 0);
}
- else if (strcmp (mode, "pc-outside-range") == 0)
+ else if (streq (mode, "pc-outside-range"))
{
if (argc != 3)
error (_("Start and end PC are required"));
tfind_1 (tfind_outside, 0, parse_and_eval_address (argv[1]),
parse_and_eval_address (argv[2]), 0);
}
- else if (strcmp (mode, "line") == 0)
+ else if (streq (mode, "line"))
{
if (argc != 2)
error (_("Line is required"));
chp += as;
}
/* See if --all is the last token in the input. */
- if (strcmp (chp, "--all") == 0)
+ if (streq (chp, "--all"))
{
this->all = 1;
chp += strlen (chp);
const char *chp = args[i].get ();
/* See if --all is the last token in the input. */
- if (strcmp (chp, "--all") == 0)
+ if (streq (chp, "--all"))
{
this->all = 1;
}
- else if (strcmp (chp, "--thread-group") == 0)
+ else if (streq (chp, "--thread-group"))
{
++i;
if (i == args.size ())
error ("No argument to '--thread-group'");
this->set_thread_group (args[i].get (), nullptr);
}
- else if (strcmp (chp, "--thread") == 0)
+ else if (streq (chp, "--thread"))
{
++i;
if (i == args.size ())
error ("No argument to '--thread'");
this->set_thread (args[i].get (), nullptr);
}
- else if (strcmp (chp, "--frame") == 0)
+ else if (streq (chp, "--frame"))
{
++i;
if (i == args.size ())
error ("No argument to '--frame'");
this->set_frame (args[i].get (), nullptr);
}
- else if (strcmp (chp, "--language") == 0)
+ else if (streq (chp, "--language"))
{
++i;
if (i == args.size ())
enum print_values
mi_parse_print_values (const char *name)
{
- if (strcmp (name, "0") == 0
- || strcmp (name, mi_no_values) == 0)
- return PRINT_NO_VALUES;
- else if (strcmp (name, "1") == 0
- || strcmp (name, mi_all_values) == 0)
- return PRINT_ALL_VALUES;
- else if (strcmp (name, "2") == 0
- || strcmp (name, mi_simple_values) == 0)
- return PRINT_SIMPLE_VALUES;
- else
- error (_("Unknown value for PRINT_VALUES: must be: \
+ if (streq (name, "0") || streq (name, mi_no_values))
+ return PRINT_NO_VALUES;
+ else if (streq (name, "1") || streq (name, mi_all_values))
+ return PRINT_ALL_VALUES;
+ else if (streq (name, "2") || streq (name, mi_simple_values))
+ return PRINT_SIMPLE_VALUES;
+ else
+ error (_("Unknown value for PRINT_VALUES: must be: \
0 or \"%s\", 1 or \"%s\", 2 or \"%s\""),
- mi_no_values, mi_all_values, mi_simple_values);
+ mi_no_values, mi_all_values, mi_simple_values);
}
msymbol != NULL;
msymbol = msymbol->hash_next)
{
- if (strcmp (msymbol->linkage_name (), name) == 0
+ if (streq (msymbol->linkage_name (), name)
&& (msymbol->type () == mst_data
|| msymbol->type () == mst_bss
|| (match_static_type
msymbol != NULL && found_symbol.minsym == NULL;
msymbol = msymbol->hash_next)
{
- if (strcmp (msymbol->linkage_name (), name) == 0 &&
- (msymbol->type () == mst_text
- || msymbol->type () == mst_text_gnu_ifunc
- || msymbol->type () == mst_file_text))
+ if (streq (msymbol->linkage_name (), name)
+ && (msymbol->type () == mst_text
+ || msymbol->type () == mst_text_gnu_ifunc
+ || msymbol->type () == mst_file_text))
{
switch (msymbol->type ())
{
msymbol = msymbol->hash_next)
{
if (msymbol->value_address (&objfile) == pc
- && strcmp (msymbol->linkage_name (), name) == 0)
+ && streq (msymbol->linkage_name (), name))
return msymbol;
}
}
copyfrom = copyto = msymbol;
while (copyfrom < msymbol + mcount - 1)
{
- if (copyfrom->unrelocated_address ()
- == (copyfrom + 1)->unrelocated_address ()
+ if ((copyfrom->unrelocated_address ()
+ == (copyfrom + 1)->unrelocated_address ())
&& (copyfrom->section_index ()
== (copyfrom + 1)->section_index ())
- && strcmp (copyfrom->linkage_name (),
- (copyfrom + 1)->linkage_name ()) == 0)
+ && streq (copyfrom->linkage_name (),
+ (copyfrom + 1)->linkage_name ()))
{
if ((copyfrom + 1)->type () == mst_unknown)
(copyfrom + 1)->set_type (copyfrom->type ());
|| msymbol->type () == mst_text_gnu_ifunc
|| msymbol->type () == mst_data
|| msymbol->type () == mst_data_gnu_ifunc)
- && strcmp (msymbol->linkage_name (),
- tsymbol->linkage_name ()) == 0)
+ && streq (msymbol->linkage_name (),
+ tsymbol->linkage_name ()))
{
CORE_ADDR func;
const char *name;
find_pc_partial_function (pc, &name, NULL, NULL);
- return (name
- && (strcmp (name, "_xcptcall") == 0
- || strcmp (name, "_sigtramp") == 0));
+ return (name != nullptr
+ && (streq (name, "_xcptcall") || streq (name, "_sigtramp")));
}
/* Data structure for the SDE frame unwinder. */
if (!startswith (name, ".mdebug."))
continue;
- if (strcmp (name, ".mdebug.abi32") == 0)
+ if (streq (name, ".mdebug.abi32"))
return MIPS_ABI_O32;
- else if (strcmp (name, ".mdebug.abiN32") == 0)
+ else if (streq (name, ".mdebug.abiN32"))
return MIPS_ABI_N32;
- else if (strcmp (name, ".mdebug.abi64") == 0)
+ else if (streq (name, ".mdebug.abi64"))
return MIPS_ABI_N64;
- else if (strcmp (name, ".mdebug.abiO64") == 0)
+ else if (streq (name, ".mdebug.abiO64"))
return MIPS_ABI_O64;
- else if (strcmp (name, ".mdebug.eabi32") == 0)
+ else if (streq (name, ".mdebug.eabi32"))
return MIPS_ABI_EABI32;
- else if (strcmp (name, ".mdebug.eabi64") == 0)
+ else if (streq (name, ".mdebug.eabi64"))
return MIPS_ABI_EABI64;
else
warning (_("unsupported ABI %s."), name + 8);
{
int ix;
- if (strcmp (current->import_src, src) != 0)
+ if (!streq (current->import_src, src))
continue;
- if (strcmp (current->import_dest, dest) != 0)
+ if (!streq (current->import_dest, dest))
continue;
if ((alias == NULL && current->alias != NULL)
|| (alias != NULL && current->alias == NULL)
|| (alias != NULL && current->alias != NULL
- && strcmp (alias, current->alias) != 0))
+ && !streq (alias, current->alias)))
continue;
if ((declaration == NULL && current->declaration != NULL)
|| (declaration != NULL && current->declaration == NULL)
|| (declaration != NULL && current->declaration != NULL
- && strcmp (declaration, current->declaration) != 0))
+ && !streq (declaration, current->declaration)))
continue;
/* Compare the contents of EXCLUDES. */
for (ix = 0; ix < excludes.size (); ++ix)
if (current->excludes[ix] == NULL
- || strcmp (excludes[ix], current->excludes[ix]) != 0)
+ || !streq (excludes[ix], current->excludes[ix]))
break;
if (ix < excludes.size () || current->excludes[ix] != NULL)
continue;
if (match != 2)
continue;
- if (strcmp (symbol, "_text") == 0)
+ if (streq (symbol, "_text"))
{
kernel_start = addr;
break;
value[i] = '\0';
- if (strcmp (key, "processor") == 0)
+ if (streq (key, "processor"))
{
if (first_item)
buffer += "<item>";
for (i = 0; osdata_table[i].type; ++i)
{
- if (strcmp (annex, osdata_table[i].type) == 0)
+ if (streq (annex, osdata_table[i].type))
return common_getter (&osdata_table[i],
readbuf, offset, len);
}
return PROC_STATE_TRACING_STOP;
case 'T':
/* Before Linux 2.6.33, tracing stop used uppercase T. */
- if (strcmp (state, "T (stopped)\n") == 0)
+ if (streq (state, "T (stopped)\n"))
return PROC_STATE_STOPPED;
else /* "T (tracing stop)\n" */
return PROC_STATE_TRACING_STOP;
{
const char *regname = gdbarch_register_name (gdbarch, j);
- if (strcmp (regname, nds32_register_aliases[i].name) == 0)
+ if (streq (regname, nds32_register_aliases[i].name))
{
regnum = j;
break;
continue;
if ((theclass != NULL)
- && ((nclass == NULL) || (strcmp (theclass, nclass) != 0)))
+ && ((nclass == NULL) || (!streq (theclass, nclass))))
continue;
- if ((category != NULL) &&
- ((ncategory == NULL) || (strcmp (category, ncategory) != 0)))
+ if (category != nullptr
+ && ((ncategory == nullptr) || !streq (category, ncategory)))
continue;
- if ((selector != NULL) &&
- ((nselector == NULL) || (strcmp (selector, nselector) != 0)))
+ if (selector != nullptr
+ && (nselector == nullptr || !streq (selector, nselector)))
continue;
symbol_names->push_back (symname);
const char *name, enum language lang)
{
if (objfile->per_bfd->name_of_main == NULL
- || strcmp (objfile->per_bfd->name_of_main, name) != 0)
+ || !streq (objfile->per_bfd->name_of_main, name))
objfile->per_bfd->name_of_main
= obstack_strdup (&objfile->per_bfd->storage_obstack, name);
objfile->per_bfd->language_of_main = lang;
struct obj_section *s = find_pc_section (pc);
return (s != nullptr
&& s->the_bfd_section->name != nullptr
- && strcmp (s->the_bfd_section->name, name) == 0);
+ && streq (s->the_bfd_section->name, name));
}
/* See objfiles.h. */
&& src_len != 16)
error (_("Invalid OpenCL vector size"));
- if (strcmp (comps, "lo") == 0 )
+ if (streq (comps, "lo"))
{
dst_len = (src_len == 3) ? 2 : src_len / 2;
for (i = 0; i < dst_len; i++)
indices[i] = i;
}
- else if (strcmp (comps, "hi") == 0)
+ else if (streq (comps, "hi"))
{
dst_len = (src_len == 3) ? 2 : src_len / 2;
for (i = 0; i < dst_len; i++)
indices[i] = dst_len + i;
}
- else if (strcmp (comps, "even") == 0)
+ else if (streq (comps, "even"))
{
dst_len = (src_len == 3) ? 2 : src_len / 2;
for (i = 0; i < dst_len; i++)
indices[i] = i*2;
}
- else if (strcmp (comps, "odd") == 0)
+ else if (streq (comps, "odd"))
{
dst_len = (src_len == 3) ? 2 : src_len / 2;
/* Check the note name. */
if (bfd_h_get_32 (abfd, note) != (strlen (name) + 1)
- || strcmp (note + 12, name) != 0)
+ || !streq (note + 12, name))
return 0;
/* Check the descriptor size. */
char note[MAX_NOTESZ];
/* .note.ABI-tag notes, used by GNU/Linux and FreeBSD. */
- if (strcmp (name, ".note.ABI-tag") == 0)
+ if (streq (name, ".note.ABI-tag"))
{
/* GNU. */
if (check_note (abfd, sect, note, §size, "GNU", 16, NT_GNU_ABI_TAG))
}
/* .note.netbsd.ident notes, used by NetBSD. */
- if (strcmp (name, ".note.netbsd.ident") == 0
+ if (streq (name, ".note.netbsd.ident")
&& check_note (abfd, sect, note, §size, "NetBSD", 4, NT_NETBSD_IDENT))
{
/* There is no need to check the version yet. */
}
/* .note.openbsd.ident notes, used by OpenBSD. */
- if (strcmp (name, ".note.openbsd.ident") == 0
+ if (streq (name, ".note.openbsd.ident")
&& check_note (abfd, sect, note, §size, "OpenBSD", 4,
NT_OPENBSD_IDENT))
{
}
/* .note.netbsdcore.procinfo notes, used by NetBSD. */
- if (strcmp (name, ".note.netbsdcore.procinfo") == 0)
+ if (streq (name, ".note.netbsdcore.procinfo"))
{
*osabi = GDB_OSABI_NETBSD;
return;
static void
set_osabi (const char *args, int from_tty, struct cmd_list_element *c)
{
- if (strcmp (set_osabi_string, "auto") == 0)
+ if (streq (set_osabi_string, "auto"))
user_osabi_state = osabi_auto;
- else if (strcmp (set_osabi_string, "default") == 0)
+ else if (streq (set_osabi_string, "default"))
{
user_selected_osabi = GDB_OSABI_DEFAULT;
user_osabi_state = osabi_user;
{
enum gdb_osabi osabi = (enum gdb_osabi) i;
- if (strcmp (set_osabi_string, gdbarch_osabi_name (osabi)) == 0)
+ if (streq (set_osabi_string, gdbarch_osabi_name (osabi)))
{
user_selected_osabi = osabi;
user_osabi_state = osabi_user;
/* Register the "set osabi" command. */
user_osabi_state = osabi_auto;
set_osabi_string = gdb_osabi_available_names[0];
- gdb_assert (strcmp (set_osabi_string, "auto") == 0);
+ gdb_assert (streq (set_osabi_string, "auto"));
add_setshow_enum_cmd ("osabi", class_support, gdb_osabi_available_names,
&set_osabi_string,
_("Set OS ABI of target."),
switch (namelen)
{
case 6:
- if (strcmp (uptokstart, "OBJECT") == 0)
+ if (streq (uptokstart, "OBJECT"))
{
free (uptokstart);
return CLASS;
}
- if (strcmp (uptokstart, "RECORD") == 0)
+ if (streq (uptokstart, "RECORD"))
{
free (uptokstart);
return STRUCT;
}
- if (strcmp (uptokstart, "SIZEOF") == 0)
+ if (streq (uptokstart, "SIZEOF"))
{
free (uptokstart);
return SIZEOF;
}
break;
case 5:
- if (strcmp (uptokstart, "CLASS") == 0)
+ if (streq (uptokstart, "CLASS"))
{
free (uptokstart);
return CLASS;
}
- if (strcmp (uptokstart, "FALSE") == 0)
+ if (streq (uptokstart, "FALSE"))
{
yylval.lval = 0;
free (uptokstart);
}
break;
case 4:
- if (strcmp (uptokstart, "TRUE") == 0)
+ if (streq (uptokstart, "TRUE"))
{
yylval.lval = 1;
free (uptokstart);
return TRUEKEYWORD;
}
- if (strcmp (uptokstart, "SELF") == 0)
+ if (streq (uptokstart, "SELF"))
{
/* Here we search for 'this' like
inserted in FPC stabs debug info. */
/* Two fields: length and st. */
if (type->num_fields () == 2
&& type->field (0).name ()
- && strcmp (type->field (0).name (), "length") == 0
+ && streq (type->field (0).name (), "length")
&& type->field (1).name ()
- && strcmp (type->field (1).name (), "st") == 0)
+ && streq (type->field (1).name (), "st"))
{
if (length_pos)
*length_pos = type->field (0).loc_bitpos () / TARGET_CHAR_BIT;
/* Three fields: Capacity, length and schema$ or _p_schema. */
if (type->num_fields () == 3
&& type->field (0).name ()
- && strcmp (type->field (0).name (), "Capacity") == 0
+ && streq (type->field (0).name (), "Capacity")
&& type->field (1).name ()
- && strcmp (type->field (1).name (), "length") == 0)
+ && streq (type->field (1).name (), "length"))
{
if (length_pos)
*length_pos = type->field (1).loc_bitpos () / TARGET_CHAR_BIT;
/* Hack: remove (char *) for char strings. Their
type is indicated by the quoted string anyway. */
if (type->code () == TYPE_CODE_PTR
- && type->name () == NULL
- && type->target_type ()->name () != NULL
- && strcmp (type->target_type ()->name (), "char") == 0)
+ && type->name () == nullptr
+ && type->target_type ()->name () != nullptr
+ && streq (type->target_type ()->name (), "char"))
{
/* Print nothing. */
}
{
const char *type_name = type->name ();
- return (type_name != NULL
- && strcmp (type_name, pascal_vtbl_ptr_name) == 0);
+ return type_name != nullptr && streq (type_name, pascal_vtbl_ptr_name);
}
/* Return truth value for the assertion that TYPE is of the type
if (sym.minsym == nullptr)
return false;
- return (strcmp (sym.minsym->linkage_name (), "__glink") == 0
- || strcmp (sym.minsym->linkage_name (), "__glink_PLTresolve") == 0);
+ return (streq (sym.minsym->linkage_name (), "__glink")
+ || streq (sym.minsym->linkage_name (), "__glink_PLTresolve"));
}
/* Follow PLT stub to actual routine.
{
if (len == 128 && name)
{
- if (strcmp (name, "__float128") == 0
- || strcmp (name, "_Float128") == 0
- || strcmp (name, "_Float64x") == 0
- || strcmp (name, "complex _Float128") == 0
- || strcmp (name, "complex _Float64x") == 0)
+ if (streq (name, "__float128")
+ || streq (name, "_Float128")
+ || streq (name, "_Float64x")
+ || streq (name, "complex _Float128")
+ || streq (name, "complex _Float64x"))
return floatformats_ieee_quad;
- if (strcmp (name, "__ibm128") == 0)
+ if (streq (name, "__ibm128"))
return floatformats_ibm_long_double;
}
{
if ((target_type->code () == TYPE_CODE_FLT
|| target_type->code () == TYPE_CODE_COMPLEX)
- && (strcmp (name, "long double") == 0
- || strcmp (name, "complex long double") == 0))
+ && (streq (name, "long double")
+ || streq (name, "complex long double")))
{
/* IEEE 128-bit floating point and IBM long double are two
encodings for 128-bit values. The DWARF debug data can't
const struct target_section *s = target_section_by_addr (targ, addr);
/* Check if ADDR points to a function descriptor. */
- if (s && strcmp (s->the_bfd_section->name, ".opd") == 0)
+ if (s && streq (s->the_bfd_section->name, ".opd"))
{
/* There may be relocations that need to be applied to the .opd
section. Unfortunately, this function may be called at a time
const char *idx = arg;
std::string s = extract_arg (&idx);
- if (strcmp (s.c_str (), "-reset") == 0)
+ if (streq (s.c_str (), "-reset"))
{
if (*idx != '\0')
error (_("-reset: no arguments allowed"));
return;
}
- if (strcmp (s.c_str (), "-verbose") == 0
- || strcmp (s.c_str (), "-v") == 0)
+ if (streq (s.c_str (), "-verbose") || streq (s.c_str (), "-v"))
{
verbose_p = true;
arg = idx;
/* If the attribute trying to be set is the "stop" method,
but we already have a condition set in the CLI or other extension
language, disallow this operation. */
- if (strcmp (attr.get (), stop_func) == 0)
+ if (streq (attr.get (), stop_func))
{
const struct extension_language_defn *extlang = NULL;
str_obj->address = address;
str_obj->length = length;
- if (encoding == NULL || !strcmp (encoding, ""))
+ if (encoding == NULL || streq (encoding, ""))
str_obj->encoding = NULL;
else
str_obj->encoding = xstrdup (encoding);
than changing the value of mi_command::m_name (which is not accessible
from here) to point to the name owned by the new object, swap the names
of the two objects, since we know they are identical strings. */
- gdb_assert (strcmp (new_pyobj->mi_command_name,
- m_pyobj->mi_command_name) == 0);
+ gdb_assert (streq (new_pyobj->mi_command_name, m_pyobj->mi_command_name));
std::swap (new_pyobj->mi_command_name, m_pyobj->mi_command_name);
/* Take a reference to the new object, drop the reference to the current
So, for now at least, we don't allow this. This doesn't seem like
an excessive restriction. */
- if (strcmp (cmd->mi_command_name, name) != 0)
+ if (!streq (cmd->mi_command_name, name))
{
PyErr_SetString
(PyExc_ValueError,
if (str == NULL)
return -1;
for (i = 0; self->enumeration[i]; ++i)
- if (! strcmp (self->enumeration[i], str.get ()))
+ if (streq (self->enumeration[i], str.get ()))
break;
if (! self->enumeration[i])
{
buffer += ", ";
buffer = buffer + "'" + l->literal + "'";
if (allowed == TRIBOOL_UNKNOWN
- && ((value == Py_None && !strcmp ("unlimited", l->literal))
- || (s != nullptr && !strcmp (s, l->literal))))
+ && ((value == Py_None && streq ("unlimited", l->literal))
+ || (s != nullptr && streq (s, l->literal))))
{
val = l->use;
allowed = TRIBOOL_TRUE;
length = PyBytes_Size (string.get ());
type = builtin_type (gdbarch)->builtin_char;
- if (hint && !strcmp (hint, "string"))
+ if (hint && streq (hint, "string"))
language->printstr (stream, type, (gdb_byte *) output,
length, NULL, 0, options);
else
/* If we are printing a map or an array, we want some special
formatting. */
- is_map = hint && ! strcmp (hint, "map");
- is_array = hint && ! strcmp (hint, "array");
+ is_map = hint && streq (hint, "map");
+ is_array = hint && streq (hint, "array");
gdbpy_ref<> children (PyObject_CallMethodObjArgs (printer, gdbpy_children_cst,
NULL));
if (!sub->var.has_value ())
continue;
- if (strcmp (sub->name, "foreground") == 0)
+ if (streq (sub->name, "foreground"))
{
const ui_file_style::color &color
= sub->var->get<ui_file_style::color> ();
style.set_fg (color);
has_fg = true;
}
- else if (strcmp (sub->name, "background") == 0)
+ else if (streq (sub->name, "background"))
{
const ui_file_style::color &color
= sub->var->get<ui_file_style::color> ();
style.set_bg (color);
has_bg = true;
}
- else if (strcmp (sub->name, "intensity") == 0
- && sub->var->type () == var_enum)
+ else if (streq (sub->name, "intensity") && sub->var->type () == var_enum)
{
const char *intensity_str = sub->var->get<const char *> ();
ui_file_style::intensity intensity = ui_file_style::NORMAL;
- if (strcmp (intensity_str, "bold") == 0)
+ if (streq (intensity_str, "bold"))
intensity = ui_file_style::BOLD;
- else if (strcmp (intensity_str, "dim") == 0)
+ else if (streq (intensity_str, "dim"))
intensity = ui_file_style::DIM;
style.set_intensity (intensity);
has_intensity = true;
l++)
if (value == l->use)
{
- if (strcmp (l->literal, "unlimited") == 0)
+ if (streq (l->literal, "unlimited"))
{
/* Compatibility hack for API brokenness. */
if (var.type () == var_pinteger
else
error (_("Invalid format."));
}
- else if (strcmp (method, "full") == 0)
+ else if (streq (method, "full"))
{
if (format == NULL)
execute_command_to_string ("record full", from_tty, false);
else
error (_("Invalid format."));
}
- else if (strcmp (method, "btrace") == 0)
+ else if (streq (method, "btrace"))
{
if (format == NULL)
execute_command_to_string ("record btrace", from_tty, false);
- else if (strcmp (format, "bts") == 0)
+ else if (streq (format, "bts"))
execute_command_to_string ("record btrace bts", from_tty, false);
- else if (strcmp (format, "pt") == 0)
+ else if (streq (format, "pt"))
execute_command_to_string ("record btrace pt", from_tty, false);
else
error (_("Invalid format."));
int size = command_size_to_target_size (record_insn_history_size);
- if (arg == NULL || *arg == 0 || strcmp (arg, "+") == 0)
+ if (arg == NULL || *arg == 0 || streq (arg, "+"))
target_insn_history (size, flags);
- else if (strcmp (arg, "-") == 0)
+ else if (streq (arg, "-"))
target_insn_history (-size, flags);
else
{
int size = command_size_to_target_size (record_call_history_size);
- if (arg == NULL || *arg == 0 || strcmp (arg, "+") == 0)
+ if (arg == NULL || *arg == 0 || streq (arg, "+"))
target_call_history (size, flags);
- else if (strcmp (arg, "-") == 0)
+ else if (streq (arg, "-"))
target_call_history (-size, flags);
else
{
bool operator== (const reg &other) const
{
- return (strcmp (name, other.name) == 0
+ return (streq (name, other.name)
&& offset == other.offset
&& size == other.size);
}
{
for (const struct reggroup *group : gdbarch_reggroups (gdbarch))
{
- if (strcmp (name, group->name ()) == 0)
+ if (streq (name, group->name ()))
return group;
}
return NULL;
else
c = strchr (buf, '\0');
for (idx = 0; remote_fio_func_map[idx].name; ++idx)
- if (!strcmp (remote_fio_func_map[idx].name, buf))
+ if (streq (remote_fio_func_map[idx].name, buf))
break;
if (!remote_fio_func_map[idx].name)
remote_fileio_reply (remote, -1, FILEIO_ENOSYS);
if (args == NULL)
error (_("Argument required (integer, \"fixed\" or \"limit\")."));
- else if (strcmp (args, "hard") == 0
- || strcmp (args, "fixed") == 0)
+ else if (streq (args, "hard") || streq (args, "fixed"))
fixed_p = 1;
- else if (strcmp (args, "soft") == 0
- || strcmp (args, "limit") == 0)
+ else if (streq (args, "soft") || streq (args, "limit"))
fixed_p = 0;
else
{
switch (result.status ())
{
case PACKET_OK:
- if (strcmp (rs->buf.data (), "1") == 0)
+ if (streq (rs->buf.data (), "1"))
return 1;
break;
case PACKET_ERROR:
}
}
*p = 0;
- if (!rs->last_pass_packet || strcmp (rs->last_pass_packet, pass_packet))
+ if (!rs->last_pass_packet || !streq (rs->last_pass_packet, pass_packet))
{
putpkt (pass_packet);
getpkt (&rs->buf);
}
*p = 0;
if (!rs->last_program_signals_packet
- || strcmp (rs->last_program_signals_packet, packet) != 0)
+ || !streq (rs->last_program_signals_packet, packet))
{
putpkt (packet);
getpkt (&rs->buf);
putpkt (v_mustreplyempty);
getpkt (&rs->buf);
- if (strcmp (rs->buf.data (), "OK") == 0)
+ if (streq (rs->buf.data (), "OK"))
{
m_features.m_protocol_packets[PACKET_vFile_setfs].support
= PACKET_DISABLE;
}
- else if (strcmp (rs->buf.data (), "") != 0)
+ else if (!streq (rs->buf.data (), ""))
error (_("Remote replied unexpectedly to '%s': %s"), v_mustreplyempty,
rs->buf.data ());
}
putpkt ("QNonStop:1");
getpkt (&rs->buf);
- if (strcmp (rs->buf.data (), "OK") != 0)
+ if (!streq (rs->buf.data (), "OK"))
error (_("Remote refused setting non-stop mode with: %s"),
rs->buf.data ());
putpkt ("QNonStop:0");
getpkt (&rs->buf);
- if (strcmp (rs->buf.data (), "OK") != 0)
+ if (!streq (rs->buf.data (), "OK"))
error (_("Remote refused setting all-stop mode with: %s"),
rs->buf.data ());
}
reply. In the latter case, there may be more than one thread
stopped --- we pull them all out using the vStopped
mechanism. */
- if (strcmp (rs->buf.data (), "OK") != 0)
+ if (!streq (rs->buf.data (), "OK"))
{
const notif_client *notif = ¬if_client_stop;
/* If the target didn't like the packet, warn the user. Do not try
to undo the user's settings, that would just be maddening. */
- if (strcmp (rs->buf.data (), "OK") != 0)
+ if (!streq (rs->buf.data (), "OK"))
warning (_("Remote refused setting permissions with: %s"),
rs->buf.data ());
}
do
{
- if (strcmp (p, xml) == 0)
+ if (streq (p, xml))
{
/* already there */
xfree (copy);
}
for (i = 0; i < ARRAY_SIZE (remote_protocol_features); i++)
- if (strcmp (remote_protocol_features[i].name, p) == 0)
+ if (streq (remote_protocol_features[i].name, p))
{
const struct protocol_feature *feature;
wait_status = (char *) alloca (strlen (rs->buf.data ()) + 1);
strcpy (wait_status, rs->buf.data ());
}
- else if (strcmp (rs->buf.data (), "OK") != 0)
+ else if (!streq (rs->buf.data (), "OK"))
error (_("Attaching to %s failed with: %s"),
target_pid_to_str (ptid_t (pid)).c_str (),
rs->buf.data ());
reply will be reported asynchronously by means of a `%Stop'
notification. */
getpkt (&rs->buf);
- if (strcmp (rs->buf.data (), "OK") != 0)
+ if (!streq (rs->buf.data (), "OK"))
error (_("Unexpected vCont reply in non-stop mode: %s"),
rs->buf.data ());
}
rs = m_remote->get_remote_state ();
m_remote->putpkt (rs->buf);
m_remote->getpkt (&rs->buf);
- if (strcmp (rs->buf.data (), "OK") != 0)
+ if (!streq (rs->buf.data (), "OK"))
error (_("Unexpected vCont reply in non-stop mode: %s"), rs->buf.data ());
}
come in asynchronously by notification. */
putpkt (rs->buf);
getpkt (&rs->buf);
- if (strcmp (rs->buf.data (), "OK") != 0)
+ if (!streq (rs->buf.data (), "OK"))
error (_("Stopping %s failed: %s"), target_pid_to_str (ptid).c_str (),
rs->buf.data ());
}
while (1)
{
getpkt (&rs->buf);
- if (strcmp (rs->buf.data (), "OK") == 0)
+ if (streq (rs->buf.data (), "OK"))
break;
else
remote_notif_ack (this, nc, rs->buf.data ());
reply = remote_get_noisy_reply ();
if (*reply == '\0')
error (_("Target does not support QDisableRandomization."));
- if (strcmp (reply, "OK") != 0)
+ if (!streq (reply, "OK"))
error (_("Bogus QDisableRandomization reply from target: %s"), reply);
}
putpkt (rs->buf);
getpkt (&rs->buf);
- if (strcmp (rs->buf.data (), "OK") != 0)
+ if (!streq (rs->buf.data (), "OK"))
warning (_("Unable to %s environment variable '%s' on remote."),
action, value);
}
{
putpkt ("QEnvironmentReset");
getpkt (&rs->buf);
- if (strcmp (rs->buf.data (), "OK") != 0)
+ if (!streq (rs->buf.data (), "OK"))
warning (_("Unable to reset environment on remote."));
}
"QStartupWithShell:%d", startup_with_shell ? 1 : 0);
putpkt (rs->buf);
getpkt (&rs->buf);
- if (strcmp (rs->buf.data (), "OK") != 0)
+ if (!streq (rs->buf.data (), "OK"))
error (_("\
Remote replied unexpectedly while setting startup-with-shell: %s"),
rs->buf.data ());
if (!current_program_space->exec_bfd ())
error (_("command cannot be used without an exec file"));
- if (args != NULL && strcmp (args, "-r") == 0)
+ if (args != NULL && streq (args, "-r"))
{
read_only = 1;
args = NULL;
continue; /* Skip zero-length section. */
sectname = bfd_section_name (s);
- if (args && strcmp (args, sectname) != 0)
+ if (args && !streq (args, sectname))
continue; /* Not the section selected by user. */
matched = 1; /* Do this section. */
this request. */
if (rs->finished_object)
{
- if (strcmp (object_name, rs->finished_object) == 0
- && strcmp (annex ? annex : "", rs->finished_annex) == 0
+ if (streq (object_name, rs->finished_object)
+ && streq (annex ? annex : "", rs->finished_annex)
&& offset == rs->finished_offset)
return TARGET_XFER_EOF;
break;
}
- if (strcmp (buf, "OK") != 0)
+ if (!streq (buf, "OK"))
{
for (p = buf; p[0] != '\0' && p[1] != '\0'; p += 2)
{
putpkt ("QTinit");
remote_get_noisy_reply ();
- if (strcmp (rs->buf.data (), "OK") != 0)
+ if (!streq (rs->buf.data (), "OK"))
error (_("Target does not support this command."));
}
rs->buf.size () - strlen (rs->buf.data ()));
putpkt (rs->buf);
remote_get_noisy_reply ();
- if (strcmp (rs->buf.data (), "OK"))
+ if (!streq (rs->buf.data (), "OK"))
warning (_("Target does not support source download."));
if (cmd->control_type == while_control
rs->buf.size () - strlen (rs->buf.data ()));
putpkt (rs->buf);
remote_get_noisy_reply ();
- if (strcmp (rs->buf.data (), "OK"))
+ if (!streq (rs->buf.data (), "OK"))
warning (_("Target does not support source download."));
}
}
putpkt (buf.data ());
remote_get_noisy_reply ();
- if (strcmp (rs->buf.data (), "OK"))
+ if (!streq (rs->buf.data (), "OK"))
error (_("Target does not support tracepoints."));
/* do_single_steps (t); */
putpkt (buf.data ());
remote_get_noisy_reply ();
- if (strcmp (rs->buf.data (), "OK"))
+ if (!streq (rs->buf.data (), "OK"))
error (_("Error on target while setting tracepoints."));
}
putpkt (buf.data ());
remote_get_noisy_reply ();
- if (strcmp (rs->buf.data (), "OK"))
+ if (!streq (rs->buf.data (), "OK"))
error (_("Error on target while setting tracepoints."));
}
buf.size () - strlen (buf.data ()));
putpkt (buf.data ());
remote_get_noisy_reply ();
- if (strcmp (rs->buf.data (), "OK"))
+ if (!streq (rs->buf.data (), "OK"))
warning (_("Target does not support source download."));
}
if (b->cond_string)
buf.size () - strlen (buf.data ()));
putpkt (buf.data ());
remote_get_noisy_reply ();
- if (strcmp (rs->buf.data (), "OK"))
+ if (!streq (rs->buf.data (), "OK"))
warning (_("Target does not support source download."));
}
remote_download_command_source (b->number, loc->address,
remote_get_noisy_reply ();
if (rs->buf[0] == '\0')
error (_("Target does not support this command."));
- if (strcmp (rs->buf.data (), "OK") != 0)
+ if (!streq (rs->buf.data (), "OK"))
error (_("Error on target while downloading trace state variable."));
}
remote_get_noisy_reply ();
if (rs->buf[0] == '\0')
error (_("Target does not support enabling tracepoints while a trace run is ongoing."));
- if (strcmp (rs->buf.data (), "OK") != 0)
+ if (!streq (rs->buf.data (), "OK"))
error (_("Error on target while enabling tracepoint."));
}
remote_get_noisy_reply ();
if (rs->buf[0] == '\0')
error (_("Target does not support disabling tracepoints while a trace run is ongoing."));
- if (strcmp (rs->buf.data (), "OK") != 0)
+ if (!streq (rs->buf.data (), "OK"))
error (_("Error on target while disabling tracepoint."));
}
remote_get_noisy_reply ();
if (rs->buf[0] == '\0')
error (_("Target does not support this command."));
- if (strcmp (rs->buf.data (), "OK") != 0)
+ if (!streq (rs->buf.data (), "OK"))
error (_("Bogus reply from target: %s"), rs->buf.data ());
}
remote_get_noisy_reply ();
if (rs->buf[0] == '\0')
error (_("Target does not support this command."));
- if (strcmp (rs->buf.data (), "OK") != 0)
+ if (!streq (rs->buf.data (), "OK"))
error (_("Bogus reply from target: %s"), rs->buf.data ());
}
reply = remote_get_noisy_reply ();
if (*reply == '\0')
error (_("Target does not support this command."));
- if (strcmp (reply, "OK") != 0)
+ if (!streq (reply, "OK"))
error (_("Bogus reply from target: %s"), reply);
return 0;
}
reply = remote_get_noisy_reply ();
if (*reply == '\0')
error (_("Target does not support this command."));
- if (strcmp (reply, "OK") != 0)
+ if (!streq (reply, "OK"))
error (_("Bogus reply from target: %s"), reply);
}
else if (val)
reply = remote_get_noisy_reply ();
if (*reply == '\0')
error (_("Target does not support this command."));
- if (strcmp (reply, "OK") != 0)
+ if (!streq (reply, "OK"))
error (_("Bogus reply from target: %s"), reply);
}
if (*reply == '\0')
return false;
- if (strcmp (reply, "OK") != 0)
+ if (!streq (reply, "OK"))
error (_("Bogus reply from target: %s"), reply);
return true;
putpkt (rs->buf);
getpkt (&rs->buf);
- if (strcmp (rs->buf.data (), "OK") == 0)
+ if (streq (rs->buf.data (), "OK"))
{
::use_agent = use;
return true;
const char *version
= (const char *) xml_find_attribute (attributes, "version")->value.get ();
- if (strcmp (version, "1.0") != 0)
+ if (!streq (version, "1.0"))
gdb_xml_error (parser, _("Unsupported btrace version: \"%s\""), version);
}
btrace = (struct btrace_data *) user_data;
- if (strcmp (vendor, "GenuineIntel") == 0)
+ if (streq (vendor, "GenuineIntel"))
btrace->variant.pt.config.cpu.vendor = CV_INTEL;
btrace->variant.pt.config.cpu.family = *family;
switch (result.status ())
{
case PACKET_OK:
- if (strcmp (rs->buf.data (), "OK") != 0)
+ if (!streq (rs->buf.data (), "OK"))
error (_("Remote refused setting thread events: %s"), rs->buf.data ());
rs->last_thread_events = enable;
break;
switch (result.status ())
{
case PACKET_OK:
- if (strcmp (rs->buf.data (), "OK") != 0)
+ if (!streq (rs->buf.data (), "OK"))
error (_("Remote refused setting thread options: %s"), rs->buf.data ());
break;
case PACKET_ERROR:
ui_out_emit_tuple tuple_emitter (uiout, "showlist");
const ui_file_style cmd_style = command_style.style ();
for (; list != NULL; list = list->next)
- if (strcmp (list->name, "Z-packet") == 0)
+ if (streq (list->name, "Z-packet"))
continue;
else if (list->type == not_set_cmd)
/* Alias commands are exactly like the original, except they
expected = "qMemTags:0,0:0";
create_fetch_memtags_request (packet, 0x0, 0x0, 0);
- SELF_CHECK (strcmp (packet.data (), expected.c_str ()) == 0);
+ SELF_CHECK (streq (packet.data (), expected.c_str ()));
expected = "qMemTags:deadbeef,10:1";
create_fetch_memtags_request (packet, 0xdeadbeef, 16, 1);
- SELF_CHECK (strcmp (packet.data (), expected.c_str ()) == 0);
+ SELF_CHECK (streq (packet.data (), expected.c_str ()));
/* Test parsing a qMemTags reply. */
/* Test creating a qIsAddressTagged request. */
expected = "qIsAddressTagged:deadbeef";
create_is_address_tagged_request (gdbarch, packet, 0xdeadbeef);
- SELF_CHECK (strcmp (packet.data (), expected.c_str ()) == 0);
+ SELF_CHECK (streq (packet.data (), expected.c_str ()));
/* Test error reply on qIsAddressTagged request. */
reply = "E00";
packet_result result = packet_check_result (buf.data ());
SELF_CHECK (result.status () == PACKET_ERROR);
- SELF_CHECK (strcmp(result.err_msg (), "msg") == 0);
+ SELF_CHECK (streq (result.err_msg (), "msg"));
result = packet_check_result ("E01");
SELF_CHECK (result.status () == PACKET_ERROR);
- SELF_CHECK (strcmp(result.err_msg (), "01") == 0);
+ SELF_CHECK (streq (result.err_msg (), "01"));
SELF_CHECK (packet_check_result ("E1").status () == PACKET_OK);
result = packet_check_result ("E.");
SELF_CHECK (result.status () == PACKET_ERROR);
- SELF_CHECK (strcmp(result.err_msg (), "no error provided") == 0);
+ SELF_CHECK (streq (result.err_msg (), "no error provided"));
SELF_CHECK (packet_check_result ("some response").status () == PACKET_OK);
if (flen == 8
&& type->code () == TYPE_CODE_FLT
&& type->length () == flen
- && (strcmp (type->name (), "builtin_type_ieee_double") == 0
- || strcmp (type->name (), "double") == 0))
+ && (streq (type->name (), "builtin_type_ieee_double")
+ || streq (type->name (), "double")))
type = riscv_fpreg_d_type (gdbarch);
}
number that GDB has assigned them. Then in riscv_register_name we will
return no name for the three duplicates, this hides the duplicates from
the user. */
- if (strcmp (tdesc_feature_name (feature), riscv_freg_feature.name ()) == 0)
+ if (streq (tdesc_feature_name (feature), riscv_freg_feature.name ()))
{
riscv_gdbarch_tdep *tdep = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
int *regnum_ptr = nullptr;
- if (strcmp (reg_name, "fflags") == 0)
+ if (streq (reg_name, "fflags"))
regnum_ptr = &tdep->duplicate_fflags_regnum;
- else if (strcmp (reg_name, "frm") == 0)
+ else if (streq (reg_name, "frm"))
regnum_ptr = &tdep->duplicate_frm_regnum;
- else if (strcmp (reg_name, "fcsr") == 0)
+ else if (streq (reg_name, "fcsr"))
regnum_ptr = &tdep->duplicate_fcsr_regnum;
if (regnum_ptr != nullptr)
/* Any unknown registers in the CSR feature are recorded within a single
block so we can easily identify these registers when making choices
about register groups in riscv_register_reggroup_p. */
- if (strcmp (tdesc_feature_name (feature), riscv_csr_feature.name ()) == 0)
+ if (streq (tdesc_feature_name (feature), riscv_csr_feature.name ()))
{
riscv_gdbarch_tdep *tdep = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
if (tdep->unknown_csrs_first_regnum == -1)
tmp = find_pc_misc_function (pc);
if (tmp >= 0
- && strcmp (misc_function_vector[tmp].name, main_name ()) == 0)
+ && streq (misc_function_vector[tmp].name, main_name ()))
return pc + 8;
}
}
/* We check for ___eabi (three leading underscores) in addition
to __eabi in case the GCC option "-fleading-underscore" was
used to compile the program. */
- if (s.minsym != NULL
- && s.minsym->linkage_name () != NULL
- && (strcmp (s.minsym->linkage_name (), "__eabi") == 0
- || strcmp (s.minsym->linkage_name (), "___eabi") == 0))
+ if (s.minsym != nullptr
+ && s.minsym->linkage_name () != nullptr
+ && (streq (s.minsym->linkage_name (), "__eabi")
+ || streq (s.minsym->linkage_name (), "___eabi")))
pc += 4;
}
return pc;
ptr += 12;
/* The name must be "APUinfo\0". */
- if (name_len != 8
- && strcmp ((const char *) ptr, "APUinfo") != 0)
+ if (name_len != 8 && !streq ((const char *) ptr, "APUinfo"))
break;
ptr += name_len;
for (vector_abi = POWERPC_VEC_AUTO;
vector_abi != POWERPC_VEC_LAST;
vector_abi++)
- if (strcmp (powerpc_vector_abi_string,
- powerpc_vector_strings[vector_abi]) == 0)
+ if (streq (powerpc_vector_abi_string, powerpc_vector_strings[vector_abi]))
{
powerpc_vector_abi_global = (enum powerpc_vector_abi) vector_abi;
break;
const char *field_name = field.name ();
if (startswith (field_name, "__"))
field_name += 2;
- if (strcmp (buf, field_name) != 0)
+ if (!streq (buf, field_name))
return false;
field_number++;
}
return true;
int field_num = 0;
- if (strcmp (type->field (0).name (), "start") == 0)
+ if (streq (type->field (0).name (), "start"))
{
if (type->num_fields () == 1)
return true;
return false;
}
- return strcmp (type->field (field_num).name (), "end") == 0;
+ return streq (type->field (field_num).name (), "end");
}
/* Return true if TYPE is an inclusive range type, otherwise false.
int vtable_field = 0;
for (int i = 0; i < 2; ++i)
{
- if (strcmp (type->field (i).name (), "vtable") == 0)
+ if (streq (type->field (i).name (), "vtable"))
vtable_field = i;
- else if (strcmp (type->field (i).name (), "pointer") != 0)
+ else if (!streq (type->field (i).name (), "pointer"))
return NULL;
}
gdb_assert (rust_slice_type_p (type));
for (const auto &field : type->fields ())
{
- if (strcmp (field.name (), "data_ptr") == 0)
+ if (streq (field.name (), "data_ptr"))
{
struct type *base_type = field.type ()->target_type ();
if (rewrite_slice_type (base_type, nullptr, 0, nullptr))
/* &str is handled here; but for all other slice types it is fine to
simply print the contents. */
- if (orig_type->name () != nullptr
- && strcmp (orig_type->name (), "&str") == 0)
+ if (orig_type->name () != nullptr && streq (orig_type->name (), "&str"))
{
LONGEST low_bound, high_bound;
if (get_array_bounds (type, &low_bound, &high_bound))
case TYPE_CODE_INT:
/* Recognize the unit type. */
- if (type->is_unsigned () && type->length () == 0
- && type->name () != NULL && strcmp (type->name (), "()") == 0)
+ if (type->is_unsigned ()
+ && type->length () == 0
+ && type->name () != nullptr
+ && streq (type->name (), "()"))
{
gdb_puts ("()", stream);
break;
return;
i = 0;
- if (strcmp (type->field (0).name (), "start") == 0)
+ if (streq (type->field (0).name (), "start"))
{
*kind = RANGE_HIGH_BOUND_DEFAULT;
*low = value_as_long (range->field (0));
++i;
}
- if (type->num_fields () > i
- && strcmp (type->field (i).name (), "end") == 0)
+ if (type->num_fields () > i && streq (type->field (i).name (), "end"))
{
*kind = (*kind == (RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT)
? RANGE_LOW_BOUND_DEFAULT : RANGE_STANDARD);
|| (type->code () == TYPE_CODE_STRUCT
&& !rust_enum_p (type)
&& rust_slice_type_p (type)
- && strcmp (type->name (), "&str") == 0));
+ && streq (type->name (), "&str")));
}
/* See language.h. */
}
catch (const gdb_exception_error &except)
{
- SELF_CHECK (strcmp (except.what (), err) == 0);
+ SELF_CHECK (streq (except.what (), err));
}
}
const char *name,
type_instance_flags *type_flags_ptr)
{
- if (strcmp (name, "mode32") == 0)
+ if (streq (name, "mode32"))
{
*type_flags_ptr = TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1;
return true;
static bool skip_arch (const char *arch)
{
- if (strcmp ("powerpc:EC603e", arch) == 0
- || strcmp ("powerpc:e500mc", arch) == 0
- || strcmp ("powerpc:e500mc64", arch) == 0
- || strcmp ("powerpc:titan", arch) == 0
- || strcmp ("powerpc:vle", arch) == 0
- || strcmp ("powerpc:e5500", arch) == 0
- || strcmp ("powerpc:e6500", arch) == 0)
+ if (streq ("powerpc:EC603e", arch)
+ || streq ("powerpc:e500mc", arch)
+ || streq ("powerpc:e500mc64", arch)
+ || streq ("powerpc:titan", arch)
+ || streq ("powerpc:vle", arch)
+ || streq ("powerpc:e5500", arch)
+ || streq ("powerpc:e6500", arch))
{
/* PR 19797 */
return true;
Stack backtrace will not work.
We could instead capture the output and then filter out the warning, but
that seems more trouble than it's worth. */
- return (strcmp (name, "m68hc11") == 0
- || strcmp (name, "m68hc12") == 0
- || strcmp (name, "m68hc12:HCS12") == 0);
+ return (streq (name, "m68hc11")
+ || streq (name, "m68hc12")
+ || streq (name, "m68hc12:HCS12"));
}
} /* namespace selftests */
serial_interface_lookup (const char *name)
{
for (const serial_ops *ops : serial_ops_list)
- if (strcmp (name, ops->name) == 0)
+ if (streq (name, ops->name))
return ops;
return NULL;
*size = kind;
/* For remote stub targets, trapa #20 is used. */
- if (strcmp (target_shortname (), "remote") == 0)
+ if (streq (target_shortname (), "remote"))
{
static unsigned char big_remote_breakpoint[] = { 0xc3, 0x20 };
static unsigned char little_remote_breakpoint[] = { 0x20, 0xc3 };
static int
sol2_pc_in_sigtramp (CORE_ADDR pc, const char *name)
{
- return (name && (strcmp (name, "sigacthandler") == 0
- || strcmp (name, "ucbsigvechandler") == 0
- || strcmp (name, "__sighndlr") == 0));
+ return (name != nullptr
+ && (streq (name, "sigacthandler")
+ || streq (name, "ucbsigvechandler")
+ || streq (name, "__sighndlr")));
}
/* Return whether THIS_FRAME corresponds to a Solaris sigtramp routine. */
char *version
= (char *) xml_find_attribute (attributes, "version")->value.get ();
- if (strcmp (version, "1.0") != 0)
+ if (!streq (version, "1.0"))
gdb_xml_error (parser,
_("Library list has unsupported version \"%s\""),
version);
const char *section_name = bfd_section_name (bfd_sect);
auto *info = gdb::checked_static_cast<lm_info_aix *> (so.lm_info.get ());
- if (strcmp (section_name, ".text") == 0)
+ if (streq (section_name, ".text"))
{
sec->addr = info->text_addr;
sec->endaddr = sec->addr + info->text_size;
XCOFF headers, so we need to adjust by this much. */
sec->addr += bfd_sect->filepos;
}
- else if (strcmp (section_name, ".data") == 0)
+ else if (streq (section_name, ".data"))
{
sec->addr = info->data_addr;
sec->endaddr = sec->addr + info->data_size;
}
- else if (strcmp (section_name, ".bss") == 0)
+ else if (streq (section_name, ".bss"))
{
/* The information provided by the loader does not include
the address of the .bss section, but we know that it gets
data_obj_section_from_objfile (struct objfile *objfile)
{
for (obj_section &osect : objfile->sections ())
- if (strcmp (bfd_section_name (osect.the_bfd_section), ".data") == 0)
+ if (streq (bfd_section_name (osect.the_bfd_section), ".data"))
return &osect;
return NULL;
for (const asymbol *sym : symbol_table)
{
- if (strcmp (sym->name, symname) == 0
+ if (streq (sym->name, symname)
&& (sym->section->flags & (SEC_CODE | SEC_DATA)) != 0)
{
/* BFD symbols are section relative. */
(tmp_bfd.get (),
[] (const asymbol *sym)
{
- return strcmp (sym->name, "_dl_debug_state") == 0;
+ return streq (sym->name, "_dl_debug_state");
}));
if (addr != 0)
(tmp_bfd.get (),
[] (const asymbol *sym)
{
- return strcmp (sym->name, "_dl_debug_addr") == 0;
+ return streq (sym->name, "_dl_debug_addr");
}));
if (addr == 0)
address according to the link map and then dereferencing
this address (which is a GOT entry) to obtain a descriptor
address. */
- if ((name == 0 || strcmp (name, (*rel->sym_ptr_ptr)->name) == 0)
+ if ((name == 0 || streq (name, (*rel->sym_ptr_ptr)->name))
&& rel->howto->type == R_FRV_FUNCDESC)
{
gdb_byte buf [FRV_PTR_SIZE];
static bool
svr4_same_name (const char *gdb_so_name, const char *inferior_so_name)
{
- if (strcmp (gdb_so_name, inferior_so_name) == 0)
+ if (streq (gdb_so_name, inferior_so_name))
return 1;
/* On Solaris, when starting inferior we think that dynamic linker is
sometimes they have identical content, but are not linked to each
other. We don't restrict this check for Solaris, but the chances
of running into this situation elsewhere are very low. */
- if (strcmp (gdb_so_name, "/usr/lib/ld.so.1") == 0
- && strcmp (inferior_so_name, "/lib/ld.so.1") == 0)
+ if (streq (gdb_so_name, "/usr/lib/ld.so.1")
+ && streq (inferior_so_name, "/lib/ld.so.1"))
return 1;
/* Similarly, we observed the same issue with amd64 and sparcv9, but with
different locations. */
- if (strcmp (gdb_so_name, "/usr/lib/amd64/ld.so.1") == 0
- && strcmp (inferior_so_name, "/lib/amd64/ld.so.1") == 0)
+ if (streq (gdb_so_name, "/usr/lib/amd64/ld.so.1")
+ && streq (inferior_so_name, "/lib/amd64/ld.so.1"))
return 1;
- if (strcmp (gdb_so_name, "/usr/lib/sparcv9/ld.so.1") == 0
- && strcmp (inferior_so_name, "/lib/sparcv9/ld.so.1") == 0)
+ if (streq (gdb_so_name, "/usr/lib/sparcv9/ld.so.1")
+ && streq (inferior_so_name, "/lib/sparcv9/ld.so.1"))
return 1;
return 0;
= (const char *) xml_find_attribute (attributes, "version")->value.get ();
struct gdb_xml_value *main_lm = xml_find_attribute (attributes, "main-lm");
- if (strcmp (version, "1.0") != 0)
+ if (!streq (version, "1.0"))
gdb_xml_error (parser,
_("SVR4 Library list has unsupported version \"%s\""),
version);
static bool
is_thread_local_section (struct bfd_section *bfd_sect)
{
- return ((strcmp (bfd_sect->name, ".tdata") == 0
- || strcmp (bfd_sect->name, ".tbss") == 0)
+ return ((streq (bfd_sect->name, ".tdata") || streq (bfd_sect->name, ".tbss"))
&& bfd_sect->size != 0);
}
for (mainp = main_name_list; *mainp != NULL; mainp++)
{
- if (strcmp (soname, *mainp) == 0)
+ if (streq (soname, *mainp))
return (1);
}
(tmp_bfd.get (),
[=] (const asymbol *sym)
{
- return (strcmp (sym->name, *bkpt_namep) == 0
+ return (streq (sym->name, *bkpt_namep)
&& ((sym->section->flags & (SEC_CODE | SEC_DATA))
!= 0));
}));
{
const char *string = (const char *) version->value.get ();
- if (strcmp (string, "1.0") != 0)
+ if (!streq (string, "1.0"))
gdb_xml_error (parser,
_("Library list has unsupported version \"%s\""),
string);
There's no need to check for drive spec explicitly, as we only
get here if IN_PATHNAME is considered an absolute path. */
need_dir_separator = !(IS_DIR_SEPARATOR (in_pathname[0])
- || strcmp (TARGET_SYSROOT_PREFIX, sysroot) == 0);
+ || streq (TARGET_SYSROOT_PREFIX, sysroot));
/* Cat the prefixed pathname together. */
temp_pathname.reset (concat (sysroot,
range of the shared object, assume we want the location of
the .text section. */
if (so.addr_low == 0 && so.addr_high == 0
- && strcmp (p.the_bfd_section->name, ".text") == 0)
+ && streq (p.the_bfd_section->name, ".text"))
{
so.addr_low = p.addr;
so.addr_high = p.endaddr;
const char *name = symtab->filename ();
int len = strlen (name);
- if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0
- || strcmp (name, "<<C++-namespaces>>") == 0)))
+ if (!(len > 2 && (streq (&name[len - 2], ".h")
+ || streq (name, "<<C++-namespaces>>"))))
new_symtab = symtab;
}
}
char *dir = dir_up.get ();
int reg_file_errno;
- if (strcmp (dir, "$cwd") == 0)
+ if (streq (dir, "$cwd"))
{
/* Name is $cwd -- insert current directory name instead. */
filename = cwd;
contexts. If the user really has '$cdir' one can use './$cdir'.
We can get $cdir when loading scripts. When loading source files
$cdir must have already been expanded to the correct value. */
- if (strcmp (dir, "$cdir") == 0)
+ if (streq (dir, "$cdir"))
continue;
/* Normal file name in path -- just use it. */
static int
sparc64fbsd_pc_in_sigtramp (CORE_ADDR pc, const char *name)
{
- return (name && strcmp (name, "__sigtramp") == 0);
+ return (name && streq (name, "__sigtramp"));
}
static struct sparc_frame_cache *
pc = get_frame_address_in_block (this_frame);
find_pc_partial_function (pc, &name, NULL, NULL);
- if (name && strcmp (name, "Lslowtrap_reenter") == 0)
+ if (name && streq (name, "Lslowtrap_reenter"))
return 1;
return 0;
/* Try to remove possibly duplicate error message for ENTRYARGP even
in MI mode. */
- if (val_error && entryval_error
- && strcmp (val_error, entryval_error) == 0)
+ if (val_error != nullptr
+ && entryval_error != nullptr
+ && streq (val_error, entryval_error))
{
entryval_error = NULL;
for (asection *sect : gdb_bfd_sections (obfd))
if ((sect->flags & (SEC_DATA | SEC_ALLOC | SEC_HAS_CONTENTS))
- && sect->name && !strcmp (sect->name, STAP_BASE_SECTION_NAME))
+ && sect->name != nullptr
+ && streq (sect->name, STAP_BASE_SECTION_NAME))
ret = sect;
if (ret == NULL)
static const char *
addr_section_name (const char *s)
{
- if (strcmp (s, ".dynbss") == 0)
+ if (streq (s, ".dynbss"))
return ".bss";
- if (strcmp (s, ".sdynbss") == 0)
+ if (streq (s, ".sdynbss"))
return ".sbss";
return s;
abfd_sorted_iter++;
if (abfd_sorted_iter != abfd_addrs_sorted.end ()
- && strcmp (addr_section_name ((*abfd_sorted_iter)->name.c_str ()),
- sect_name) == 0)
+ && streq (addr_section_name ((*abfd_sorted_iter)->name.c_str ()),
+ sect_name))
{
int index_in_addrs;
else
error (_("Unrecognized argument \"%s\""), arg);
}
- else if (strcmp (arg, "-readnow") == 0)
+ else if (streq (arg, "-readnow"))
flags |= OBJF_READNOW;
- else if (strcmp (arg, "-readnever") == 0)
+ else if (streq (arg, "-readnever"))
flags |= OBJF_READNEVER;
- else if (strcmp (arg, "-o") == 0)
+ else if (streq (arg, "-o"))
{
arg = built_argv[++idx];
if (arg == NULL)
offset = parse_and_eval_address (arg);
}
- else if (strcmp (arg, "--") == 0)
+ else if (streq (arg, "--"))
stop_processing_options = true;
else
error (_("Unrecognized argument \"%s\""), arg);
else
error (_("Unrecognized argument \"%s\""), arg);
}
- else if (strcmp (arg, "-readnow") == 0)
+ else if (streq (arg, "-readnow"))
flags |= OBJF_READNOW;
- else if (strcmp (arg, "-readnever") == 0)
+ else if (streq (arg, "-readnever"))
flags |= OBJF_READNEVER;
- else if (strcmp (arg, "-s") == 0)
+ else if (streq (arg, "-s"))
{
if (argv[argcnt + 1] == NULL)
error (_("Missing section name after \"-s\""));
sect_opts.push_back (sect);
argcnt += 2;
}
- else if (strcmp (arg, "-o") == 0)
+ else if (streq (arg, "-o"))
{
arg = argv[++argcnt];
if (arg == NULL)
offset = parse_and_eval_address (arg);
seen_offset = true;
}
- else if (strcmp (arg, "--") == 0)
+ else if (streq (arg, "--"))
stop_processing_options = true;
else
error (_("Unrecognized argument \"%s\""), arg);
/* First, find a section matching the user supplied argument. */
for (objfile &obj_file : current_program_space->objfiles ())
for (obj_section &sec : obj_file.sections ())
- if (!strcmp (bfd_section_name (sec.the_bfd_section), args))
+ if (streq (bfd_section_name (sec.the_bfd_section), args))
{
/* Now, check to see if the section is an overlay. */
if (!section_is_overlay (&sec))
/* First, find a section matching the user supplied argument. */
for (objfile &objfile : current_program_space->objfiles ())
for (obj_section &sec : objfile.sections ())
- if (!strcmp (bfd_section_name (sec.the_bfd_section), args))
+ if (streq (bfd_section_name (sec.the_bfd_section), args))
{
if (!sec.ovly_mapped)
error (_("Section %s is not mapped"), args);
for (i = 0; argv != NULL && argv[i] != NULL; ++i)
{
- if (strcmp (argv[i], "-pc") == 0)
+ if (streq (argv[i], "-pc"))
{
if (argv[i + 1] == NULL)
error (_("Missing pc value"));
address_arg = argv[++i];
}
- else if (strcmp (argv[i], "-source") == 0)
+ else if (streq (argv[i], "-source"))
{
if (argv[i + 1] == NULL)
error (_("Missing source file"));
source_arg = argv[++i];
}
- else if (strcmp (argv[i], "-objfile") == 0)
+ else if (streq (argv[i], "-objfile"))
{
if (argv[i + 1] == NULL)
error (_("Missing objfile name"));
objfile_arg = argv[++i];
}
- else if (strcmp (argv[i], "--") == 0)
+ else if (streq (argv[i], "--"))
{
/* End of options. */
++i;
for (i = 0; argv != NULL && argv[i] != NULL; ++i)
{
- if (strcmp (argv[i], "-objfile") == 0)
+ if (streq (argv[i], "-objfile"))
{
if (argv[i + 1] == NULL)
error (_("Missing objfile name"));
objfile_arg = argv[++i];
}
- else if (strcmp (argv[i], "--") == 0)
+ else if (streq (argv[i], "--"))
{
/* End of options. */
++i;
{
for (int i = 0; i < num; ++i)
{
- if (strcmp (name, syms[i]->natural_name ()) == 0)
+ if (streq (name, syms[i]->natural_name ()))
return syms[i];
}
return nullptr;
is_full_physname_constructor = is_constructor_name (physname);
- is_constructor = is_full_physname_constructor
- || (newname && strcmp (field_name, newname) == 0);
+ is_constructor = (is_full_physname_constructor
+ || (newname != nullptr && streq (field_name, newname)));
if (!is_destructor)
is_destructor = (startswith (physname, "__dt"));
!= bfd_section_vma (second) - bfd_get_start_address (second->owner))
return false;
- if (bfd_section_name (first) == NULL
- || bfd_section_name (second) == NULL
- || strcmp (bfd_section_name (first), bfd_section_name (second)) != 0)
+ if (bfd_section_name (first) == nullptr
+ || bfd_section_name (second) == nullptr
+ || !streq (bfd_section_name (first), bfd_section_name (second)))
return false;
/* Otherwise check that they are in corresponding objfiles. */
if (slot->state == SYMBOL_SLOT_NOT_FOUND)
{
- if (strcmp (slot_name, name) != 0)
+ if (!streq (slot_name, name))
return 0;
}
else
auto match_cb = [=] (const struct target_section *s)
{
- return (strcmp (section_name, s->the_bfd_section->name) == 0);
+ return streq (section_name, s->the_bfd_section->name);
};
return section_table_xfer_memory_partial (readbuf, writebuf,
if (temp == NULL)
break;
- if (strcmp (temp->line, command) == 0)
+ if (streq (temp->line, command))
{
HIST_ENTRY *prev = remove_history (where_history ());
command_count--;
/* After the required info we print the configuration information. */
gdb_printf (stream, "This GDB was configured as \"");
- if (strcmp (host_name, target_name) != 0)
+ if (!streq (host_name, target_name))
{
gdb_printf (stream, "--host=%s --target=%s",
host_name, target_name);
bt_ctf_get_event_decl_list (handle_id, ctx, &list, &count);
for (i = 0; i < count; i++)
- if (strcmp ("register", bt_ctf_get_decl_event_name (list[i])) == 0)
+ if (streq ("register", bt_ctf_get_decl_event_name (list[i])))
{
const struct bt_ctf_field_decl * const *field_list;
const struct bt_declaration *decl;
&count);
gdb_assert (count == 1);
- gdb_assert (0 == strcmp ("contents",
- bt_ctf_get_decl_field_name (field_list[0])));
+ gdb_assert (streq ("contents",
+ bt_ctf_get_decl_field_name (field_list[0])));
decl = bt_ctf_get_decl_from_field_decl (field_list[0]);
trace_regblock_size = bt_ctf_get_array_len (decl);
name = bt_ctf_event_name (event1);
- if (name == NULL || strcmp (name, "frame") == 0)
+ if (name == NULL || streq (name, "frame"))
break;
- else if (strcmp (name, "register") == 0)
+ else if (streq (name, "register"))
{
event = event1;
break;
= bt_ctf_iter_read_event (ctf_iter);
const char *name = bt_ctf_event_name (event);
- if (name == NULL || strcmp (name, "frame") == 0)
+ if (name == NULL || streq (name, "frame"))
break;
- else if (strcmp (name, "memory") != 0)
+ else if (!streq (name, "memory"))
{
if (bt_iter_next (bt_ctf_get_iter (ctf_iter)) < 0)
break;
= bt_ctf_iter_read_event (ctf_iter);
const char *name = bt_ctf_event_name (event);
- if (name == NULL || strcmp (name, "frame") == 0)
+ if (name == NULL || streq (name, "frame"))
break;
- else if (strcmp (name, "tsv") == 0)
+ else if (streq (name, "tsv"))
{
const struct bt_definition *scope;
const struct bt_definition *def;
if (name == NULL)
break;
- else if (strcmp (name, "frame") == 0)
+ else if (streq (name, "frame"))
{
event = event1;
break;
if (event == NULL || name == NULL)
break;
- if (strcmp (name, "frame") == 0)
+ if (streq (name, "frame"))
{
CORE_ADDR tfaddr;
name = bt_ctf_event_name (event);
- if (name == NULL || strcmp (name, "register") == 0
- || strcmp (name, "frame") == 0)
+ if (name == nullptr || streq (name, "register") || streq (name, "frame"))
;
- else if (strcmp (name, "memory") == 0)
+ else if (streq (name, "memory"))
{
const struct bt_definition *scope
= bt_ctf_get_top_level_scope (event,
info->memory.emplace_back (start, length);
}
- else if (strcmp (name, "tsv") == 0)
+ else if (streq (name, "tsv"))
{
int vnum;
const struct bt_definition *scope
if (bt_iter_next (bt_ctf_get_iter (ctf_iter)) < 0)
break;
}
- while (name != NULL && strcmp (name, "frame") != 0);
+ while (name != NULL && !streq (name, "frame"));
/* Restore the position. */
bt_iter_set_pos (bt_ctf_get_iter (ctf_iter), pos);
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
{
- if (strcmp (annex, "target.xml"))
+ if (!streq (annex, "target.xml"))
return TARGET_XFER_E_IO;
if (readbuf == NULL)
for (; *argv; ++argv)
{
- if (strcmp (*argv, "-r") == 0)
+ if (streq (*argv, "-r"))
target_does_save = 1;
- else if (strcmp (*argv, "-ctf") == 0)
+ else if (streq (*argv, "-ctf"))
generate_ctf = 1;
else if (**argv == '-')
error (_("unknown option `%s'"), *argv);
else
frameno = traceframe_number + 1;
}
- else if (0 == strcmp (args, "-"))
+ else if (streq (args, "-"))
{
if (traceframe_number == -1)
error (_("not debugging trace buffer"));
frameno = traceframe_number - 1;
}
/* A hack to work around eval's need for fp to have been collected. */
- else if (0 == strcmp (args, "-1"))
+ else if (streq (args, "-1"))
frameno = -1;
else
frameno = parse_and_eval_long (args);
if (str1 == NULL || str2 == NULL)
return (str1 == str2);
- return (strcmp (str1, str2) == 0);
+ return (streq (str1, str2));
}
/* Look for an existing tracepoint that seems similar enough to the
{
tui_win_info *focus = tui_win_with_focus ();
- if (strcmp (focus->name (), CMD_NAME) == 0)
+ if (streq (focus->name (), CMD_NAME))
{
/* Try leaving the source or disassembly window. If neither
exists, just do nothing. */
std::string
tui_layout_window::layout_fingerprint () const
{
- if (strcmp (get_name (), "cmd") == 0)
+ if (streq (get_name (), "cmd"))
return "C";
else
return "";
if (preserve_cmd_win_size_p
&& cmd_win_already_exists
&& m_splits[i].layout->get_name () != nullptr
- && strcmp (m_splits[i].layout->get_name (), "cmd") == 0)
+ && streq (m_splits[i].layout->get_name (), "cmd"))
{
/* Save the old cmd window information, in case we need to
restore it later. */
const char *this_name = m_splits[i].layout->get_name ();
if (this_name == nullptr)
m_splits[i].layout->remove_windows (name);
- else if (strcmp (this_name, name) == 0
- || strcmp (this_name, CMD_NAME) == 0
- || strcmp (this_name, STATUS_NAME) == 0)
+ else if (streq (this_name, name)
+ || streq (this_name, CMD_NAME)
+ || streq (this_name, STATUS_NAME))
{
/* Keep. */
}
{
while (table->name)
{
- if (name && strcmp (table->name, name) == 0)
+ if (name && streq (table->name, name))
return table->value;
table++;
}
{
/* The ACS characters are determined at run time by curses terminal
management. */
- if (strcmp (name, "acs") == 0)
+ if (streq (name, "acs"))
return acs_char;
return translate (name, table);
/* If the top level interpreter is not the console/tui (e.g.,
MI), enabling curses will certainly lose. */
interp = top_level_interpreter ()->name ();
- if (strcmp (interp, INTERP_TUI) != 0)
+ if (!streq (interp, INTERP_TUI))
error (_("Cannot enable the TUI when the interpreter is '%s'"), interp);
/* Don't try to setup curses (and print funny control
const char *colorterm = getenv ("COLORTERM");
if (colors >= 16777216
|| (colorterm != nullptr
- && (!strcmp (colorterm, "truecolor")
- || !strcmp (colorterm, "24bit"))))
+ && (streq (colorterm, "truecolor")
+ || streq (colorterm, "24bit"))))
result.push_back (color_space::RGB_24BIT);
return result;
const char *result = ::child_path (parent, child);
if (result == NULL || expected == NULL)
return result == expected;
- return strcmp (result, expected) == 0;
+ return streq (result, expected);
}
/* Test child_path. */
SELF_CHECK (!one.finished ());
SELF_CHECK (one.get_number () == 1);
SELF_CHECK (one.finished ());
- SELF_CHECK (strcmp (one.cur_tok (), "") == 0);
+ SELF_CHECK (streq (one.cur_tok (), ""));
}
/* Test parsing an integer followed by a non integer. */
SELF_CHECK (!one_after.finished ());
SELF_CHECK (one_after.get_number () == 1);
SELF_CHECK (one_after.finished ());
- SELF_CHECK (strcmp (one_after.cur_tok (), "after") == 0);
+ SELF_CHECK (streq (one_after.cur_tok (), "after"));
}
/* Test parsing a range. */
SELF_CHECK (one_three.get_number () == i);
}
SELF_CHECK (one_three.finished ());
- SELF_CHECK (strcmp (one_three.cur_tok (), "") == 0);
+ SELF_CHECK (streq (one_three.cur_tok (), ""));
}
/* Test parsing a range followed by a non-integer. */
SELF_CHECK (one_three_after.get_number () == i);
}
SELF_CHECK (one_three_after.finished ());
- SELF_CHECK (strcmp (one_three_after.cur_tok (), "after") == 0);
+ SELF_CHECK (streq (one_three_after.cur_tok (), "after"));
}
/* Test a negative integer gives an error. */
{
SELF_CHECK (ex.reason == RETURN_ERROR);
SELF_CHECK (ex.error == GENERIC_ERROR);
- SELF_CHECK (strcmp (ex.what (), "negative value") == 0);
- SELF_CHECK (strcmp (minus_one.cur_tok (), "-1") == 0);
+ SELF_CHECK (streq (ex.what (), "negative value"));
+ SELF_CHECK (streq (minus_one.cur_tok (), "-1"));
}
}
number_or_range_parser nan ("-whatever");
SELF_CHECK (nan.finished ());
- SELF_CHECK (strcmp (nan.cur_tok (), "-whatever") == 0);
+ SELF_CHECK (streq (nan.cur_tok (), "-whatever"));
}
}
/* Compare the resulting strings. */
expected[len] = actual[len] = '\0';
- if (strcmp (expected, actual) != 0)
+ if (!streq (expected, actual))
error (_("copy_bitwise %s != %s (%u+%u -> %u)"),
expected, actual, source_offset, nbits, dest_offset);
}
/* Our test environment variable should be present at the
vector. */
- SELF_CHECK (strcmp (env.get (gdb_selftest_env_var), "1") == 0);
+ SELF_CHECK (streq (env.get (gdb_selftest_env_var), "1"));
}
/* Test reinitialization using the host's environ. */
int num_found = 0;
for (size_t i = 0; envp[i] != NULL; ++i)
- if (strcmp (envp[i], "GDB_SELFTEST_ENVIRON=1") == 0)
+ if (streq (envp[i], "GDB_SELFTEST_ENVIRON=1"))
++num_found;
SELF_CHECK (num_found == 1);
}
gdb_environ env;
env.set ("GDB_SELFTEST_ENVIRON_1", "aaa");
- SELF_CHECK (strcmp (env.get ("GDB_SELFTEST_ENVIRON_1"), "aaa") == 0);
+ SELF_CHECK (streq (env.get ("GDB_SELFTEST_ENVIRON_1"), "aaa"));
/* User-set environ var list must contain one element. */
SELF_CHECK (env.user_set_env ().size () == 1);
SELF_CHECK (set_contains (env.user_set_env (),
std::string ("GDB_SELFTEST_ENVIRON_1=aaa")));
env.set ("GDB_SELFTEST_ENVIRON_2", "bbb");
- SELF_CHECK (strcmp (env.get ("GDB_SELFTEST_ENVIRON_2"), "bbb") == 0);
+ SELF_CHECK (streq (env.get ("GDB_SELFTEST_ENVIRON_2"), "bbb"));
env.unset ("GDB_SELFTEST_ENVIRON_1");
SELF_CHECK (env.get ("GDB_SELFTEST_ENVIRON_1") == NULL);
- SELF_CHECK (strcmp (env.get ("GDB_SELFTEST_ENVIRON_2"), "bbb") == 0);
+ SELF_CHECK (streq (env.get ("GDB_SELFTEST_ENVIRON_2"), "bbb"));
/* The user-set environ var list must contain only one element
now. */
gdb_environ env;
env.set ("PWD", "test");
- SELF_CHECK (strcmp (env.get ("PWD"), "test") == 0);
+ SELF_CHECK (streq (env.get ("PWD"), "test"));
SELF_CHECK (set_contains (env.user_set_env (), std::string ("PWD=test")));
SELF_CHECK (env.user_unset_env ().size () == 0);
/* The second element must be NULL. */
gdb_environ env2;
env.set ("A", "1");
- SELF_CHECK (strcmp (env.get ("A"), "1") == 0);
+ SELF_CHECK (streq (env.get ("A"), "1"));
SELF_CHECK (set_contains (env.user_set_env (), std::string ("A=1")));
SELF_CHECK (env.user_set_env ().size () == 1);
env2 = std::move (env);
SELF_CHECK (env.envp ()[0] == NULL);
- SELF_CHECK (strcmp (env2.get ("A"), "1") == 0);
+ SELF_CHECK (streq (env2.get ("A"), "1"));
SELF_CHECK (env2.envp ()[1] == NULL);
SELF_CHECK (env.user_set_env ().size () == 0);
SELF_CHECK (set_contains (env2.user_set_env (), std::string ("A=1")));
SELF_CHECK (env2.user_set_env ().size () == 1);
env.set ("B", "2");
- SELF_CHECK (strcmp (env.get ("B"), "2") == 0);
+ SELF_CHECK (streq (env.get ("B"), "2"));
SELF_CHECK (env.envp ()[1] == NULL);
}
gdb_environ env;
env.set ("A", "1");
- SELF_CHECK (strcmp (env.get ("A"), "1") == 0);
+ SELF_CHECK (streq (env.get ("A"), "1"));
SELF_CHECK (set_contains (env.user_set_env (), std::string ("A=1")));
gdb_environ env2 = std::move (env);
SELF_CHECK (env.envp ()[0] == NULL);
SELF_CHECK (env.user_set_env ().size () == 0);
- SELF_CHECK (strcmp (env2.get ("A"), "1") == 0);
+ SELF_CHECK (streq (env2.get ("A"), "1"));
SELF_CHECK (env2.envp ()[1] == NULL);
SELF_CHECK (set_contains (env2.user_set_env (), std::string ("A=1")));
SELF_CHECK (env2.user_set_env ().size () == 1);
env.set ("B", "2");
- SELF_CHECK (strcmp (env.get ("B"), "2") == 0);
+ SELF_CHECK (streq (env.get ("B"), "2"));
SELF_CHECK (env.envp ()[1] == NULL);
SELF_CHECK (set_contains (env.user_set_env (), std::string ("B=2")));
SELF_CHECK (env.user_set_env ().size () == 1);
/* Test self-move. */
env.set ("A", "1");
- SELF_CHECK (strcmp (env.get ("A"), "1") == 0);
+ SELF_CHECK (streq (env.get ("A"), "1"));
SELF_CHECK (set_contains (env.user_set_env (), std::string ("A=1")));
SELF_CHECK (env.user_set_env ().size () == 1);
env = std::move (env);
DIAGNOSTIC_POP
- SELF_CHECK (strcmp (env.get ("A"), "1") == 0);
- SELF_CHECK (strcmp (env.envp ()[0], "A=1") == 0);
+ SELF_CHECK (streq (env.get ("A"), "1"));
+ SELF_CHECK (streq (env.envp ()[0], "A=1"));
SELF_CHECK (env.envp ()[1] == NULL);
SELF_CHECK (set_contains (env.user_set_env (), std::string ("A=1")));
SELF_CHECK (env.user_set_env ().size () == 1);
/* Set our test variable to another value. */
env.set ("GDB_SELFTEST_ENVIRON", "test");
- SELF_CHECK (strcmp (env.get ("GDB_SELFTEST_ENVIRON"), "test") == 0);
+ SELF_CHECK (streq (env.get ("GDB_SELFTEST_ENVIRON"), "test"));
SELF_CHECK (env.user_set_env ().size () == 1);
SELF_CHECK (env.user_unset_env ().size () == 0);
/* Re-set the test variable. */
env.set ("GDB_SELFTEST_ENVIRON", "1");
- SELF_CHECK (strcmp (env.get ("GDB_SELFTEST_ENVIRON"), "1") == 0);
+ SELF_CHECK (streq (env.get ("GDB_SELFTEST_ENVIRON"), "1"));
}
static void
SELF_CHECK (&item == expected[i]);
/* Access the item, to make sure the object is still alive. */
- SELF_CHECK (strcmp (item.name, expected[i]->name) == 0);
+ SELF_CHECK (streq (item.name, expected[i]->name));
++i;
}
SELF_CHECK (&item == expected[i]);
/* Access the item, to make sure the object is still alive. */
- SELF_CHECK (strcmp (item.name, expected[i]->name) == 0);
+ SELF_CHECK (streq (item.name, expected[i]->name));
}
SELF_CHECK (i == 0);
completion_mode, true /* ignore_parameters */);
const char *result = lookup_name.language_lookup_name (lang);
- if (strcmp (result, expected) != 0)
+ if (!streq (result, expected))
{
error (_("%s:%d: make-paramless self-test failed: (completion=%d, lang=%d) "
"\"%s\" -> \"%s\", expected \"%s\""),
SELF_CHECK (m.get () != MAP_FAILED);
SELF_CHECK (m.size () == 7);
- SELF_CHECK (0 == strcmp ((char *) m.get (), "Hello!"));
+ SELF_CHECK (streq ((char *) m.get (), "Hello!"));
}
}
gdb::unique_xmalloc_ptr<char> a = make_unique_xstrdup ("abc");
gdb::unique_xmalloc_ptr<char> b = make_unique_xstrndup ("defghi", 3);
- SELF_CHECK (strcmp (a.get (), "abc") == 0);
- SELF_CHECK (strcmp (b.get (), "def") == 0);
+ SELF_CHECK (streq (a.get (), "abc"));
+ SELF_CHECK (streq (b.get (), "def"));
std::string str = "xxx";
= rl_variable_value ("horizontal-scroll-mode");
bool force_horizontal_scroll_mode
= (horizontal_scroll_mode_value != nullptr
- && strcmp (horizontal_scroll_mode_value, "on") == 0);
+ && streq (horizontal_scroll_mode_value, "on"));
const char *mode = nullptr;
const char *reason = nullptr;
size_t trail_len = strlen (trailer);
SELF_CHECK (len >= trail_len
- && strcmp (result.get () + len - trail_len, trailer) == 0);
+ && streq (result.get () + len - trail_len, trailer));
}
static void
gdb::array_view<char *> view = argv.as_array_view ();
SELF_CHECK (view.size () == 3);
- SELF_CHECK (strcmp (view[0], "une") == 0);
- SELF_CHECK (strcmp (view[1], "bonne") == 0);
- SELF_CHECK (strcmp (view[2], "50") == 0);
+ SELF_CHECK (streq (view[0], "une"));
+ SELF_CHECK (streq (view[1], "bonne"));
+ SELF_CHECK (streq (view[2], "50"));
}
}
|| t2->code () == TYPE_CODE_UNION)
&& !!"Precondition is that value is of STRUCT or UNION kind");
- if (t1->name () != NULL
- && t2->name () != NULL
- && !strcmp (t1->name (), t2->name ()))
- return NULL;
+ if (t1->name () != nullptr
+ && t2->name () != nullptr
+ && streq (t1->name (), t2->name ()))
+ return nullptr;
/* Upcasting: look in the type of the source to see if it contains the
type of the target as a superclass. If so, we'll need to
/* We might be trying to cast to the outermost enclosing
type, in which case search_struct_field won't work. */
if (real_type->name () != NULL
- && !strcmp (real_type->name (), t1->name ()))
+ && streq (real_type->name (), t1->name ()))
return v;
v = search_struct_field (t2->name (), v, real_type, 1);
probably a C-style function. */
if (temp_func != nullptr)
{
- if (strcmp (temp_func.get (), qualified_name) == 0)
+ if (streq (temp_func.get (), qualified_name))
func_name = NULL;
else
func_name = temp_func.get ();
if (len + 2 >= name_len
&& fname[len - name_len - 2] == ':'
&& fname[len - name_len - 1] == ':'
- && strcmp (&fname[len - name_len], name) == 0)
+ && streq (&fname[len - name_len], name))
return value_from_longest (type, type->field (i).loc_enumval ());
}
{
const char *t_field_name = t->field (i).name ();
- if (t_field_name && strcmp (t_field_name, name) == 0)
+ if (t_field_name && streq (t_field_name, name))
{
if (t->field (i).is_static ())
{
{
const char *t_field_name = TYPE_FN_FIELDLIST_NAME (t, i);
- if (t_field_name && strcmp (t_field_name, name) == 0)
+ if (t_field_name && streq (t_field_name, name))
{
int j;
int len = TYPE_FN_FIELDLIST_LENGTH (t, i);
= gdbpy_get_display_hint (value_formatter);
if (hint)
{
- if (!strcmp (hint.get (), "string"))
+ if (streq (hint.get (), "string"))
string_print = true;
}
if (name == nullptr)
return 0;
- if (strcmp (name, "_sigbe") != 0
- && strcmp (name, "__sigbe") != 0
- && strcmp (name, "sigdelayed") != 0
- && strcmp (name, "_sigdelayed") != 0)
+ if (!streq (name, "_sigbe")
+ && !streq (name, "__sigbe")
+ && !streq (name, "sigdelayed")
+ && !streq (name, "_sigdelayed"))
return 0;
frame_debug_printf ("name=%s, start=%s, end=%s",
{
int reg;
for (reg = lo; reg < hi; ++reg)
- if (strcmp (name, names[reg]) == 0)
+ if (streq (name, names[reg]))
return true;
return false;
return false;
/* Check the indirect return thunk first. */
- if (strcmp (name, "__x86_return_thunk") == 0)
+ if (streq (name, "__x86_return_thunk"))
return true;
/* Then check a family of indirect call/jump thunks. */
const char *first_section_name
= bfd_section_name (objfile->sections_start[0].the_bfd_section);
- if (objfile->sect_index_text == 0
- && strcmp (first_section_name, ".text") != 0)
+ if (objfile->sect_index_text == 0 && !streq (first_section_name, ".text"))
objfile->sect_index_text = -1;
- if (objfile->sect_index_data == 0
- && strcmp (first_section_name, ".data") != 0)
+ if (objfile->sect_index_data == 0 && !streq (first_section_name, ".data"))
objfile->sect_index_data = -1;
- if (objfile->sect_index_bss == 0
- && strcmp (first_section_name, ".bss") != 0)
+ if (objfile->sect_index_bss == 0 && !streq (first_section_name, ".bss"))
objfile->sect_index_bss = -1;
if (objfile->sect_index_rodata == 0
- && strcmp (first_section_name, ".rodata") != 0)
+ && !streq (first_section_name, ".rodata"))
objfile->sect_index_rodata = -1;
}
const char *name)
{
for (gdb_xml_value &value : attributes)
- if (strcmp (value.name, name) == 0)
+ if (streq (value.name, name))
return &value;
return NULL;
seen = 1;
for (element = scope.elements; element && element->name;
element++, seen <<= 1)
- if (strcmp (element->name, name) == 0)
+ if (streq (element->name, name))
break;
if (element == NULL || element->name == NULL)
void *parsed_value;
for (p = attrs; *p != NULL; p += 2)
- if (!strcmp (attribute->name, p[0]))
+ if (streq (attribute->name, p[0]))
{
val = p[1];
break;
for (attribute = element->attributes;
attribute != NULL && attribute->name != NULL;
attribute++)
- if (strcmp (attribute->name, *p) == 0)
+ if (streq (attribute->name, *p))
break;
if (attribute == NULL || attribute->name == NULL)
const char *const (*p)[2];
for (p = xml_builtin; (*p)[0]; p++)
- if (strcmp ((*p)[0], filename) == 0)
+ if (streq ((*p)[0], filename))
return (*p)[1];
return NULL;
for (const gdb_xml_value &attr : attributes)
{
- if (strcmp (attr.name, "name") == 0)
+ if (streq (attr.name, "name"))
name = (char *) attr.value.get ();
- else if (strcmp (attr.name, "number") == 0)
+ else if (streq (attr.name, "number"))
number = * (ULONGEST *) attr.value.get ();
- else if (strcmp (attr.name, "alias") == 0)
+ else if (streq (attr.name, "alias"))
alias = (char *) attr.value.get ();
- else if (strcmp (attr.name, "groups") == 0)
+ else if (streq (attr.name, "groups"))
groups = (char *) attr.value.get ();
else
internal_error (_("Unknown attribute name '%s'."), attr.name);
char *version
= (char *) xml_find_attribute (attributes, "version")->value.get ();
- if (strcmp (version, "1.0") != 0)
+ if (!streq (version, "1.0"))
gdb_xml_error (parser,
_("Target description has unsupported version \"%s\""),
version);
name = (char *) attributes[ix++].value.get ();
bitsize = * (ULONGEST *) attributes[ix++].value.get ();
- if (ix < length && strcmp (attributes[ix].name, "regnum") == 0)
+ if (ix < length && streq (attributes[ix].name, "regnum"))
regnum = * (ULONGEST *) attributes[ix++].value.get ();
else
regnum = data->next_regnum;
- if (ix < length && strcmp (attributes[ix].name, "type") == 0)
+ if (ix < length && streq (attributes[ix].name, "type"))
type = (char *) attributes[ix++].value.get ();
else
type = "int";
- if (ix < length && strcmp (attributes[ix].name, "group") == 0)
+ if (ix < length && streq (attributes[ix].name, "group"))
group = (char *) attributes[ix++].value.get ();
else
group = NULL;
- if (ix < length && strcmp (attributes[ix].name, "save-restore") == 0)
+ if (ix < length && streq (attributes[ix].name, "save-restore"))
save_restore = * (ULONGEST *) attributes[ix++].value.get ();
else
save_restore = 1;
- if (strcmp (type, "int") != 0
- && strcmp (type, "float") != 0
+ if (!streq (type, "int") && !streq (type, "float")
&& tdesc_named_type (data->current_feature, type) == NULL)
gdb_xml_error (parser, _("Register \"%s\" has unknown type \"%s\""),
name, type);
gdb_xml_error (parser,
_("Bitfields must live in explicitly sized types"));
- if (field_type_id != NULL
- && strcmp (field_type_id, "bool") == 0
+ if (field_type_id != nullptr
+ && streq (field_type_id, "bool")
&& start != end)
{
gdb_xml_error (parser,
gdb_byte buf[2 * xstormy16_inst_size];
/* Return faddr if it's not pointing into the jump table. */
- if (strcmp (faddr_sect->the_bfd_section->name, ".plt"))
+ if (!streq (faddr_sect->the_bfd_section->name, ".plt"))
return faddr;
if (!target_read_memory (faddr, buf, sizeof buf))
if (faddr_sect)
{
/* Return faddr if it's already a pointer to a jump table entry. */
- if (!strcmp (faddr_sect->the_bfd_section->name, ".plt"))
+ if (streq (faddr_sect->the_bfd_section->name, ".plt"))
return faddr;
for (obj_section &osect : faddr_sect->objfile->sections ())
{
- if (!strcmp (osect.the_bfd_section->name, ".plt"))
+ if (streq (osect.the_bfd_section->name, ".plt"))
{
CORE_ADDR addr, endaddr;
remote_open (const char *name)
{
#ifndef USE_WIN32API
- if (strcmp (name, "-") == 0)
+ if (streq (name, "-"))
{
remote_desc_in = 0;
remote_desc_out = 1;
const char *name)
{
for (const gdb::reg ® : tdesc->reg_defs)
- if (strcmp (name, reg.name) == 0)
+ if (streq (name, reg.name))
return true;
return false;
}
struct target_loadmap *data = NULL;
unsigned int actual_length, copy_length;
- if (strcmp (annex, "exec") == 0)
+ if (streq (annex, "exec"))
addr = (int) LINUX_LOADMAP_EXEC;
- else if (strcmp (annex, "interp") == 0)
+ else if (streq (annex, "interp"))
addr = (int) LINUX_LOADMAP_INTERP;
else
return -1;
p != NULL;
p = strtok_r (NULL, ",", &saveptr))
{
- if (strcmp (p, "i386") == 0)
+ if (streq (p, "i386"))
{
use_xml = 1;
break;
However, init_target_desc requires us to override the already set
value. That's fine, out new string should match the old one. */
gdb_assert (tdesc_osabi_name (tdesc) != nullptr);
- gdb_assert (strcmp (tdesc_osabi_name (tdesc),
- gdbarch_osabi_name (osabi)) == 0);
+ gdb_assert (streq (tdesc_osabi_name (tdesc), gdbarch_osabi_name (osabi)));
#endif /* ! IN_PROCESS_AGENT */
#ifdef __x86_64__
{
for (int i = 0; i < tdesc->reg_defs.size (); ++i)
{
- if (strcmp (name, find_register_by_number (tdesc, i).name) == 0)
+ if (streq (name, find_register_by_number (tdesc, i).name))
return i;
}
return {};
socklen_t tmp;
remote_is_stdio = 0;
- if (strcmp (name, STDIO_CONNECTION_NAME) == 0)
+ if (streq (name, STDIO_CONNECTION_NAME))
{
/* We need to record fact that we're using stdio sooner than the
call to remote_open so start_inferior knows the connection is
error ("Only HOST:PORT is supported on this platform.");
#endif
- if (strcmp (name, STDIO_CONNECTION_NAME) == 0)
+ if (streq (name, STDIO_CONNECTION_NAME))
{
fprintf (stderr, "Remote debugging using stdio\n");
/* Check the cache first. */
for (sym = proc->symbol_cache; sym; sym = sym->next)
- if (strcmp (name, sym->name) == 0)
+ if (streq (name, sym->name))
{
*addrp = sym->addr;
return 1;
try
{
- if (strcmp (op, "bts") == 0)
+ if (streq (op, "bts"))
handle_btrace_enable_bts (thread);
- else if (strcmp (op, "pt") == 0)
+ else if (streq (op, "pt"))
handle_btrace_enable_pt (thread);
- else if (strcmp (op, "off") == 0)
+ else if (streq (op, "off"))
handle_btrace_disable (thread);
else
error (_("Bad Qbtrace operation. Use bts, pt, or off."));
return;
}
- if (strcmp (p, "0") == 0)
+ if (streq (p, "0"))
enabled = 0;
else if (p[0] == '1' && (p[1] == ';' || p[1] == '\0'))
enabled = 1;
return;
}
- if (strcmp (own_buf, "QEnvironmentReset") == 0)
+ if (streq (own_buf, "QEnvironmentReset"))
{
our_environ = gdb_environ::from_host_environ ();
return;
}
- if (strcmp (own_buf, "QStartNoAckMode") == 0)
+ if (streq (own_buf, "QStartNoAckMode"))
{
remote_debug_printf ("[noack mode enabled]");
int req = -1;
const char *req_str;
- if (strcmp (mode, "0") == 0)
+ if (streq (mode, "0"))
req = 0;
- else if (strcmp (mode, "1") == 0)
+ else if (streq (mode, "1"))
req = 1;
else
{
char *mode = own_buf + strlen ("QAgent:");
int req = 0;
- if (strcmp (mode, "0") == 0)
+ if (streq (mode, "0"))
req = 0;
- else if (strcmp (mode, "1") == 0)
+ else if (streq (mode, "1"))
req = 1;
else
{
char *mode = own_buf + strlen ("QThreadEvents:");
enum tribool req = TRIBOOL_UNKNOWN;
- if (strcmp (mode, "0") == 0)
+ if (streq (mode, "0"))
req = TRIBOOL_FALSE;
- else if (strcmp (mode, "1") == 0)
+ else if (streq (mode, "1"))
req = TRIBOOL_TRUE;
else
{
{
const char *value = own_buf + strlen ("QStartupWithShell:");
- if (strcmp (value, "1") == 0)
+ if (streq (value, "1"))
startup_with_shell = true;
- else if (strcmp (value, "0") == 0)
+ else if (streq (value, "0"))
startup_with_shell = false;
else
{
This variable is set up from the auto-generated
init_registers_... routine for the current target. */
- if (strcmp (annex, "target.xml") == 0)
+ if (streq (annex, "target.xml"))
{
const char *ret = tdesc_get_features_xml (desc);
/* Look for the annex. */
for (i = 0; xml_builtin[i][0] != NULL; i++)
- if (strcmp (annex, xml_builtin[i][0]) == 0)
+ if (streq (annex, xml_builtin[i][0]))
break;
if (xml_builtin[i][0] != NULL)
for (const gdb::unique_xmalloc_ptr<char> &option : options)
{
- if (strcmp (option.get (), "all") == 0)
+ if (streq (option.get (), "all"))
{
debug_timestamp = 1;
if (is_monitor)
monitor_output ("All extra debug format options enabled.\n");
}
- else if (strcmp (option.get (), "none") == 0)
+ else if (streq (option.get (), "none"))
{
debug_timestamp = 0;
if (is_monitor)
monitor_output ("All extra debug format options disabled.\n");
}
- else if (strcmp (option.get (), "timestamp") == 0)
+ else if (streq (option.get (), "timestamp"))
{
debug_timestamp = 1;
if (is_monitor)
write_enn (own_buf);
}
}
- else if (strcmp (mon, "set debug-hw-points 1") == 0)
+ else if (streq (mon, "set debug-hw-points 1"))
{
show_debug_regs = 1;
monitor_output ("H/W point debugging output enabled.\n");
}
- else if (strcmp (mon, "set debug-hw-points 0") == 0)
+ else if (streq (mon, "set debug-hw-points 0"))
{
show_debug_regs = 0;
monitor_output ("H/W point debugging output disabled.\n");
write_enn (own_buf);
}
}
- else if (strcmp (mon, "set debug-file") == 0)
+ else if (streq (mon, "set debug-file"))
debug_set_output (nullptr);
else if (startswith (mon, "set debug-file "))
debug_set_output (mon + sizeof ("set debug-file ") - 1);
- else if (strcmp (mon, "help") == 0)
+ else if (streq (mon, "help"))
monitor_show_help ();
- else if (strcmp (mon, "exit") == 0)
+ else if (streq (mon, "exit"))
exit_requested = true;
else
{
return -3;
}
- if (strcmp (annex, "all") == 0)
+ if (streq (annex, "all"))
type = BTRACE_READ_ALL;
- else if (strcmp (annex, "new") == 0)
+ else if (streq (annex, "new"))
type = BTRACE_READ_NEW;
- else if (strcmp (annex, "delta") == 0)
+ else if (streq (annex, "delta"))
type = BTRACE_READ_DELTA;
else
{
{
const struct qxfer *q = &qxfer_packets[i];
- if (strcmp (object, q->object) == 0)
+ if (streq (object, q->object))
{
- if (strcmp (rw, "read") == 0)
+ if (streq (rw, "read"))
{
unsigned char *data;
int n;
free (data);
return 1;
}
- else if (strcmp (rw, "write") == 0)
+ else if (streq (rw, "write"))
{
int n;
unsigned int len;
};
/* Reply the current thread id. */
- if (strcmp ("qC", own_buf) == 0 && !disable_packet_qC)
+ if (streq ("qC", own_buf) && !disable_packet_qC)
{
ptid_t ptid;
require_running_or_return (own_buf);
return;
}
- if (strcmp ("qSymbol::", own_buf) == 0)
+ if (streq ("qSymbol::", own_buf))
{
scoped_restore_current_thread restore_thread;
if (!disable_packet_qfThreadInfo)
{
- if (strcmp ("qfThreadInfo", own_buf) == 0)
+ if (streq ("qfThreadInfo", own_buf))
{
require_running_or_return (own_buf);
init_thread_iter ();
return;
}
- if (strcmp ("qsThreadInfo", own_buf) == 0)
+ if (streq ("qsThreadInfo", own_buf))
{
require_running_or_return (own_buf);
/* We're done if the process iterator hits the end of the
}
}
- if (the_target->supports_read_offsets ()
- && strcmp ("qOffsets", own_buf) == 0)
+ if (the_target->supports_read_offsets () && streq ("qOffsets", own_buf))
{
CORE_ADDR text, data;
return;
}
- if (strcmp (own_buf, "qAttached") == 0
- || startswith (own_buf, "qAttached:"))
+ if (streq (own_buf, "qAttached") || startswith (own_buf, "qAttached:"))
{
struct process_info *process;
return;
}
- if (strcmp ("qExecAndArgs", own_buf) == 0)
+ if (streq ("qExecAndArgs", own_buf))
{
if (program_path.get () == nullptr)
sprintf (own_buf, "U");
client_state &cs = get_client_state ();
if (!disable_packet_vCont)
{
- if (strcmp (own_buf, "vCtrlC") == 0)
+ if (streq (own_buf, "vCtrlC"))
{
the_target->request_interrupt ();
write_ok (own_buf);
expected = "m0001020304";
SELF_CHECK (create_fetch_memtags_reply (packet.data (), bv) == true);
- SELF_CHECK (strcmp (packet.data (), expected.c_str ()) == 0);
+ SELF_CHECK (streq (packet.data (), expected.c_str ()));
/* Test parsing a QMemTags request. */
gdb_assert (optarg != nullptr);
if (optarg == nullptr
- || strcmp (optarg, "-") == 0
- || strcmp (optarg, STDIO_CONNECTION_NAME) == 0
+ || streq (optarg, "-")
+ || streq (optarg, STDIO_CONNECTION_NAME)
|| startswith (optarg, "--")
|| strchr (optarg, ':') != nullptr)
{
{
int original_optind = optind;
- while (argv[optind] != nullptr
- && strcmp (argv[optind], "--") != 0)
+ while (argv[optind] != nullptr && !streq (argv[optind], "--"))
{
wrapper_argv += argv[optind];
wrapper_argv += ' ';
tok != nullptr;
tok = strtok_r (nullptr, ",", &saveptr))
{
- if (strcmp ("vCont", tok) == 0)
+ if (streq ("vCont", tok))
disable_packet_vCont = true;
- else if (strcmp ("vConts", tok) == 0)
+ else if (streq ("vConts", tok))
disable_packet_vCont_step = true;
- else if (strcmp ("Tthread", tok) == 0)
+ else if (streq ("Tthread", tok))
disable_packet_Tthread = true;
- else if (strcmp ("qC", tok) == 0)
+ else if (streq ("qC", tok))
disable_packet_qC = true;
- else if (strcmp ("qfThreadInfo", tok) == 0)
+ else if (streq ("qfThreadInfo", tok))
disable_packet_qfThreadInfo = true;
- else if (strcmp ("T", tok) == 0)
+ else if (streq ("T", tok))
disable_packet_T = true;
- else if (strcmp ("threads", tok) == 0)
+ else if (streq ("threads", tok))
{
disable_packet_vCont = true;
disable_packet_Tthread = true;
const char *port = argv[optind];
++optind;
- if (port != nullptr && strcmp (port, "-") == 0)
+ if (port != nullptr && streq (port, "-"))
{
port = STDIO_CONNECTION_NAME;
/* --attach used to come after PORT, so allow it there for
compatibility. */
- if (*next_arg != NULL && strcmp (*next_arg, "--attach") == 0)
+ if (*next_arg != NULL && streq (*next_arg, "--attach"))
{
attach = true;
next_arg++;
where libpthread lives. We *could* fetch the info, but we don't
do that yet. Ignore it. */
}
- else if (strcmp (this_dir, "$sdir") == 0)
+ else if (streq (this_dir, "$sdir"))
{
if (try_thread_db_load_from_sdir ())
{
if (tpoint->type == trap_tracepoint || tp == NULL)
{
install_tracepoint (tpoint, own_buf);
- if (strcmp (own_buf, "OK") != 0)
+ if (!streq (own_buf, "OK"))
remove_tracepoint (tpoint);
}
else
/* Only make tsv's be undefined before the first trace run. After a
trace run is over, the user might want to see the last value of
the tsv, and it might not be available in a traceframe. */
- else if (!tracing && strcmp (tracing_stop_reason, "tnotrun") == 0)
+ else if (!tracing && streq (tracing_stop_reason, "tnotrun"))
{
strcpy (own_buf, "U");
return;
}
/* If this was a forced stop, include any stop note that was supplied. */
- if (strcmp (stop_reason_rsp, "tstop") == 0)
+ if (streq (stop_reason_rsp, "tstop"))
{
stop_reason_rsp = (char *) alloca (strlen ("tstop:") + strlen (buf3) + 1);
strcpy (stop_reason_rsp, "tstop:");
packet += strlen ("QTBuffer:size:");
/* -1 is sent as literal "-1". */
- if (strcmp (packet, "-1") == 0)
+ if (streq (packet, "-1"))
sval = DEFAULT_TRACE_BUFFER_SIZE;
else
{
int
handle_tracepoint_general_set (char *packet)
{
- if (strcmp ("QTinit", packet) == 0)
+ if (streq ("QTinit", packet))
{
cmd_qtinit (packet);
return 1;
cmd_qtro (packet);
return 1;
}
- else if (strcmp ("QTStart", packet) == 0)
+ else if (streq ("QTStart", packet))
{
cmd_qtstart (packet);
return 1;
}
- else if (strcmp ("QTStop", packet) == 0)
+ else if (streq ("QTStop", packet))
{
cmd_qtstop (packet);
return 1;
int
handle_tracepoint_query (char *packet)
{
- if (strcmp ("qTStatus", packet) == 0)
+ if (streq ("qTStatus", packet))
{
cmd_qtstatus (packet);
return 1;
cmd_qtp (packet);
return 1;
}
- else if (strcmp ("qTfP", packet) == 0)
+ else if (streq ("qTfP", packet))
{
cmd_qtfp (packet);
return 1;
}
- else if (strcmp ("qTsP", packet) == 0)
+ else if (streq ("qTsP", packet))
{
cmd_qtsp (packet);
return 1;
}
- else if (strcmp ("qTfV", packet) == 0)
+ else if (streq ("qTfV", packet))
{
cmd_qtfv (packet);
return 1;
}
- else if (strcmp ("qTsV", packet) == 0)
+ else if (streq ("qTsV", packet))
{
cmd_qtsv (packet);
return 1;
cmd_qtbuffer (packet);
return 1;
}
- else if (strcmp ("qTMinFTPILen", packet) == 0)
+ else if (streq ("qTMinFTPILen", packet))
{
cmd_qtminftpilen (packet);
return 1;
return (reason == other.reason
&& error == other.error
- && strcmp (msg1, msg2) == 0);
+ && streq (msg1, msg2));
}
/* Compare two exceptions. */
int i;
for (i = 0; i < ARRAY_SIZE (gdb_osabi_names); i++)
- if (strcmp (name, gdb_osabi_names[i].pretty) == 0)
+ if (streq (name, gdb_osabi_names[i].pretty))
{
/* See note above: the name table matches the indices assigned
to enum gdb_osabi. */
for (sig = GDB_SIGNAL_HUP;
sig < GDB_SIGNAL_LAST;
sig = (enum gdb_signal) ((int) sig + 1))
- if (signals[sig].name != NULL
- && strcmp (name, signals[sig].name) == 0)
+ if (signals[sig].name != nullptr && streq (name, signals[sig].name))
return sig;
return GDB_SIGNAL_UNKNOWN;
}