Index: devel/gdb/files/kgdb/fbsd-kvm.c =================================================================== --- devel/gdb/files/kgdb/fbsd-kvm.c +++ devel/gdb/files/kgdb/fbsd-kvm.c @@ -279,6 +279,7 @@ kvm_t *nkvm; const char *kernel; std::string filename; + int osreldate; bool writeable; if (ops == NULL || ops->supply_pcb == NULL || ops->cpu_pcb_addr == NULL) @@ -340,6 +341,10 @@ } #endif + kvm = nkvm; + vmcore = std::move(filename); + current_inferior()->push_target (&fbsd_kvm_ops); + /* * Determine the first address in KVA. Newer kernels export * VM_MAXUSER_ADDRESS and the first kernel address can be @@ -353,11 +358,26 @@ kernstart = kgdb_lookup("kernbase"); } + try { + osreldate = parse_and_eval_long("osreldate"); + } catch (const gdb_exception_error &e) { + error ("Failed to look up osreldate"); + } + /* - * Lookup symbols needed for stoppcbs[] handling, but don't + * Lookup symbols needed for stoppcbs handling, but don't * fail if they aren't present. */ stoppcbs = kgdb_lookup("stoppcbs"); + try { + if (osreldate > 1400088) { + stoppcbs = read_memory_typed_address(stoppcbs, + builtin_type(target_gdbarch())->builtin_data_ptr); + } + } catch (const gdb_exception_error &e) { + stoppcbs = 0; + } + try { pcb_size = parse_and_eval_long("pcb_size"); } catch (const gdb_exception_error &e) { @@ -379,10 +399,6 @@ } } - kvm = nkvm; - vmcore = std::move(filename); - current_inferior()->push_target (&fbsd_kvm_ops); - kgdb_dmesg(); inf = current_inferior();