GDB (API)
Defines | Functions | Variables
/home/stan/gdb/src/gdb/utils.c File Reference
#include "defs.h"
#include "dyn-string.h"
#include "gdb_assert.h"
#include <ctype.h>
#include "gdb_string.h"
#include "gdb_wait.h"
#include "event-top.h"
#include "exceptions.h"
#include "gdbthread.h"
#include "fnmatch.h"
#include "gdb_bfd.h"
#include <signal.h>
#include "timeval-utils.h"
#include "gdbcmd.h"
#include "serial.h"
#include "bfd.h"
#include "target.h"
#include "gdb-demangle.h"
#include "expression.h"
#include "language.h"
#include "charset.h"
#include "annotate.h"
#include "filenames.h"
#include "symfile.h"
#include "gdb_obstack.h"
#include "gdbcore.h"
#include "top.h"
#include "main.h"
#include "solist.h"
#include "inferior.h"
#include "gdb_curses.h"
#include "readline/readline.h"
#include <sys/time.h>
#include <time.h>
#include "gdb_usleep.h"
#include "interps.h"
#include "gdb_regex.h"

Go to the source code of this file.

Defines

#define NUMCELLS   16
#define CELLSIZE   50
#define HIGH_BYTE_POSN   ((sizeof (ULONGEST) - 1) * HOST_CHAR_BIT)
#define AMBIGUOUS_MESS1   ".\nMatching formats:"
#define AMBIGUOUS_MESS2   ".\nUse \"set gnutarget format-name\" to specify the format."

Functions

