GDB (xrefs)

Classes | Macros | Functions | Variables
/tmp/gdb-8.1/gdb/objc-lang.c File Reference
`#include "defs.h"`
`#include "symtab.h"`
`#include "gdbtypes.h"`
`#include "expression.h"`
`#include "parser-defs.h"`
`#include "language.h"`
`#include "varobj.h"`
`#include "c-lang.h"`
`#include "objc-lang.h"`
`#include "complaints.h"`
`#include "value.h"`
`#include "symfile.h"`
`#include "objfiles.h"`
`#include "target.h"`
`#include "gdbcore.h"`
`#include "gdbcmd.h"`
`#include "frame.h"`
`#include "gdb_regex.h"`
`#include "regcache.h"`
`#include "block.h"`
`#include "infcall.h"`
`#include "valprint.h"`
`#include "cli/cli-utils.h"`
`#include <ctype.h>`

Go to the source code of this file.

## Classes
struct | objc_object
struct | objc_class
struct | objc_super
struct | objc_method
struct | selname
struct | objc_methcall

## Macros
#define | nmethcalls (sizeof (methcalls) / sizeof (methcalls[0]))

## Functions
struct symbol * | lookup_struct_typedef (const char *name, const struct block *block, int noerr)
CORE_ADDR | lookup_objc_class (struct gdbarch *gdbarch, const char *classname)
CORE_ADDR | lookup_child_selector (struct gdbarch *gdbarch, const char *selname)
struct value * | value_nsstring (struct gdbarch *gdbarch, char *ptr, int len)
char * | objc_demangle (const char *mangled, int options)
static int | objc_sniff_from_mangled_name (const char *mangled, char **demangled)
static CORE_ADDR | objc_skip_trampoline (struct frame_info *frame, CORE_ADDR stop_pc)
void | start_msglist (void)
void | add_msglist (struct stoken *str, int addcolon)
int | end_msglist (struct parser_state *ps)
static int | specialcmp (const char *a, const char *b)
static int | compare_selectors (const void *a, const void *b)
static void | info_selectors_command (const char *regexp, int from_tty)
static int | compare_classes (const void *a, const void *b)
static void | info_classes_command (const char *regexp, int from_tty)
static char * | parse_selector (char *method, char **selector)
static char * | parse_method (char *method, char *type, char **theclass, char **category, char **selector)
static void | find_methods (char type, const char *theclass, const char *category, const char *selector, VEC(const_char_ptr) **symbol_names)
static void | uniquify_strings (VEC(const_char_ptr) **strings)
const char * | find_imps (const char *method, VEC(const_char_ptr) **symbol_names)
static void | print_object_command (const char *args, int from_tty)
static int | resolve_msgsend (CORE_ADDR pc, CORE_ADDR *new_pc)
static int | resolve_msgsend_stret (CORE_ADDR pc, CORE_ADDR *new_pc)
static int | resolve_msgsend_super (CORE_ADDR pc, CORE_ADDR *new_pc)
static int | resolve_msgsend_super_stret (CORE_ADDR pc, CORE_ADDR *new_pc)
static void | find_objc_msgsend (void)
static int | find_objc_msgcall_submethod (int(*f)(CORE_ADDR, CORE_ADDR *), CORE_ADDR pc, CORE_ADDR *new_pc)
int | find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc)
void | _initialize_objc_language (void)
static void | read_objc_method (struct gdbarch *gdbarch, CORE_ADDR addr, struct objc_method *method)
static unsigned long | read_objc_methlist_nmethods (struct gdbarch *gdbarch, CORE_ADDR addr)
static void | read_objc_methlist_method (struct gdbarch *gdbarch, CORE_ADDR addr, unsigned long num, struct objc_method *method)
static void | read_objc_object (struct gdbarch *gdbarch, CORE_ADDR addr, struct objc_object *object)
static void | read_objc_super (struct gdbarch *gdbarch, CORE_ADDR addr, struct objc_super *super)
static void | read_objc_class (struct gdbarch *gdbarch, CORE_ADDR addr, struct objc_class *theclass)
static CORE_ADDR | find_implementation_from_class (struct gdbarch *gdbarch, CORE_ADDR theclass, CORE_ADDR sel)
static CORE_ADDR | find_implementation (struct gdbarch *gdbarch, CORE_ADDR object, CORE_ADDR sel)
void | _initialize_objc_lang (void)

