]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
FreeBSD: complete loading debuginfo if entering capability mode
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 20 Aug 2023 06:52:36 +0000 (08:52 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 20 Aug 2023 06:52:36 +0000 (08:52 +0200)
coregrind/m_debuginfo/debuginfo.c
coregrind/m_syswrap/syswrap-freebsd.c
coregrind/pub_core_debuginfo.h

index 8d1fdc6960bbf8ac47671d6fff10322a2e7a50f1..c37e50b9d30b3792ac8df37feced05cd5084f1fe 100644 (file)
@@ -5102,6 +5102,21 @@ static void caches__invalidate ( void ) {
    debuginfo_generation++;
 }
 
+#if defined(VGO_freebsd)
+void VG_(load_all_debuginfo) (void)
+{
+   for (DebugInfo* di = debugInfo_list; di; di = di->next) {
+      if (di->deferred == True) {
+         di->deferred = False;
+         ML_(read_elf_debug)( di );
+         ML_(canonicaliseTables)( di );
+         check_CFSI_related_invariants(di);
+         ML_(finish_CFSI_arrays)(di);
+      }
+   }
+}
+#endif
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 9af37cfb8313a0456a1a885e450af97e3cfd1f23..a59872b3c942c8cc56f3e452e84d0cbe98e9343e 100644 (file)
@@ -5645,6 +5645,8 @@ PRE(sys_cap_enter)
          "         Please consider disabling capability by using the RUNNING_ON_VALGRIND mechanism.\n"
          "         See http://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.clientreq\n");
    }
+   /* now complete loading debuginfo since it is not allowed after entering cap mode */
+   VG_(load_all_debuginfo)();
 }
 
 // SYS_cap_getmode   517
index ce724621784bca505b89f452c077a7fe53bd6144..6e93bb93c597810fce3e73203f8a28fa92f18d47 100644 (file)
@@ -150,6 +150,13 @@ extern Bool VG_(use_CF_info) ( /*MOD*/D3UnwindRegs* uregs,
    info (e.g. CFI info or FPO info or ...). */
 extern UInt VG_(debuginfo_generation) (void);
 
+#if defined(VGO_freebsd)
+/* Force completion of loading all debuginfo.
+    Needed on FreeBSD when entering capability mode since
+    we can't open executable files to get the debuginfo after
+    entering capability mode. */
+extern void VG_(load_all_debuginfo) (void);
+#endif
 
 
 /* True if some FPO information is loaded.