PTR malloc ()
PTR realloc ()
void free ()
void set_quit_flag (void)
int check_quit_flag (void)
struct cleanup * make_cleanup_freeargv (char **arg)
struct cleanup * make_cleanup_dyn_string_delete (dyn_string_t arg)
struct cleanup * make_cleanup_bfd_unref (bfd *abfd)
struct cleanup * make_cleanup_close (int fd)
struct cleanup * make_cleanup_fclose (FILE *file)
struct cleanup * make_cleanup_obstack_free (struct obstack *obstack)
struct cleanup * make_cleanup_ui_file_delete (struct ui_file *arg)
struct cleanup * make_cleanup_ui_out_redirect_pop (struct ui_out *uiout)
struct cleanup * make_cleanup_free_section_addr_info (struct section_addr_info *addrs)
struct cleanup * make_cleanup_restore_integer (int *variable)
struct cleanup * make_cleanup_restore_uinteger (unsigned int *variable)
struct cleanup * make_cleanup_unpush_target (struct target_ops *ops)
struct cleanup * make_cleanup_htab_delete (htab_t htab)
struct cleanup * make_cleanup_restore_ui_file (struct ui_file **variable)
struct cleanup * make_cleanup_value_free_to_mark (struct value *mark)
struct cleanup * make_cleanup_value_free (struct value *value)
struct cleanup * make_cleanup_free_so (struct so_list *so)
struct cleanup * make_cleanup_restore_current_language (void)
void free_current_contents (void *ptr)
void vwarning (const char *string, va_list args)
void warning (const char *string,...)
void verror (const char *string, va_list args)
void error (const char *string,...)
void vfatal (const char *string, va_list args)
void fatal (const char *string,...)
void error_stream (struct ui_file *stream)
void internal_verror (const char *file, int line, const char *fmt, va_list ap)
void internal_error (const char *file, int line, const char *string,...)
void internal_vwarning (const char *file, int line, const char *fmt, va_list ap)
void internal_warning (const char *file, int line, const char *string,...)
void throw_perror_with_name (enum errors errcode, const char *string)
void perror_with_name (const char *string)
void perror_warning_with_name (const char *string)
void print_sys_errmsg (const char *string, int errcode)
void quit (void)
void malloc_failure (long size)
int myread (int desc, char *addr, int len)
void print_spaces (int n, struct ui_file *file)
void gdb_print_host_address (const void *addr, struct ui_file *stream)
struct cleanup * make_regfree_cleanup (regex_t *r)
char * get_regcomp_error (int code, regex_t *rx)
struct cleanup * compile_rx_or_error (regex_t *pattern, const char *rx, const char *message)
int nquery (const char *ctlstr,...)
int yquery (const char *ctlstr,...)
int query (const char *ctlstr,...)
int parse_escape (struct gdbarch *gdbarch, const char **string_ptr)
void fputstr_filtered (const char *str, int quoter, struct ui_file *stream)
void fputstr_unfiltered (const char *str, int quoter, struct ui_file *stream)
void fputstrn_filtered (const char *str, int n, int quoter, struct ui_file *stream)
void fputstrn_unfiltered (const char *str, int n, int quoter, struct ui_file *stream)
void init_page_info (void)
struct cleanup * make_cleanup_restore_page_info (void)
struct cleanup * set_batch_flag_and_make_cleanup_restore_page_info (void)
void reset_prompt_for_continue_wait_time (void)
struct timeval get_prompt_for_continue_wait_time (void)
void reinitialize_more_filter (void)
void wrap_here (char *indent)
void puts_filtered_tabular (char *string, int width, int right)
void begin_line (void)
void fputs_filtered (const char *linebuffer, struct ui_file *stream)
int putchar_unfiltered (int c)
int putchar_filtered (int c)
int fputc_unfiltered (int c, struct ui_file *stream)
int fputc_filtered (int c, struct ui_file *stream)
void puts_debug (char *prefix, char *string, char *suffix)
void vfprintf_filtered (struct ui_file *stream, const char *format, va_list args)
void vfprintf_unfiltered (struct ui_file *stream, const char *format, va_list args)
void vprintf_filtered (const char *format, va_list args)
void vprintf_unfiltered (const char *format, va_list args)
void fprintf_filtered (struct ui_file *stream, const char *format,...)
void fprintf_unfiltered (struct ui_file *stream, const char *format,...)
void fprintfi_filtered (int spaces, struct ui_file *stream, const char *format,...)
void printf_filtered (const char *format,...)
void printf_unfiltered (const char *format,...)
void printfi_filtered (int spaces, const char *format,...)
void puts_filtered (const char *string)
void puts_unfiltered (const char *string)
char * n_spaces (int n)
void print_spaces_filtered (int n, struct ui_file *stream)
void fprintf_symbol_filtered (struct ui_file *stream, const char *name, enum language lang, int arg_mode)
int strcmp_iw (const char *string1, const char *string2)
int strcmp_iw_ordered (const char *string1, const char *string2)
int streq (const char *lhs, const char *rhs)
int subset_compare (char *string_to_compare, char *template_string)
void initialize_utils (void)
const char * paddress (struct gdbarch *gdbarch, CORE_ADDR addr)
const char * print_core_address (struct gdbarch *gdbarch, CORE_ADDR address)
hashval_t core_addr_hash (const void *ap)
int core_addr_eq (const void *ap, const void *bp)
char * pulongest (ULONGEST u)
char * plongest (LONGEST l)
char * phex (ULONGEST l, int sizeof_l)
char * phex_nz (ULONGEST l, int sizeof_l)
char * hex_string (LONGEST num)
char * hex_string_custom (LONGEST num, int width)
char * int_string (LONGEST val, int radix, int is_signed, int width, int use_c_format)
const char * core_addr_to_string (const CORE_ADDR addr)
const char * core_addr_to_string_nz (const CORE_ADDR addr)
CORE_ADDR string_to_core_addr (const char *my_string)
const char * host_address_to_string (const void *addr)
char * gdb_realpath (const char *filename)
ULONGEST align_up (ULONGEST v, int n)
ULONGEST align_down (ULONGEST v, int n)
LONGEST gdb_sign_extend (LONGEST value, int bit)
void * hashtab_obstack_allocate (void *data, size_t size, size_t count)
void dummy_obstack_deallocate (void *object, void *data)
ULONGEST strtoulst (const char *num, const char **trailer, int base)
char * ldirname (const char *filename)
char ** gdb_buildargv (const char *s)
int compare_positive_ints (const void *ap, const void *bp)
int compare_strings (const void *arg1, const void *arg2)
const char * gdb_bfd_errmsg (bfd_error_type error_tag, char **matching)
int parse_pid_to_attach (char *args)
struct cleanup * make_bpstat_clear_actions_cleanup (void)
int producer_is_gcc_ge_4 (const char *producer)
struct cleanup * make_cleanup_free_char_ptr_vec (VEC(char_ptr)*char_ptr_vec)
void substitute_path_component (char **stringp, const char *from, const char *to)
int gdb_filename_fnmatch (const char *pattern, const char *string, int flags)
void _initialize_utils (void)

