Bonjour à tous,

Ma question est toute simple : est-il possible de debugguer un programme en c, ecrit sous linux, à partir d'XCode ?

Pour faire simple, voici un exemple :

Sous linux :

test_gdb
| bin
hello.exe
| obj
hello.o
| sources
hello.c
makefile


hello.c :
---------
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
#include <stdio.h>

int main() {
        printf ("Hello, World!\n");
        return 0;
}
makefile :
------------
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
BIN = ../bin
OBJ = ../obj
SRC = ../sources

CFLAGS+= -g

OBJETS = $(OBJ)/hello.o

all : 
        make $(BIN)/hello.exe

clean : 
        -rm -f $(OBJ)/hello.o

$(BIN)/hello.exe : $(OBJETS)

        $(CC) $(CFLAGS) -o $(BIN)/hello.exe $(OBJETS)

$(OBJ)/hello.o : $(SRC)/hello.c
        $(CC) $(CFLAGS) -c -o $(OBJ)/hello.o $(SRC)/hello.c

Sous osx

La, ca se gate. En fait, j'ai installé fuse et j'ai monté un repertoire à l'aide de sshfs qui pointe directement vers le repertoire 'test_gdb' de ma machine linux, tout en configurant les .ssh (avec les clés qui vont bien).

A partir de la, j'ai fait plusieurs tests :

test avec Xcode 5

J'ai utilisé ce tuto : http://ricardo-dias.com/2012/01/08/d...os-x-in-xcode/, et cela ma permis de compiler à distance, bref tout va bien, mais comment mettre un point d'arret et s'arreter dessus ? Je ne peux qu'attacher xcode à un process local, or le process est sur ma machine distante ?

test avec Xcode 3.2.6

Pour ce test, rebelotte, je cree un projet, qui compile en local et nous avons une partie "debug via ssh".
Par contre, lorsque je lance le debug, j'ai ceci :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
[Session started at 2014-03-17 17:12:29 +0100.]
OpenSSH_5.2p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config

debug1: Connecting to vmCode [10.211.55.8] port 22.

debug1: Connection established.

debug1: identity file /Users/Antemis/.ssh/identity type -1

debug1: identity file /Users/Antemis/.ssh/id_rsa type -1

debug1: identity file /Users/Antemis/.ssh/id_dsa type 2

debug1: Remote protocol version 2.0, remote software version OpenSSH_6.2p2 Ubuntu-6ubuntu0.1

debug1: match: OpenSSH_6.2p2 Ubuntu-6ubuntu0.1 pat OpenSSH*

debug1: Enabling compatibility mode for protocol 2.0

debug1: Local version string SSH-2.0-OpenSSH_5.2

debug1: SSH2_MSG_KEXINIT sent

debug1: SSH2_MSG_KEXINIT received

debug1: kex: server->client aes128-ctr hmac-md5 none

debug1: kex: client->server aes128-ctr hmac-md5 none

debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent

debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP

debug1: SSH2_MSG_KEX_DH_GEX_INIT sent

debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY

debug1: Host 'vmcode' is known and matches the RSA host key.

debug1: Found key in /Users/Antemis/.ssh/known_hosts:3

debug1: ssh_rsa_verify: signature correct

debug1: SSH2_MSG_NEWKEYS sent

debug1: expecting SSH2_MSG_NEWKEYS

debug1: SSH2_MSG_NEWKEYS received

debug1: SSH2_MSG_SERVICE_REQUEST sent

debug1: SSH2_MSG_SERVICE_ACCEPT received

debug1: Authentications that can continue: publickey,password

debug1: Next authentication method: publickey

debug1: Offering public key: /Users/Antemis/.ssh/id_dsa

debug1: Server accepts key: pkalg ssh-dss blen 434

debug1: Authentication succeeded (publickey).

debug1: channel 0: new [client-session]

debug1: Requesting no-more-sessions@openssh.com

debug1: Entering interactive session.

debug1: Sending command: /usr/bin/gdb --interp=mi1 -q

GNU gdb (GDB) 7.6.1-ubuntu
Copyright (C) 2013 Free Software Foundation, Inc.
Loading program into debugger…
No symbol "auto" in current context.
No symbol "auto" in current context.
No symbol "inferior" in current context.
No symbol "inferior" in current context.
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 "i686-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Program loaded.
Undefined MI command: mi-verify-command
Unable to set breakpoint -mi-verify-command file-fix-file-is-grooved. Make sure to build the file -mi-verify-command file-fix-file-is-grooved with debugging symbols.
cd '/home2/antemis/test_gdb/bin/'
'/home2/antemis/test_gdb/bin/': Aucun fichier ou dossier de ce type.
(gdb) run
Running…
*running,thread-id="all"
Undefined MI command: pid-info
Undefined MI command: pid-info
(gdb)
Et bien sûr, ca ne s'arrete pas sur mon point d'arrêt.

NB : par contre, si je lance une console et je fais un ssh <machine> 'gdb /home2/antemis/test_gdb'
je peux le debugger (via la console), mais c'est possible...

Du coup, quelqu'un aurait une solution pour que je puisse le faire dans xcode ? (Que XCode s'arrete sur mon point d'arrêt, le process tournant sous linux ?)

Merci beaucoup pour vos réponses !!!