2015-08-02 21 views
12

Sono su Mac OS X 10.10.Come posso capire il programma che ha causato il core dump?

ho notato che il mio disco rigido si sta riempiendo, perché ogni pochi minuti un nuovo file core dump appare in /cores:

$ ls -alhtr /cores 
total 3551488 
[email protected] 1 saqib admin 6.0K Apr 24 12:38 .DS_Store 
drwxr-xr-x 32 root admin 1.1K Aug 1 17:00 ../ 
-r-------- 1 saqib admin 578M Aug 1 22:36 core.35049 
-r-------- 1 saqib admin 578M Aug 1 22:37 core.35202 
[email protected] 6 root admin 204B Aug 1 22:38 ./ 
-r-------- 1 saqib admin 578M Aug 1 22:38 core.35438 

Ma non ho idea di quali processi stanno creando questi file core. I numeri nei nomi dei file dovrebbero rappresentare i PID dei processi che li hanno creati. Ma ovviamente quei processi sono morti. Quindi, come posso capire quale processo sta creando questi core in modo che io possa sistemarlo/rimuoverlo?

EDIT 1

Facendo gdb -c sul file core non mi dà le informazioni che ho bisogno:

$ gdb -c /cores/core.35438 
GNU gdb (GDB) 7.8.1 
Copyright (C) 2014 Free Software Foundation, Inc. 
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 
This is free software: you are free to change and redistribute it. 
There is NO WARRANTY, to the extent permitted by law. Type "show copying" 
and "show warranty" for details. 
This GDB was configured as "x86_64-apple-darwin14.0.0". 
Type "show configuration" for configuration details. 
For bug reporting instructions, please see: 
<http://www.gnu.org/software/gdb/bugs/>. 
Find the GDB manual and other documentation resources online at: 
<http://www.gnu.org/software/gdb/documentation/>. 
For help, type "help". 
Type "apropos word" to search for commands related to "word". 
"/cores/core.35438": no core file handler recognizes format 
(gdb) 

EDIT 2

file doesn' o sembra che funzioni:

$ file /cores/core.35049 
/cores/core.35049: Mach-O core i386 

EDIT 3

ho aperto il file core utilizzando un'applicazione chiamata MachOView. Puoi vedere lo screenshot di ciò che mi ha mostrato. Non riuscivo ancora a capire quale app ha creato questo file principale.

enter image description here

+0

non direttamente collegate, ma hai guardato [CrashReporter] (https://developer.apple.com/library/mac/technotes/tn2004/tn2123.html)? Dovrebbe essere abilitato di default e registrare tutti i crash, ma potresti volerlo impostare in modalità sviluppatore come mostrato in [questa pagina wiki] (https://en.wikipedia.org/wiki/Crash_Reporter_ (OS_X)) – Hasturkun

+0

Esegui a piccolo ciclo che memorizza tutti gli ID di processo ogni secondo in un file, quindi attendi l'arrivo di un core, interrompi il ciclo con Ctrl-C e controlla il processId nel file. 'mentre:; fai ps -aef >> /tmp/pids.txt; dormire 1; done' –

risposta

10

Eseguire l'utilità Console, che si trova in/Applicazioni/Utility. Consultare le INFORMAZIONI DIAGNOSTICHE E DI UTILIZZO per i Rapporti diagnostici dell'utente e i Rapporti diagnostici del sistema. Dovrebbe esserci una voce per ogni crash recente, con il nome del programma, la data, l'ora e il nome dell'host. È possibile fare clic su ognuna di queste per ulteriori informazioni.

È anche possibile accedere ai report diagnostici direttamente nel file system. I rapporti di diagnostica utente sono in ~/Library/Logs/DiagnosticReports/e i report di diagnostica del sistema sono in/Library/Logs/DiagnosticReports /.

+0

Posso grep questo file di console? Come? –

+2

Certo, puoi usare grep. Ho aggiunto i nomi delle directory alla risposta. – mark4o

4

Se il sistema ha un gdb installato, è possibile utilizzare gdb -c .. comando:

gdb -c core.35049 

otterrete l'output come segue:

GNU gdb (Ubuntu 7.9-1ubuntu1) 7.9 
Copyright (C) 2015 Free Software Foundation, Inc. 
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 
This is free software: you are free to change and redistribute it. 
There is NO WARRANTY, to the extent permitted by law. Type "show copying" 
and "show warranty" for details. 
This GDB was configured as "x86_64-linux-gnu". 
Type "show configuration" for configuration details. 
For bug reporting instructions, please see: 
<http://www.gnu.org/software/gdb/bugs/>. 
Find the GDB manual and other documentation resources online at: 
<http://www.gnu.org/software/gdb/documentation/>. 
For help, type "help". 
Type "apropos word" to search for commands related to "word". 
[New LWP 2905] 
Core was generated by `./a.out'. 
Program terminated with signal SIGSEGV, Segmentation fault. 

Leggendo questo, vedrà il core è stato generato dal programma a.out.

UPDATE

Utilizzando file, è anche possibile ottenere informazioni simili:

$ file core 
core: ELF 64-bit LSB core file x86-64, version 1 (SYSV), SVR4-style, from './a.out' 
+0

Sfortunatamente 'gdb -c' non ha funzionato. Ho apportato una modifica al post originale per mostrare perché. Altre idee? –

+0

@SaqibAli, che ne dite 'file/core/core.35438'? – falsetru

+0

@SaqibAli, scusa, non ho un'idea. – falsetru

0

Avevo solo bisogno di farlo su OS X 10.13 e utilizzando il comando image list in lldb ha funzionato per me.

lldb -c /cores/core.45943 
(lldb) target create "/cores/core.45943" 
Core file '/cores/core.45943' (i386) was loaded 
(lldb) image list 
Problemi correlati