Variables

void(* deprecated_error_begin_hook )(void)
int sevenbit_strings = 0
char * warning_pre_print = "\nwarning: "
int pagination_enabled = 1
const char internal_problem_ask [] = "ask"
const char internal_problem_yes [] = "yes"
const char internal_problem_no [] = "no"
initialize_file_ftype _initialize_utils

Define Documentation

#define AMBIGUOUS_MESS1   ".\nMatching formats:"

Definition at line 3368 of file utils.c.

#define AMBIGUOUS_MESS2   ".\nUse \"set gnutarget format-name\" to specify the format."

Definition at line 3369 of file utils.c.

#define CELLSIZE   50

Definition at line 2686 of file utils.c.

#define HIGH_BYTE_POSN   ((sizeof (ULONGEST) - 1) * HOST_CHAR_BIT)

Definition at line 3215 of file utils.c.

#define NUMCELLS   16

Definition at line 2685 of file utils.c.


Function Documentation

void _initialize_utils ( void  )

Definition at line 3674 of file utils.c.

ULONGEST align_down ( ULONGEST  v,
int  n 
)

Definition at line 3164 of file utils.c.

ULONGEST align_up ( ULONGEST  v,
int  n 
)

Definition at line 3156 of file utils.c.

void begin_line ( void  )

Definition at line 1979 of file utils.c.

int check_quit_flag ( void  )

Definition at line 160 of file utils.c.

int compare_positive_ints ( const void *  ap,
const void *  bp 
)

Integer compare function suitable for qsort.

Definition at line 3350 of file utils.c.

int compare_strings ( const void *  ap,
const void *  bp 
)

String compare function suitable for qsort.

Definition at line 3360 of file utils.c.

struct cleanup* compile_rx_or_error ( regex_t *  pattern,
const char *  rx,
const char *  message 
) [read]

Definition at line 1147 of file utils.c.

int core_addr_eq ( const void *  ap,
const void *  bp 
)

Definition at line 2749 of file utils.c.

hashval_t core_addr_hash ( const void *  ap)

Definition at line 2739 of file utils.c.

Convert a CORE_ADDR into a hex string with leading zeros, and prefixed with "0x" as in C syntax. The output from core_addr_to_string() can be passed direct to string_to_core_addr().

Definition at line 3002 of file utils.c.

Convert a CORE_ADDR into a hex string, withOUT leading zeros, and prefixed with "0x" as in C syntax. The output from core_addr_to_string() can be passed direct to string_to_core_addr().

Definition at line 3012 of file utils.c.

void dummy_obstack_deallocate ( void *  object,
void *  data 
)

Definition at line 3207 of file utils.c.

void error ( const char *  string,
  ... 
)

Definition at line 585 of file utils.c.

void error_stream ( struct ui_file *  stream)

Definition at line 615 of file utils.c.

void fatal ( const char *  string,
  ... 
)

Definition at line 605 of file utils.c.

void fprintf_filtered ( struct ui_file *  stream,
const char *  format,
  ... 
)

Definition at line 2314 of file utils.c.

void fprintf_symbol_filtered ( struct ui_file *  stream,
const char *  name,
enum language  lang,
int  arg_mode 
)

Definition at line 2440 of file utils.c.

void fprintf_unfiltered ( struct ui_file *  stream,
const char *  format,
  ... 
)

Definition at line 2324 of file utils.c.

void fprintfi_filtered ( int  spaces,
struct ui_file *  stream,
const char *  format,
  ... 
)

Definition at line 2337 of file utils.c.

int fputc_filtered ( int  c,
struct ui_file *   
)

Write a single char to output.

Definition at line 2141 of file utils.c.

int fputc_unfiltered ( int  c,
struct ui_file *   
)

Write a single char to output, unfiltered.

Definition at line 2132 of file utils.c.

void fputs_filtered ( const char *  ,
struct ui_file *   
)

Write a string to output, controlled by pagination.

Definition at line 2108 of file utils.c.

