2015-05-18 20 views
9

Sto usando clion per scrivere un'applicazione console. Se eseguo semplicemente il programma, posso vedere i risultati delle mie chiamate cout. Ma se eseguo il debug, non si verifica alcun output nella scheda Debug Console diverso dal nome del mio exe e da Process finished with exit code 0. C'è un ulteriore passaggio per far sì che l'output della console venga mostrato sotto debug in clion?Come si acquisisce l'output della console sotto debug in clion?

Oppure questo non è nemmeno specifico di Clion ed è una cosa generale che le persone che hanno utilizzato gdb già conoscono?

risposta

-3

GDB manipola il processo di esecuzione di un programma.

Un esempio di GDB sessione:

% cat hello.c 
#include<stdio.h> 

main() { 
    int count; 

    for (count=0;count<10;count++) 
     printf("Hello from CETS!\n"); 
} 

% gcc -g hello.c 
% gdb ./a.out 
GDB is free software and you are welcome to distribute copies of it 
under certain conditions; type "show copying" to see the conditions. 
There is absolutely no warranty for GDB; type "show warranty" for details. 
GDB 4.13 (sparc-sun-solaris2.3), 
Copyright 1994 Free Software Foundation, Inc... 
(gdb) b main 
Breakpoint 1 at 0x10784: file hello.c, line 6. 
(gdb) r 
Starting program: /home1/b/bozo/./a.out 


Breakpoint 1, main() at hello.c:6 
6   for (count=0;count<10;count++) 
(gdb) s 
7    printf("Hello from CETS!\n"); 
(gdb) p count 
$1 = 0 
(gdb) disp count 
1: count = 0 
(gdb) set count=8 
(gdb) s 
Hello from CETS! 
6   for (count=0;count<10;count++) 
1: count = 8 
(gdb) 
7    printf("Hello from CETS!\n"); 
1: count = 9 
(gdb) c 
Continuing. 
Hello from CETS! 

Program exited with code 01. 
(gdb) q 
% 

Contenuto che potrebbe essere utile per voi:

http://www.cs.swarthmore.edu/~newhall/unixhelp/howto_gdb.html

http://www.ifp.illinois.edu/~nakazato/tips/xgcc.html#GDB

http://www.seas.upenn.edu/cets/answers/gcc.html

+0

temo I don' t davvero vedere come questo risponde alla domanda. Non si interagisce direttamente con gdb quando si utilizza Clion. È un IDE. – jep

+0

@jep, scusa allora. Ho appena provato ad aiutare (: – Alex29954

+0

Va bene, solo assicurandomi che non mi sfugga qualcosa o non fosse abbastanza chiaro nella mia domanda. – jep