## Variables
static const struct objfile_data * | objc_objfile_data
static const struct op_print | objc_op_print_tab []
static const char * | objc_extensions []
const struct language_defn | objc_language_defn
static int | msglist_len
static struct selname * | selname_chain
static char * | msglist_sel
static struct objc_methcall | methcalls []

## Macro Definition Documentation

## ◆ nmethcalls

#define nmethcalls (sizeof (methcalls) / sizeof (methcalls[0]))

Definition at line 1263 of file objc-lang.c.

Referenced by find_objc_msgcall(), and find_objc_msgsend().

## Function Documentation

## ◆ _initialize_objc_lang()

void _initialize_objc_lang | ( | void |  | ) |

Definition at line 1600 of file objc-lang.c.

References objc_objfile_data.

## ◆ _initialize_objc_language()

void _initialize_objc_language | ( | void |  | ) |

Definition at line 1360 of file objc-lang.c.

References _, add_com(), add_com_alias(), add_info(), class_vars, info_classes_command(), info_selectors_command(), and print_object_command().

## ◆ add_msglist()

void add_msglist | ( | struct stoken * | str,
|  | int | addcolon
| ) |  |

Definition at line 448 of file objc-lang.c.

References stoken::length, msglist_len, msglist_sel, stoken::ptr, xfree(), and xmalloc().

Referenced by yyparse().

## ◆ compare_classes()

static int compare_classes | ( | const void * | a,
|  | const void * | b
| ) |  |
| static

Definition at line 704 of file objc-lang.c.

References _, error(), specialcmp(), and SYMBOL_PRINT_NAME.

Referenced by info_classes_command().

## ◆ compare_selectors()

static int compare_selectors | ( | const void * | a,
|  | const void * | b
| ) |  |
| static

Definition at line 538 of file objc-lang.c.

References _, error(), specialcmp(), and SYMBOL_PRINT_NAME.

Referenced by info_selectors_command().

## ◆ end_msglist()

int end_msglist | ( | struct parser_state * | ps | ) |

Definition at line 486 of file objc-lang.c.

References _, error(), lookup_child_selector(), selname::msglist_len, msglist_len, selname::msglist_sel, msglist_sel, selname::next, parse_gdbarch, cleanup_check::ps, selname_chain, write_exp_elt_longcst(), and xfree().

Referenced by yyparse().

## ◆ find_implementation()

static CORE_ADDR find_implementation | ( | struct gdbarch * | gdbarch,
|  | CORE_ADDR | object,
|  | CORE_ADDR | sel
| ) |  |
| static

Definition at line 1485 of file objc-lang.c.

References find_implementation_from_class(), objc_object::isa, and read_objc_object().

Referenced by resolve_msgsend(), and resolve_msgsend_stret().

## ◆ find_implementation_from_class()

static CORE_ADDR find_implementation_from_class | ( | struct gdbarch * | gdbarch,
|  | CORE_ADDR | theclass,
|  | CORE_ADDR | sel
| ) |  |
| static

Definition at line 1437 of file objc-lang.c.

References gdbarch_byte_order(), objc_method::imp, objc_class::methods, objc_method::name, read_memory_unsigned_integer(), read_objc_class(), read_objc_methlist_method(), read_objc_methlist_nmethods(), and objc_class::super_class.

Referenced by find_implementation(), resolve_msgsend_super(), and resolve_msgsend_super_stret().