void fputstr_filtered ( const char *  str,
int  quoter,
struct ui_file *  stream 
)

Definition at line 1555 of file utils.c.

void fputstr_unfiltered ( const char *  str,
int  quoter,
struct ui_file *  stream 
)

Definition at line 1562 of file utils.c.

void fputstrn_filtered ( const char *  str,
int  n,
int  quoter,
struct ui_file *  stream 
)

Definition at line 1569 of file utils.c.

void fputstrn_unfiltered ( const char *  str,
int  n,
int  quoter,
struct ui_file *  stream 
)

Definition at line 1579 of file utils.c.

void free ( )
void free_current_contents ( void *  ptr)

Definition at line 524 of file utils.c.

const char* gdb_bfd_errmsg ( bfd_error_type  error_tag,
char **  matching 
)

A wrapper for bfd_errmsg to produce a more helpful error message in the case of bfd_error_file_ambiguously recognized.

Parameters:
error_tag
matchingif non-NULL, is the corresponding argument to bfd_check_format_matches, and will be freed.

Definition at line 3373 of file utils.c.

char** gdb_buildargv ( const char *  s)

Call libiberty's buildargv, and return the result. If buildargv fails due to out-of-memory, call nomem. Therefore, the returned value is guaranteed to be non-NULL, unless the parameter itself is NULL.

Definition at line 3338 of file utils.c.

int gdb_filename_fnmatch ( const char *  pattern,
const char *  string,
int  flags 
)

Definition at line 3634 of file utils.c.

void gdb_print_host_address ( const void *  addr,
struct ui_file *  stream 
)

Display the host ADDR on STREAM formatted as ``0xx''.

Definition at line 1107 of file utils.c.

char* gdb_realpath ( const char *  filename)

Get the canonicalized absolute pathname for the given filename, returning the result in freshly-allocated memory. This is basically just a host-independent wrapper for realpath().

Parameters:
filenamethe filename to get a path for

Definition at line 3069 of file utils.c.

LONGEST gdb_sign_extend ( LONGEST  value,
int  bit 
)

Definition at line 3174 of file utils.c.

struct timeval get_prompt_for_continue_wait_time ( void  ) [read]

Definition at line 1864 of file utils.c.

char* get_regcomp_error ( int  code,
regex_t *  rx 
)

Definition at line 1133 of file utils.c.

void* hashtab_obstack_allocate ( void *  data,
size_t  size,
size_t  count 
)

Definition at line 3192 of file utils.c.

char* hex_string ( LONGEST  )

Return a string that contains a number formatted as a hex string.

Definition at line 2929 of file utils.c.

char* hex_string_custom ( LONGEST  num,
int  width 
)

Definition at line 2942 of file utils.c.

const char* host_address_to_string ( const void *  addr)

Definition at line 3060 of file utils.c.

void init_page_info ( void  )

Definition at line 1643 of file utils.c.

void initialize_utils ( void  )

Definition at line 2623 of file utils.c.

char* int_string ( LONGEST  val,
int  radix,
int  is_signed,
int  width,
int  use_c_format 
)

Convert VAL to a numeral in the given radix. For radix 10, IS_SIGNED may be true, indicating a signed quantity; otherwise VAL is interpreted as unsigned. If WIDTH is supplied, it is the minimum width (0-padded if needed). USE_C_FORMAT means to use C format in all cases. If it is false, then 'x' and 'o' formats do not include a prefix (0x or leading 0).

Definition at line 2962 of file utils.c.

void internal_error ( const char *  file,
int  line,
const char *  string,
  ... 
)

Definition at line 824 of file utils.c.

void internal_verror ( const char *  file,
int  line,
const char *  fmt,
va_list  ap 
)

Definition at line 817 of file utils.c.

void internal_vwarning ( const char *  file,
int  line,
const char *  fmt,
va_list  ap 
)

Definition at line 838 of file utils.c.

void internal_warning ( const char *  file,
int  line,
const char *  string,
  ... 
)

Definition at line 844 of file utils.c.

char* ldirname ( const char *  filename)

Definition at line 3313 of file utils.c.

struct cleanup* make_bpstat_clear_actions_cleanup ( void  ) [read]

Definition at line 3441 of file utils.c.

