1
0
Fork 0

Auto detect debug symbols for host kernels

timestamps
dump_stack() 2019-08-16 05:34:10 +00:00
parent fc50808893
commit 3064dc3a27
3 changed files with 12 additions and 2 deletions

View File

@ -170,6 +170,9 @@ type KernelInfo struct {
KernelPath string
InitrdPath string
RootFS string
// Debug symbols
VmlinuxPath string
}
type KernelConfig struct {

View File

@ -114,7 +114,7 @@ func debugHandler(kcfg config.KernelConfig, workPath, kernRegex, gdb string,
return aurora.BgGreen(aurora.Black(name))
}
return aurora.BgRed(aurora.Gray(aurora.Bold(name)))
return aurora.BgRed(aurora.Gray(name))
}
fmt.Printf("[*] %s %s %s\n", redgreen("KASLR", kaslr),
@ -156,7 +156,7 @@ func debugHandler(kcfg config.KernelConfig, workPath, kernRegex, gdb string,
fmt.Printf("[*] build result copied to %s\n", coloredRemoteFile)
fmt.Printf("\n%s\n", q.GetSshCommand())
fmt.Printf("gdb -ex 'target remote %s'\n\n", gdb)
fmt.Printf("gdb %s -ex 'target remote %s'\n\n", ki.VmlinuxPath, gdb)
err = interactive(q)
return

View File

@ -348,6 +348,13 @@ func genHostKernels() (kcfg config.KernelConfig, err error) {
InitrdPath: kernelsBase + genInitrdPath(files, k),
RootFS: genRootfsImage(dii),
}
vmlinux := "/usr/lib/debug/boot/vmlinux-" + k
log.Println("vmlinux", vmlinux)
if exists(vmlinux) {
ki.VmlinuxPath = vmlinux
}
kcfg.Kernels = append(kcfg.Kernels, ki)
}