aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/meson.build26
-rw-r--r--tools/src/crashhandler/defaults.go.in4
-rw-r--r--tools/src/crashhandler/main.go81
3 files changed, 0 insertions, 111 deletions
diff --git a/tools/meson.build b/tools/meson.build
index fd1547e..7008eca 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -1,29 +1,3 @@
-if get_option('crashhandler').enabled() or get_option('updater').enabled()
- go = find_program('go', required: true)
- go_args = [ '-buildmode=pie' ]
-endif
-
-if get_option('crashhandler').enabled()
-
-# normally, you'd use configure_file to create this file, but that would only place it in build,
-# and go will refuse to build from files in two different directories
-meson.add_postconf_script(meson.source_root()/'scripts/gen-crashhandler-default-go.py',
- '--kconfig=' + meson.source_root()/'Kconfig',
- '--dotconfig=' + meson.source_root()/host_machine.system()/'.config',
- '--input=' + meson.current_source_dir()/'src/crashhandler/defaults.go.in',
- '--output=' + meson.current_source_dir()/'src/crashhandler/defaults.go'
-)
-
-custom_target('poi-crash',
- input: [ files('src/updater/main.go'), meson.current_source_dir()/'src/crashhandler/defaults.go' ],
- output: 'poi-crash',
- command: ['env', 'GOPATH='+meson.current_source_dir(), go, 'build', go_args, '-o=@OUTPUT@', 'crashhandler'],
- build_by_default: true,
- install: true,
- install_dir: get_option('bindir'),
-)
-endif
-
if get_option('updater').enabled()
custom_target('poi-update',
input: files('src/updater/main.go'),
diff --git a/tools/src/crashhandler/defaults.go.in b/tools/src/crashhandler/defaults.go.in
deleted file mode 100644
index 2ea5827..0000000
--- a/tools/src/crashhandler/defaults.go.in
+++ /dev/null
@@ -1,4 +0,0 @@
-package main
-
-var dumpPath = "@PATH_CRASHDUMP@"
-
diff --git a/tools/src/crashhandler/main.go b/tools/src/crashhandler/main.go
deleted file mode 100644
index 7b1717f..0000000
--- a/tools/src/crashhandler/main.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package main
-
-import (
- "flag"
- "fmt"
- "io/ioutil"
- "os"
- "strings"
-)
-
-type CrashDump struct {
- Name string
- DumpPath string
- MetadataPath string
-}
-
-func expandHomeDir(path string) (string, error) {
- home, err := os.UserHomeDir()
- if err != nil {
- return path, err
- }
-
- return strings.Replace(path, "~/", home, -1), nil
-}
-
-func dumps(path string) ([]CrashDump, error) {
- files, err := ioutil.ReadDir(path)
- if err != nil {
- return nil, err
- }
-
- var crashes []CrashDump
-
- for i, file := range files {
- if strings.HasSuffix(file.Name(), ".dmp") {
- if i+1 < len(files) && files[i+1].Name() == file.Name()+".txt" {
- crashes = append(crashes, CrashDump{Name: strings.TrimSuffix(file.Name(), ".dmp"),
- DumpPath: file.Name(), MetadataPath: files[i+1].Name()})
- } else {
- crashes = append(crashes, CrashDump{Name: strings.TrimSuffix(file.Name(), ".dmp"), DumpPath: file.Name()})
- }
- }
- }
-
- return crashes, nil
-}
-
-func main() {
- helpFlag := flag.Bool("help", false, "Show help information.")
- flag.StringVar(&dumpPath, "crashd", dumpPath, "Crash dump path")
-
- // create crash report flags
- crashedFlag := flag.String("c", "", "Create crash report at specified location and write any specified data into it")
-
- flag.Parse()
- dumpPath, _ = expandHomeDir(dumpPath)
-
- if *helpFlag {
- flag.PrintDefaults()
- return
- }
-
- if *crashedFlag != "" {
- fmt.Println("Creating crash dump report", *crashedFlag)
- contents := []byte("Additional information: " + strings.Join(flag.Args(), ""))
- ioutil.WriteFile(*crashedFlag+".txt", contents, 0644)
- return
- }
-
- fmt.Printf(" [%s]\n", dumpPath)
- c, err := dumps(dumpPath)
- if err != nil {
- panic(err)
- }
- for _, d := range c {
- fmt.Printf("\t- %s\n", d.Name)
- }
- fmt.Println(" To analyze a crashdump, use the minidump_stackwalk tool:")
- fmt.Println("minidump_stackwalk <minidump-file> [symbol-path]")
-
-}