struct cleanup* make_cleanup_bfd_unref ( bfd *  abfd) [read]

Definition at line 238 of file utils.c.

struct cleanup* make_cleanup_close ( int  fd) [read]

Definition at line 252 of file utils.c.

struct cleanup* make_cleanup_dyn_string_delete ( dyn_string_t  arg) [read]

Definition at line 226 of file utils.c.

struct cleanup* make_cleanup_fclose ( FILE *  file) [read]

Definition at line 273 of file utils.c.

struct cleanup* make_cleanup_free_char_ptr_vec ( VEC(char_ptr)*  char_ptr_vec) [read]

Definition at line 3506 of file utils.c.

struct cleanup* make_cleanup_free_section_addr_info ( struct section_addr_info addrs) [read]

Definition at line 335 of file utils.c.

struct cleanup* make_cleanup_free_so ( struct so_list so) [read]

Definition at line 488 of file utils.c.

struct cleanup* make_cleanup_freeargv ( char **  arg) [read]

Definition at line 214 of file utils.c.

struct cleanup* make_cleanup_htab_delete ( htab_t  htab) [read]

Definition at line 409 of file utils.c.

struct cleanup* make_cleanup_obstack_free ( struct obstack *  obstack) [read]

Definition at line 291 of file utils.c.

struct cleanup* make_cleanup_restore_current_language ( void  ) [read]

Definition at line 507 of file utils.c.

struct cleanup* make_cleanup_restore_integer ( int variable) [read]

Definition at line 358 of file utils.c.

struct cleanup* make_cleanup_restore_page_info ( void  ) [read]

Definition at line 1706 of file utils.c.

struct cleanup* make_cleanup_restore_ui_file ( struct ui_file **  variable) [read]

Definition at line 432 of file utils.c.

struct cleanup* make_cleanup_restore_uinteger ( unsigned int variable) [read]

Definition at line 373 of file utils.c.

struct cleanup* make_cleanup_ui_file_delete ( struct ui_file *  arg) [read]

Definition at line 303 of file utils.c.

struct cleanup* make_cleanup_ui_out_redirect_pop ( struct ui_out *  uiout) [read]

Definition at line 323 of file utils.c.

struct cleanup* make_cleanup_unpush_target ( struct target_ops ops) [read]

Definition at line 391 of file utils.c.

struct cleanup* make_cleanup_value_free ( struct value *  value) [read]

Definition at line 470 of file utils.c.

struct cleanup* make_cleanup_value_free_to_mark ( struct value *  mark) [read]

Definition at line 454 of file utils.c.

struct cleanup* make_regfree_cleanup ( regex_t *  r) [read]

Definition at line 1124 of file utils.c.

PTR malloc ( )
void malloc_failure ( long  size)

Definition at line 1062 of file utils.c.

int myread ( int  desc,
char *  addr,
int  len 
)

Definition at line 1080 of file utils.c.

char* n_spaces ( int  n)

Definition at line 2405 of file utils.c.

int nquery ( const char *  ctlstr,
  ... 
)

Definition at line 1346 of file utils.c.

const char* paddress ( struct gdbarch *  gdbarch,
CORE_ADDR  addr 
)

Convert CORE_ADDR to string in platform-specific manner. This is usually formatted similar to 0xlx.

Definition at line 2699 of file utils.c.

int parse_escape ( struct gdbarch *  ,
const char **   
)

Parse a C escape sequence. STRING_PTR points to a variable containing a pointer to the string to parse. That pointer should point to the character after the \. That pointer is updated past the characters we use. The value of the escape sequence is returned.

A negative value means the sequence \ newline was seen, which is supposed to be equivalent to nothing at all.

If \ is followed by a null character, we return a negative value and leave the string pointer pointing at the null character.

If \ is followed by 000, we return 0 and leave the string pointer after the zeros. A value of 0 does not mean end of string.

Definition at line 1423 of file utils.c.

int parse_pid_to_attach ( char *  args)

Return ARGS parsed as a valid pid, or throw an error.

Definition at line 3412 of file utils.c.

void perror_warning_with_name ( const char *  string)

Definition at line 1007 of file utils.c.

void perror_with_name ( const char *  string)

Definition at line 998 of file utils.c.

