X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fstap-probe.c;h=73596446cce51d94e789b1ff3584b8fec807b5a1;hb=0ac553107c601cc9c4c340338e0fc7e0ce8375cc;hp=ea206cbb80f3016db7e30e65db751892b7cd7415;hpb=0dc327459b19e6765c8fe80957f5c8620611628e;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c index ea206cbb80..73596446cc 100644 --- a/gdb/stap-probe.c +++ b/gdb/stap-probe.c @@ -1,6 +1,6 @@ /* SystemTap probe support for GDB. - Copyright (C) 2012-2019 Free Software Foundation, Inc. + Copyright (C) 2012-2020 Free Software Foundation, Inc. This file is part of GDB. @@ -101,6 +101,12 @@ struct stap_probe_arg class stap_static_probe_ops : public static_probe_ops { public: + /* We need a user-provided constructor to placate some compilers. + See PR build/24937. */ + stap_static_probe_ops () + { + } + /* See probe.h. */ bool is_linespec (const char **linespecp) const override; @@ -1284,8 +1290,7 @@ stap_probe::parse_arguments (struct gdbarch *gdbarch) static CORE_ADDR relocate_address (CORE_ADDR address, struct objfile *objfile) { - return address + ANOFFSET (objfile->section_offsets, - SECT_OFF_DATA (objfile)); + return address + objfile->data_section_offset (); } /* Implementation of the get_relocated_address method. */ @@ -1425,9 +1430,6 @@ stap_modify_semaphore (CORE_ADDR address, int set, struct gdbarch *gdbarch) struct type *type = builtin_type (gdbarch)->builtin_unsigned_short; ULONGEST value; - if (address == 0) - return; - /* Swallow errors. */ if (target_read_memory (address, bytes, TYPE_LENGTH (type)) != 0) { @@ -1435,8 +1437,8 @@ stap_modify_semaphore (CORE_ADDR address, int set, struct gdbarch *gdbarch) return; } - value = extract_unsigned_integer (bytes, TYPE_LENGTH (type), - gdbarch_byte_order (gdbarch)); + enum bfd_endian byte_order = type_byte_order (type); + value = extract_unsigned_integer (bytes, TYPE_LENGTH (type), byte_order); /* Note that we explicitly don't worry about overflow or underflow. */ if (set) @@ -1444,8 +1446,7 @@ stap_modify_semaphore (CORE_ADDR address, int set, struct gdbarch *gdbarch) else --value; - store_unsigned_integer (bytes, TYPE_LENGTH (type), - gdbarch_byte_order (gdbarch), value); + store_unsigned_integer (bytes, TYPE_LENGTH (type), byte_order, value); if (target_write_memory (address, bytes, TYPE_LENGTH (type)) != 0) warning (_("Could not write the value of a SystemTap semaphore.")); @@ -1462,6 +1463,8 @@ stap_modify_semaphore (CORE_ADDR address, int set, struct gdbarch *gdbarch) void stap_probe::set_semaphore (struct objfile *objfile, struct gdbarch *gdbarch) { + if (m_sem_addr == 0) + return; stap_modify_semaphore (relocate_address (m_sem_addr, objfile), 1, gdbarch); } @@ -1470,6 +1473,8 @@ stap_probe::set_semaphore (struct objfile *objfile, struct gdbarch *gdbarch) void stap_probe::clear_semaphore (struct objfile *objfile, struct gdbarch *gdbarch) { + if (m_sem_addr == 0) + return; stap_modify_semaphore (relocate_address (m_sem_addr, objfile), 0, gdbarch); } @@ -1512,7 +1517,7 @@ handle_stap_probe (struct objfile *objfile, struct sdt_note *el, { bfd *abfd = objfile->obfd; int size = bfd_get_arch_size (abfd) / 8; - struct gdbarch *gdbarch = get_objfile_arch (objfile); + struct gdbarch *gdbarch = objfile->arch (); struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr; /* Provider and the name of the probe. */ @@ -1601,7 +1606,7 @@ get_stap_base_address (bfd *obfd, bfd_vma *base) { complaint (_("could not obtain base address for " "SystemTap section on objfile `%s'."), - obfd->filename); + bfd_get_filename (obfd)); return 0; } @@ -1704,8 +1709,9 @@ info_probes_stap_command (const char *arg, int from_tty) info_probes_for_spops (arg, from_tty, &stap_static_probe_ops); } +void _initialize_stap_probe (); void -_initialize_stap_probe (void) +_initialize_stap_probe () { all_static_probe_ops.push_back (&stap_static_probe_ops);