const char * event_location_to_string (struct event_location *location) { if (EL_STRING (location) == NULL) { switch (EL_TYPE (location)) { case LINESPEC_LOCATION: if (EL_LINESPEC (location) != NULL) EL_STRING (location) = xstrdup (EL_LINESPEC (location)); break; case ADDRESS_LOCATION: EL_STRING (location) = xstrprintf ("*%s", core_addr_to_string (EL_ADDRESS (location))); break; case EXPLICIT_LOCATION: EL_STRING (location) = explicit_location_to_string (EL_EXPLICIT (location)); break; case PROBE_LOCATION: EL_STRING (location) = xstrdup (EL_PROBE (location)); break; default: gdb_assert_not_reached ("unknown event location type"); } } return EL_STRING (location); }
gdb::unique_xmalloc_ptr<char> c_watch_location_expression (struct type *type, CORE_ADDR addr) { type = check_typedef (TYPE_TARGET_TYPE (check_typedef (type))); std::string name = type_to_string (type); return gdb::unique_xmalloc_ptr<char> (xstrprintf ("* (%s *) %s", name.c_str (), core_addr_to_string (addr))); }
const char * event_location_to_string (struct event_location *location) { if (EL_STRING (location) == NULL) { switch (EL_TYPE (location)) { case LINESPEC_LOCATION: if (EL_LINESPEC (location)->spec_string != NULL) { linespec_location *ls = EL_LINESPEC (location); if (ls->match_type == symbol_name_match_type::FULL) { EL_STRING (location) = concat ("-qualified ", ls->spec_string, (char *) NULL); } else EL_STRING (location) = xstrdup (ls->spec_string); } break; case ADDRESS_LOCATION: EL_STRING (location) = xstrprintf ("*%s", core_addr_to_string (EL_ADDRESS (location))); break; case EXPLICIT_LOCATION: EL_STRING (location) = explicit_location_to_string (EL_EXPLICIT (location)); break; case PROBE_LOCATION: EL_STRING (location) = xstrdup (EL_PROBE (location)); break; default: gdb_assert_not_reached ("unknown event location type"); } } return EL_STRING (location); }
static void rs6000_xfer_shared_library (LdInfo *ldi, struct obstack *obstack) { const int arch64 = ARCH64 (); const char *archive_name = LDI_FILENAME (ldi, arch64); const char *member_name = archive_name + strlen (archive_name) + 1; CORE_ADDR text_addr, data_addr; ULONGEST text_size, data_size; char *p; if (arch64) { text_addr = ldi->l64.ldinfo_textorg; text_size = ldi->l64.ldinfo_textsize; data_addr = ldi->l64.ldinfo_dataorg; data_size = ldi->l64.ldinfo_datasize; } else { /* The text and data addresses are defined as pointers. To avoid sign-extending their value in the assignments below, we cast their value to unsigned long first. */ text_addr = (unsigned long) ldi->l32.ldinfo_textorg; text_size = ldi->l32.ldinfo_textsize; data_addr = (unsigned long) ldi->l32.ldinfo_dataorg; data_size = ldi->l32.ldinfo_datasize; } obstack_grow_str (obstack, "<library name=\""); p = xml_escape_text (archive_name); obstack_grow_str (obstack, p); xfree (p); obstack_grow_str (obstack, "\""); if (member_name[0] != '\0') { obstack_grow_str (obstack, " member=\""); p = xml_escape_text (member_name); obstack_grow_str (obstack, p); xfree (p); obstack_grow_str (obstack, "\""); } obstack_grow_str (obstack, " text_addr=\""); obstack_grow_str (obstack, core_addr_to_string (text_addr)); obstack_grow_str (obstack, "\""); obstack_grow_str (obstack, " text_size=\""); obstack_grow_str (obstack, pulongest (text_size)); obstack_grow_str (obstack, "\""); obstack_grow_str (obstack, " data_addr=\""); obstack_grow_str (obstack, core_addr_to_string (data_addr)); obstack_grow_str (obstack, "\""); obstack_grow_str (obstack, " data_size=\""); obstack_grow_str (obstack, pulongest (data_size)); obstack_grow_str (obstack, "\""); obstack_grow_str (obstack, "></library>"); }
static int ia64_vms_find_proc_info_x (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, int need_unwind_info, void *arg) { enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); unw_dyn_info_t di; int ret; gdb_byte buf[32]; const char *annex = core_addr_to_string (ip); LONGEST res; CORE_ADDR table_addr; unsigned int info_len; res = target_read (¤t_target, TARGET_OBJECT_OPENVMS_UIB, annex + 2, buf, 0, sizeof (buf)); if (res != sizeof (buf)) return -UNW_ENOINFO; pi->format = UNW_INFO_FORMAT_REMOTE_TABLE; pi->start_ip = extract_unsigned_integer (buf + 0, 8, byte_order); pi->end_ip = extract_unsigned_integer (buf + 8, 8, byte_order); pi->gp = extract_unsigned_integer (buf + 24, 8, byte_order); table_addr = extract_unsigned_integer (buf + 16, 8, byte_order); if (table_addr == 0) { /* No unwind data. */ pi->unwind_info = NULL; pi->unwind_info_size = 0; return 0; } res = target_read_memory (table_addr, buf, 8); if (res != 0) return -UNW_ENOINFO; /* Check version. */ if (extract_unsigned_integer (buf + 6, 2, byte_order) != 1) return -UNW_EBADVERSION; info_len = extract_unsigned_integer (buf + 0, 4, byte_order); pi->unwind_info_size = 8 * info_len; /* Read info. */ pi->unwind_info = xmalloc (pi->unwind_info_size); res = target_read_memory (table_addr + 8, pi->unwind_info, pi->unwind_info_size); if (res != 0) { xfree (pi->unwind_info); pi->unwind_info = NULL; return -UNW_ENOINFO; } /* FIXME: Handle OSSD (OS Specific Data). This extension to ia64 unwind information by OpenVMS is currently not handled by libunwind, but looks to be used only in very specific context, and is not generated by GCC. */ pi->lsda = table_addr + 8 + pi->unwind_info_size; if (extract_unsigned_integer (buf + 4, 2, byte_order) & 3) { pi->lsda += 8; /* There might be an handler, but this is not used for unwinding. */ pi->handler = 0; } return 0; }