char* phex ( ULONGEST  l,
int  sizeof_l 
)

Print a ULONGEST in %0x format (hex with leading zeros).

Parameters:
lthe unsigned integer to print
sizeof_lsize of integer to print; values of 2, 4, and 8 force sizes of the respective numbers of bytes, any other value will use sizeof(l)
Returns:
a string of hexadecimal digits, from static allocation

Definition at line 2862 of file utils.c.

char* phex_nz ( ULONGEST  l,
int  sizeof_l 
)

Print a ULONGEST in x format (hex, and NO leading zeros).

Parameters:
lthe unsigned integer to print
sizeof_lsize of integer to print; values of 2, 4, and 8 force sizes of the respective numbers of bytes, any other value will use sizeof(l)
Returns:
a string of hexadecimal digits, from static allocation

Definition at line 2891 of file utils.c.

char* plongest ( LONGEST  l)

Print a LONGEST in d format.

Parameters:
lthe (signed) integer to print
Returns:
a string of decimal digits

Definition at line 2850 of file utils.c.

const char* print_core_address ( struct gdbarch *  gdbarch,
CORE_ADDR  address 
)

Return a string representation in hexadecimal notation of ADDRESS, which is suitable for printing.

Definition at line 2720 of file utils.c.

void print_spaces ( int  n,
struct ui_file *  file 
)

Definition at line 1099 of file utils.c.

void print_spaces_filtered ( int  n,
struct ui_file *  stream 
)

Definition at line 2427 of file utils.c.

void print_sys_errmsg ( const char *  string,
int  errcode 
)

Definition at line 1020 of file utils.c.

void printf_filtered ( const char *  format,
  ... 
)

Definition at line 2351 of file utils.c.

void printf_unfiltered ( const char *  format,
  ... 
)

Definition at line 2362 of file utils.c.

void printfi_filtered ( int  spaces,
const char *  format,
  ... 
)

Definition at line 2375 of file utils.c.

int producer_is_gcc_ge_4 ( const char *  producer)

Check for GCC >= 4.x according to the symtab->producer string. Return minor version (x) of 4.x in such case. If it is not GCC or it is GCC older than 4.x return -1. If it is GCC 5.x or higher return INT_MAX.

Definition at line 3449 of file utils.c.

char* pulongest ( ULONGEST  l)

Print a ULONGEST in u format.

Parameters:
lthe (unsigned) integer to print
Returns:
a string of decimal digits

Definition at line 2844 of file utils.c.

Write a single char to gdb_stdout, filtered.

Definition at line 2126 of file utils.c.

Write a single char to gdb_stdout, unfiltered.

Definition at line 2114 of file utils.c.

void puts_debug ( char *  prefix,
char *  string,
char *  suffix 
)

Put out the given string, with special characters escaped, and enclosed by the given prefix and suffix strings.

Definition at line 2155 of file utils.c.

void puts_filtered ( const char *  )

Write a string to gdb_stdout, filtered.

Definition at line 2391 of file utils.c.

void puts_filtered_tabular ( char *  string,
int  width,
int  right 
)

Print input string to gdb_stdout, filtered, with wrap, arranging strings in columns of n chars. String can be right or left justified in the column. Never prints trailing spaces. String should never be longer than width.

Definition at line 1936 of file utils.c.

void puts_unfiltered ( const char *  )

Write a string to gdb_stdout, unfiltered.

Definition at line 2397 of file utils.c.

int query ( const char *  ctlstr,
  ... 
)

Definition at line 1381 of file utils.c.

void quit ( void  )

Definition at line 1040 of file utils.c.

PTR realloc ( )
void reinitialize_more_filter ( void  )

Definition at line 1872 of file utils.c.

Definition at line 1854 of file utils.c.

struct cleanup* set_batch_flag_and_make_cleanup_restore_page_info ( void  ) [read]

Definition at line 1721 of file utils.c.

void set_quit_flag ( void  )

Definition at line 152 of file utils.c.

int strcmp_iw ( const char *  string1,
const char *  string2 
)

Definition at line 2474 of file utils.c.

int strcmp_iw_ordered ( const char *  string1,
const char *  string2 
)

