(*record_gap)(gap_start, Addr_MAX - gap_start + 1);
}
+/* parse_procselfmaps() callbacks do not allow for easy thread safety. */
+static Addr found_addr;
+static SizeT found_size;
+static UInt found_prot;
+
+/* Reports a new mapping into variables above. */
+static void new_segment_found_callback(Addr addr, SizeT len, UInt prot,
+ ULong dev, ULong ino, Off64T offset, const HChar *filename)
+{
+ aspacem_assert(addr <= addr + len - 1);
+
+ Int iLo = find_nsegment_idx(addr);
+ Int iHi = find_nsegment_idx(addr + len - 1);
+ aspacem_assert(iLo <= iHi);
+ aspacem_assert(nsegments[iLo].start <= addr);
+ aspacem_assert(nsegments[iHi].end >= addr + len - 1);
+
+ /* Do not perform any sanity checks. That is done in other places.
+ Just find if a reported mapping is found in aspacemgr's book keeping. */
+ for (Int i = iLo; i <= iHi; i++) {
+ if ((nsegments[i].kind == SkFree) || (nsegments[i].kind == SkResvn)) {
+ found_addr = addr;
+ found_size = len;
+ found_prot = prot;
+ break;
+ }
+ }
+}
+
+/* Returns True if a new segment was found. */
+Bool VG_(am_search_for_new_segment)(Addr *addr, SizeT *size, UInt *prot)
+{
+ found_addr = 0;
+ parse_procselfmaps(new_segment_found_callback, NULL);
+
+ if (found_addr != 0) {
+ *addr = found_addr;
+ *size = found_size;
+ *prot = found_prot;
+ return True;
+ } else {
+ return False;
+ }
+}
+
#endif // defined(VGO_solaris)
/*------END-procmaps-parser-for-Solaris--------------------------*/
/* vfork */
if (ARG1 == 2)
VG_(close)(fds[1]);
+
+# if defined(SOLARIS_PT_SUNDWTRACE_THRP)
+ /* Kernel can map a new page as a scratch space of the DTrace fasttrap
+ provider. There is no way we can directly get its address - it's all
+ private to the kernel. Fish it the slow way. */
+ Addr addr;
+ SizeT size;
+ UInt prot;
+ Bool found = VG_(am_search_for_new_segment)(&addr, &size, &prot);
+ if (found) {
+ VG_(debugLog)(1, "syswrap-solaris", "PRE(forksys), new segment: "
+ "vaddr=%#lx, size=%#lx, prot=%#x\n", addr, size, prot);
+ vg_assert(prot == (VKI_PROT_READ | VKI_PROT_EXEC));
+ vg_assert(size == VKI_PAGE_SIZE);
+ ML_(notify_core_and_tool_of_mmap)(addr, size, prot, VKI_MAP_ANONYMOUS,
+ -1, 0);
+
+ /* Note: We don't notify the debuginfo reader about this mapping
+ because there is no debug information stored in this segment. */
+ }
+# endif /* SOLARIS_PT_SUNDWTRACE_THRP */
}
else {
VG_(do_atfork_parent)(tid);
-1, 0);
/* Note: We don't notify the debuginfo reader about this
- mapping because there are no debug information stored in
+ mapping because there is no debug information stored in
this segment. */
}
Int css_size, /*OUT*/Int* css_used);
#endif
+#if defined(VGO_solaris)
+extern Bool VG_(am_search_for_new_segment)(Addr *start, SizeT *size,
+ UInt *prot);
+#endif
+
#endif // __PUB_CORE_ASPACEMGR_H
/*--------------------------------------------------------------------*/