## ◆ find_imps()

const char* find_imps | ( | const char * | method,
|  | VEC(const_char_ptr) ** | symbol_names
| ) |  |

Definition at line 1130 of file objc-lang.c.

References find_methods(), gdb_assert, lookup_minimal_symbol(), lookup_symbol(), bound_minimal_symbol::minsym, MSYMBOL_NATURAL_NAME, parse_method(), parse_selector(), selector, block_symbol::symbol, SYMBOL_NATURAL_NAME, uniquify_strings(), VAR_DOMAIN, VEC_empty, and VEC_safe_push.

Referenced by decode_objc(), and find_function_symbols().

## ◆ find_methods()

static void find_methods | ( | char | type,
|  | const char * | theclass,
|  | const char * | category,
|  | const char * | selector,
|  | VEC(const_char_ptr) ** | symbol_names
| ) |  |
| static

Definition at line 974 of file objc-lang.c.

References ALL_OBJFILE_MSYMBOLS, ALL_OBJFILES, gdb_assert, MSYMBOL_NATURAL_NAME, objc_objfile_data, parse_method(), QUIT, selector, VEC_safe_push, and xrealloc().

Referenced by find_imps().

## ◆ find_objc_msgcall()

int find_objc_msgcall | ( | CORE_ADDR | pc,
|  | CORE_ADDR * | new_pc
| ) |  |

Definition at line 1336 of file objc-lang.c.

References find_objc_msgcall_submethod(), find_objc_msgsend(), methcalls, and nmethcalls.

Referenced by objc_skip_trampoline().

## ◆ find_objc_msgcall_submethod()

static int find_objc_msgcall_submethod | ( | int(*)(CORE_ADDR, CORE_ADDR *) | f,
|  | CORE_ADDR | pc,
|  | CORE_ADDR * | new_pc
| ) |  |
| static

Definition at line 1315 of file objc-lang.c.

References CATCH, END_CATCH, exception_fprintf(), gdb_stderr, RETURN_MASK_ALL, and TRY.

Referenced by find_objc_msgcall().

## ◆ find_objc_msgsend()

static void find_objc_msgsend | ( | void |  | ) |
| static

Definition at line 1273 of file objc-lang.c.

References objc_methcall::begin, BMSYMBOL_VALUE_ADDRESS, objc_methcall::end, func, lookup_bound_minimal_symbol(), methcalls, minimal_symbol_upper_bound(), name, objc_methcall::name, and nmethcalls.

Referenced by find_objc_msgcall().

## ◆ info_classes_command()

static void info_classes_command | ( | const char * | regexp,
|  | int | from_tty
| ) |  |
| static

Definition at line 727 of file objc-lang.c.

References _, ALL_MSYMBOLS, begin_line(), compare_classes(), error(), MSYMBOL_NATURAL_NAME, name, objfile::objfile(), printf_filtered(), puts_filtered_tabular(), qsort, QUIT, re_comp(), specialcmp(), and SYMBOL_NATURAL_NAME.

Referenced by _initialize_objc_language().

## ◆ info_selectors_command()

static void info_selectors_command | ( | const char * | regexp,
|  | int | from_tty
| ) |  |
| static

Definition at line 565 of file objc-lang.c.

References _, ALL_MSYMBOLS, begin_line(), compare_selectors(), complaint, error(), MSYMBOL_NATURAL_NAME, name, objfile::objfile(), printf_filtered(), puts_filtered_tabular(), qsort, QUIT, re_comp(), specialcmp(), SYMBOL_NATURAL_NAME, and symfile_complaints.

Referenced by _initialize_objc_language().

## ◆ lookup_child_selector()

CORE_ADDR lookup_child_selector | ( | struct gdbarch * | gdbarch,
|  | const char * | selname
| ) |  |

Definition at line 139 of file objc-lang.c.