This is like strcmp except that it ignores whitespace and treats '(' as the first non-NULL character in terms of ordering. Like strcmp (and unlike strcmp_iw), it returns negative if STRING1 < STRING2, 0 if STRING2 = STRING2, and positive if STRING1 > STRING2 according to that ordering.

If a list is sorted according to this function and if you want to find names in the list that match some fixed NAME according to strcmp_iw(LIST_ELT, NAME), then the place to start looking is right where this function would put NAME.

This function must be neutral to the CASE_SENSITIVITY setting as the user may choose it during later lookup. Therefore this function always sorts primarily case-insensitively and secondarily case-sensitively.

Here are some examples of why using strcmp to sort is a bad idea:

Whitespace example:

Say your partial symtab contains: "foo<char *>", "goo". Then, if we try to do a search for "foo<char*>", strcmp will locate this after "foo<char *>" and before "goo". Then lookup_partial_symbol will start looking at strings beginning with "goo", and will never see the correct match of "foo<char *>".

Parenthesis example:

In practice, this is less like to be an issue, but I'll give it a shot. Let's assume that '$' is a legitimate character to occur in symbols. (Which may well even be the case on some systems.) Then say that the partial symbol table contains "foo$" and "foo(int)". strcmp will put them in this order, since '$' < '('. Now, if the user searches for "foo", then strcmp will sort "foo" before "foo$". Then lookup_partial_symbol will notice that strcmp_iw("foo$", "foo") is false, so it won't proceed to the actual match of "foo(int)" with "foo".

Definition at line 2502 of file utils.c.

int streq ( const char *  lhs,
const char *  rhs 
)

A simple comparison function with opposite semantics to strcmp.

Definition at line 2580 of file utils.c.

CORE_ADDR string_to_core_addr ( const char *  my_string)

Parse a decimal or hexadecimal string of digits, and return a CORE_ADDR. A hexadecimal string must begin with a "0x"; any invalid digits result in an error().

Definition at line 3023 of file utils.c.

ULONGEST strtoulst ( const char *  num,
const char **  trailer,
int  base 
)

As for strtoul, but for ULONGEST results.

Definition at line 3241 of file utils.c.

int subset_compare ( char *  string_to_compare,
char *  template_string 
)

Answer whether string_to_compare is a full or partial match to template_string. The partial match must be in sequence starting at index 0.

Definition at line 2587 of file utils.c.

void substitute_path_component ( char **  stringp,
const char *  from,
const char *  to 
)

Definition at line 3517 of file utils.c.

void throw_perror_with_name ( enum errors  errcode,
const char *  string 
)

Definition at line 979 of file utils.c.

void verror ( const char *  string,
va_list  args 
)

Definition at line 579 of file utils.c.

void vfatal ( const char *  string,
va_list  args 
)

Definition at line 599 of file utils.c.

void vfprintf_filtered ( struct ui_file *  stream,
const char *  format,
va_list  args 
)

Definition at line 2265 of file utils.c.

void vfprintf_unfiltered ( struct ui_file *  stream,
const char *  format,
va_list  args 
)

Definition at line 2271 of file utils.c.

void vprintf_filtered ( const char *  format,
va_list  args 
)

Definition at line 2302 of file utils.c.

void vprintf_unfiltered ( const char *  format,
va_list  args 
)

Definition at line 2308 of file utils.c.

void vwarning ( const char *  string,
va_list  args 
)

Definition at line 547 of file utils.c.

void warning ( const char *  string,
  ... 
)

Definition at line 565 of file utils.c.

void wrap_here ( char *  indent)

Definition at line 1900 of file utils.c.

int yquery ( const char *  ctlstr,
  ... 
)

Definition at line 1364 of file utils.c.


Variable Documentation

Definition at line 90 of file utils.c.

const char internal_problem_ask[] = "ask"

Definition at line 666 of file utils.c.

const char internal_problem_no[] = "no"

Definition at line 668 of file utils.c.

const char internal_problem_yes[] = "yes"

Definition at line 667 of file utils.c.

Definition at line 192 of file utils.c.

Definition at line 178 of file utils.c.

char* warning_pre_print = "\nwarning: "

String to be printed before the warning message, when a warning occurs. (Typically something like "warning:".)

Definition at line 190 of file utils.c.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines