event_location_up copy_event_location (const struct event_location *src) { struct event_location *dst; dst = XCNEW (struct event_location); EL_TYPE (dst) = EL_TYPE (src); if (EL_STRING (src) != NULL) EL_STRING (dst) = xstrdup (EL_STRING (src)); switch (EL_TYPE (src)) { case LINESPEC_LOCATION: EL_LINESPEC (dst)->match_type = EL_LINESPEC (src)->match_type; if (EL_LINESPEC (src)->spec_string != NULL) EL_LINESPEC (dst)->spec_string = xstrdup (EL_LINESPEC (src)->spec_string); break; case ADDRESS_LOCATION: EL_ADDRESS (dst) = EL_ADDRESS (src); break; case EXPLICIT_LOCATION: EL_EXPLICIT (dst)->func_name_match_type = EL_EXPLICIT (src)->func_name_match_type; if (EL_EXPLICIT (src)->source_filename != NULL) EL_EXPLICIT (dst)->source_filename = xstrdup (EL_EXPLICIT (src)->source_filename); if (EL_EXPLICIT (src)->function_name != NULL) EL_EXPLICIT (dst)->function_name = xstrdup (EL_EXPLICIT (src)->function_name); if (EL_EXPLICIT (src)->label_name != NULL) EL_EXPLICIT (dst)->label_name = xstrdup (EL_EXPLICIT (src)->label_name); EL_EXPLICIT (dst)->line_offset = EL_EXPLICIT (src)->line_offset; break; case PROBE_LOCATION: if (EL_PROBE (src) != NULL) EL_PROBE (dst) = xstrdup (EL_PROBE (src)); break; default: gdb_assert_not_reached ("unknown event location type"); } return event_location_up (dst); }
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); }
event_location_up new_address_location (CORE_ADDR addr, const char *addr_string, int addr_string_len) { struct event_location *location; location = XCNEW (struct event_location); EL_TYPE (location) = ADDRESS_LOCATION; EL_ADDRESS (location) = addr; if (addr_string != NULL) EL_STRING (location) = xstrndup (addr_string, addr_string_len); return event_location_up (location); }
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); }
CORE_ADDR get_address_location (const struct event_location *location) { gdb_assert (EL_TYPE (location) == ADDRESS_LOCATION); return EL_ADDRESS (location); }