References _, builtin_type::builtin_char, builtin_type(), call_function_by_hand(), complaint, find_function_in_inferior(), lookup_minimal_symbol(), symfile_complaints, target_has_execution, value_as_long(), value_coerce_array(), and value_string().

Referenced by end_msglist(), evaluate_subexp_standard(), and value_nsstring().

## ◆ lookup_objc_class()

CORE_ADDR lookup_objc_class | ( | struct gdbarch * | gdbarch,
|  | const char * | classname
| ) |  |

Definition at line 109 of file objc-lang.c.

References _, builtin_type::builtin_char, builtin_type(), call_function_by_hand(), complaint, find_function_in_inferior(), lookup_minimal_symbol(), symfile_complaints, target_has_execution, value_as_long(), value_coerce_array(), and value_string().

Referenced by value_nsstring(), VEC(), and yyparse().

## ◆ lookup_struct_typedef()

struct symbol* lookup_struct_typedef | ( | const char * | name,
|  | const struct block * | block,
|  | int | noerr
| ) |  |

Definition at line 84 of file objc-lang.c.

References _, error(), lookup_symbol(), name, STRUCT_DOMAIN, block_symbol::symbol, SYMBOL_TYPE, TYPE_CODE, and TYPE_CODE_STRUCT.

Referenced by value_nsstring(), and VEC().

## ◆ objc_demangle()

char* objc_demangle | ( | const char * | mangled,
|  | int | options
| ) |  |

Definition at line 223 of file objc-lang.c.

References xfree(), and xmalloc().

Referenced by objc_sniff_from_mangled_name().

## ◆ objc_skip_trampoline()

static CORE_ADDR objc_skip_trampoline | ( | struct frame_info * | frame,
|  | CORE_ADDR | stop_pc
| ) |  |
| static

Definition at line 302 of file objc-lang.c.

References find_objc_msgcall(), gdbarch_skip_trampoline_code(), get_frame_arch(), and stop_pc.

## ◆ objc_sniff_from_mangled_name()

static int objc_sniff_from_mangled_name | ( | const char * | mangled,
|  | char ** | demangled
| ) |  |
| static

Definition at line 289 of file objc-lang.c.

References objc_demangle().

## ◆ parse_method()

static char* parse_method | ( | char * | method,
|  | char * | type,
|  | char ** | theclass,
|  | char ** | category,
|  | char ** | selector
| ) |  |
| static

Definition at line 878 of file objc-lang.c.

References gdb_assert, selector, and skip_spaces().

Referenced by find_imps(), and find_methods().

## ◆ parse_selector()

static char* parse_selector | ( | char * | method,
|  | char ** | selector
| ) |  |
| static

Definition at line 826 of file objc-lang.c.

References gdb_assert, selector, and skip_spaces().

Referenced by find_imps().

## ◆ print_object_command()

static void print_object_command | ( | const char * | args,
|  | int | from_tty
| ) |  |
| static

Definition at line 1188 of file objc-lang.c.

References _, builtin_type::builtin_data_ptr, call_function_by_hand(), error(), EVAL_NORMAL, evaluate_subexp(), find_function_in_inferior(), parse_expression(), printf_filtered(), QUIT, read_memory(), and value_as_long().

Referenced by _initialize_objc_language().

## ◆ read_objc_class()

static void read_objc_class | ( | struct gdbarch * | gdbarch,
|  | CORE_ADDR | addr,
|  | struct objc_class * | theclass
| ) |  |
| static

Definition at line 1418 of file objc-lang.c.

References objc_class::cache, gdbarch_byte_order(), objc_class::info, objc_class::instance_size, objc_class::isa, objc_class::ivars, objc_class::methods, objc_class::name, objc_class::protocols, read_memory_unsigned_integer(), objc_class::super_class, and objc_class::version.

Referenced by find_implementation_from_class().

## ◆ read_objc_methlist_method()

