Pelles C forum

Pelles C => General discussions => Topic started by: Freddy on August 20, 2007, 06:50:03 AM

Title: Source level debugger not working?
Post by: Freddy on August 20, 2007, 06:50:03 AM
Hi! I run the debugger and it shows the disassembly of my code, but no source level debugging.
What's wrong?

thanks
Title: Re: Source level debugger not working?
Post by: JohnF on August 21, 2007, 03:46:49 PM
Quote from: Freddy on August 20, 2007, 06:50:03 AM
Hi! I run the debugger and it shows the disassembly of my code, but no source level debugging.
What's wrong?

thanks

What have you set in "Project Options" on the compiler and linker tabs?

John
Title: Re: Source level debugger not working?
Post by: Freddy on August 21, 2007, 06:04:39 PM
I create a simple console app.
Then I go to project options, and add to debug information  "full" under compiler and codeview & COFF format under linker on debug information.
I click OK, the rebuild all files, and try to debug.
It opens the disassembly, instead of steping throught source.
Title: Re: Source level debugger not working?
Post by: Freddy on August 21, 2007, 06:21:25 PM
Solved.
I didn't know I had to check "break always" on the breakpoints tab.
Now works!

Anyway, I'll use this thread to ask something else.
While I'm debugging this code:

SOCKET sock, msock;
WSADATA wsa;
struct sockaddr_in saddr;
char buf[4096];
int len;

WSAStartup(MAKEWORD(1,1),&wsa);

sock = socket(AF_INET,SOCK_STREAM,0);
           memset(&saddr,'\0',sizeof(struct sockaddr_in));
saddr.sin_family=AF_INET;
saddr.sin_port=htons(80);
saddr.sin_addr.s_addr=inet_addr("66.94.233.46");
msock=connect(sock, (struct sockaddr *)&saddr,sizeof(struct sockaddr));
if(msock==0)
return -1;

msock is always 0, and so I can't use it. Why?
I'm trying to create a simple client, using winsock.

Thanks!
Title: Re: Source level debugger not working?
Post by: JohnF on August 21, 2007, 07:21:13 PM
msock=connect(sock, (struct sockaddr *)&saddr,sizeof(struct sockaddr));

According to MSDN returning 0 is correct for no error.

=============
Return Values
If no error occurs, connect returns zero. Otherwise, it returns SOCKET_ERROR, and a specific error code can be retrieved by calling WSAGetLastError.
=============

John