static void read_objc_methlist_method | ( | struct gdbarch * | gdbarch,
|  | CORE_ADDR | addr,
|  | unsigned long | num,
|  | struct objc_method * | method
| ) |  |
| static

Definition at line 1391 of file objc-lang.c.

References gdb_assert, read_objc_methlist_nmethods(), and read_objc_method().

Referenced by find_implementation_from_class().

## ◆ read_objc_methlist_nmethods()

static unsigned long read_objc_methlist_nmethods | ( | struct gdbarch * | gdbarch,
|  | CORE_ADDR | addr
| ) |  |
| static

Definition at line 1383 of file objc-lang.c.

References gdbarch_byte_order(), and read_memory_unsigned_integer().

Referenced by find_implementation_from_class(), and read_objc_methlist_method().

## ◆ read_objc_method()

static void read_objc_method | ( | struct gdbarch * | gdbarch,
|  | CORE_ADDR | addr,
|  | struct objc_method * | method
| ) |  |
| static

Definition at line 1372 of file objc-lang.c.

References gdbarch_byte_order(), objc_method::imp, objc_method::name, read_memory_unsigned_integer(), and objc_method::types.

Referenced by read_objc_methlist_method().

## ◆ read_objc_object()

static void read_objc_object | ( | struct gdbarch * | gdbarch,
|  | CORE_ADDR | addr,
|  | struct objc_object * | object
| ) |  |
| static

Definition at line 1399 of file objc-lang.c.

References gdbarch_byte_order(), and read_memory_unsigned_integer().

Referenced by find_implementation().

## ◆ read_objc_super()

static void read_objc_super | ( | struct gdbarch * | gdbarch,
|  | CORE_ADDR | addr,
|  | struct objc_super * | super
| ) |  |
| static

Definition at line 1408 of file objc-lang.c.

References gdbarch_byte_order(), read_memory_unsigned_integer(), objc_super::receiver, and objc_super::theclass.

Referenced by resolve_msgsend_super(), and resolve_msgsend_super_stret().

## ◆ resolve_msgsend()

static int resolve_msgsend | ( | CORE_ADDR | pc,
|  | CORE_ADDR * | new_pc
| ) |  |
| static

Definition at line 1500 of file objc-lang.c.

References builtin_type::builtin_func_ptr, builtin_type(), find_implementation(), gdbarch_fetch_pointer_argument(), get_current_frame(), and get_frame_arch().

## ◆ resolve_msgsend_stret()

static int resolve_msgsend_stret | ( | CORE_ADDR | pc,
|  | CORE_ADDR * | new_pc
| ) |  |
| static

Definition at line 1522 of file objc-lang.c.

References builtin_type::builtin_func_ptr, builtin_type(), find_implementation(), gdbarch_fetch_pointer_argument(), get_current_frame(), and get_frame_arch().

## ◆ resolve_msgsend_super()

static int resolve_msgsend_super | ( | CORE_ADDR | pc,
|  | CORE_ADDR * | new_pc
| ) |  |
| static

Definition at line 1544 of file objc-lang.c.

References builtin_type::builtin_func_ptr, builtin_type(), find_implementation_from_class(), gdbarch_fetch_pointer_argument(), get_current_frame(), get_frame_arch(), read_objc_super(), and objc_super::theclass.

## ◆ resolve_msgsend_super_stret()

static int resolve_msgsend_super_stret | ( | CORE_ADDR | pc,
|  | CORE_ADDR * | new_pc
| ) |  |
| static

Definition at line 1572 of file objc-lang.c.

References builtin_type::builtin_func_ptr, builtin_type(), find_implementation_from_class(), gdbarch_fetch_pointer_argument(), get_current_frame(), get_frame_arch(), read_objc_super(), and objc_super::theclass.

## ◆ specialcmp()

static int specialcmp | ( | const char * | a,
|  | const char * | b
| ) |  |
| static

Definition at line 515 of file objc-lang.c.

Referenced by compare_classes(), compare_selectors(), info_classes_command(), and info_selectors_command().

## ◆ start_msglist()

void start_msglist | ( | void |  | ) |

Definition at line 434 of file objc-lang.c.

References selname::msglist_len, msglist_len, selname::msglist_sel, msglist_sel, selname::next, selname_chain, xmalloc(), and XNEW.

Referenced by yyparse().

## ◆ uniquify_strings()

static void uniquify_strings | ( | VEC(const_char_ptr) ** | strings | ) |
| static

Definition at line 1070 of file objc-lang.c.

References compare_strings(), qsort, VEC_address, VEC_empty, VEC_iterate, VEC_length, VEC_replace, and VEC_truncate.

Referenced by find_imps().

## ◆ value_nsstring()

struct value* value_nsstring | ( | struct gdbarch * | gdbarch,
|  | char * | ptr,
|  | int | len
| ) |  |

Definition at line 168 of file objc-lang.c.

References _, builtin_type::builtin_char, builtin_type::builtin_data_ptr, builtin_type::builtin_long, builtin_type(), call_function_by_hand(), deprecated_set_value_type(), error(), find_function_in_inferior(), lookup_child_selector(), lookup_minimal_symbol(), lookup_objc_class(), lookup_pointer_type(), lookup_struct_typedef(), SYMBOL_TYPE, target_has_execution, type, value_coerce_array(), value_from_longest(), and value_string().

Referenced by evaluate_subexp_standard().

## Variable Documentation

## ◆ methcalls

struct objc_methcall methcalls[]
| static

Initial value:
= {
{ "_objc_msgSend", resolve_msgsend, 0, 0},
{ "_objc_msgSend_stret", resolve_msgsend_stret, 0, 0},
{ "_objc_msgSendSuper", resolve_msgsend_super, 0, 0},
{ "_objc_msgSendSuper_stret", resolve_msgsend_super_stret, 0, 0},
{ "_objc_getClass", NULL, 0, 0},
{ "_objc_getMetaClass", NULL, 0, 0}
}
resolve_msgsend_super_stret
static int resolve_msgsend_super_stret(CORE_ADDR pc, CORE_ADDR *new_pc)
Definition: objc-lang.c:1572
resolve_msgsend_stret
static int resolve_msgsend_stret(CORE_ADDR pc, CORE_ADDR *new_pc)
Definition: objc-lang.c:1522
resolve_msgsend_super
static int resolve_msgsend_super(CORE_ADDR pc, CORE_ADDR *new_pc)
Definition: objc-lang.c:1544
resolve_msgsend
static int resolve_msgsend(CORE_ADDR pc, CORE_ADDR *new_pc)
Definition: objc-lang.c:1500

Definition at line 1254 of file objc-lang.c.

Referenced by find_objc_msgcall(), and find_objc_msgsend().

## ◆ msglist_len

int msglist_len
| static

Definition at line 429 of file objc-lang.c.

Referenced by add_msglist(), end_msglist(), and start_msglist().

## ◆ msglist_sel

char* msglist_sel
| static

Definition at line 431 of file objc-lang.c.

Referenced by add_msglist(), end_msglist(), and start_msglist().

## ◆ objc_extensions

const char* objc_extensions[]
| static

Initial value:
=
{
".m", NULL
}

Definition at line 364 of file objc-lang.c.

## ◆ objc_language_defn

const struct language_defn objc_language_defn

## ◆ objc_objfile_data

const struct objfile_data* objc_objfile_data
| static

Definition at line 77 of file objc-lang.c.

Referenced by _initialize_objc_lang(), and find_methods().

## ◆ objc_op_print_tab

const struct op_print objc_op_print_tab[]
| static

Definition at line 330 of file objc-lang.c.

## ◆ selname_chain

struct selname* selname_chain
| static

Definition at line 430 of file objc-lang.c.

Referenced by end_msglist(), and start_msglist().