Socket Error when Debugging with Code::Blocks IDE (DreamSDK)

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
Squeakychu
DCEmu Newbie
DCEmu Newbie
Posts: 1
Joined: Sun Apr 05, 2020 7:32 pm
Has liked: 0
Been liked: 0

Socket Error when Debugging with Code::Blocks IDE (DreamSDK)

Post by Squeakychu » Fri Apr 10, 2020 12:36 am

Hello. I installed DreamSDK, along with its Code::Blocks IDE extension, and have been playing around with it for a while making Dreamcast projects in it and testing it on emulators/burned CDs until I got the parts needed to create a coders cable. Today, I was finally able to build myself a coders cable, and I've been giving dcload-serial a spin. I've configured the serial options as below in the DreamSDK manager (I wish I could set a higher baudrate in the dropdown menu since my FT232RL USB serial adapter can easily do 1500000 if dctools-serial is run with manual arguments in the custom tab, but I suppose that's for another topic).

Image

When I run the program through Code::Blocks with the release target, the program transfers to my Dreamcast and runs without error. However, when I try to run it through debug by setting the target to debug and clicking the red run button (Debug/Continue), the program transfers to my Dreamcast, but it seems to freeze immediately afterwards, and I get a socket error: 10053. Below is the entire log in the command line.
Starting a GDB server on port 2159
Console enabled
Alternate 115200 enabled
Changing speed to 115200 bps... done
Upload <C:/Dreamcast_Development/programs/OpenGL_Project/bin/Debug/OpenGL_Project.elf>
File format is elf32-shl, start address is 0x8c010000
Section .text, lma 0x8c010000, size 352480
send_data: CCCCCCCCCCCCCCCCCCCCCC
Section .init, lma 0x8c0660e0, size 54
send_data: U
Section .fini, lma 0x8c066118, size 42
send_data: U
Section .rodata, lma 0x8c066144, size 1789508
send_data: CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCUUUCCCCCC
Section .eh_frame, lma 0x8c21af88, size 4420
send_data: C
Section .gcc_except_table, lma 0x8c21c0cc, size 284
send_data: C
Section .ctors, lma 0x8c21c268, size 20
send_data: U
Section .dtors, lma 0x8c21c27c, size 8
send_data: U
Section .jcr, lma 0x8c21c284, size 4
send_data: U
Section .data, lma 0x8c21c2a0, size 12628
send_data: C
Section .got, lma 0x8c21f3f4, size 12
send_data: U
effective: 14506.93 bytes / sec
148.86 seconds to transfer 2159460 bytes
Executing at <0x8c010000>
Sending execute command (0x8c010000, console=1)...executing

--
KallistiOS Git revision v2.0.0-382-g79517f1:
  Thu Apr  9 19:15:58 EDT 2020
  Squeakychu@Win-Desktop:/opt/toolchains/dc/kos
maple: active drivers:
    Dreameye (Camera): Camera
    Sound Input Peripheral: Microphone
    PuruPuru (Vibration) Pack: JumpPack
    VMU Driver: Clock, LCD, MemoryCard
    Mouse Driver: Mouse
    Keyboard Driver: Keyboard
    Controller Driver: Controller
    Lightgun: LightGun
  DMA Buffer at ac464e00
vid_set_mode: 640x480 VGA
fs_romdisk: mounting image at 0x8c0662e0 at /rd
dc-load console support enabled
maple: attached devices:
  A0: Dreamcast Controller          (01000000: Controller)
CtorDtorTest::CtorDtorTest called
CtorDtorTest::CtorDtorTest called
waiting for gdb client connection...
Got socket error: 10053
This is the button I click on.
Image

I can't find anything on this issue online, and I have no idea if it's an issue with my code, my environment (Code::Blocks, Windows, etc), or an issue with my coders cable itself. I have the following code in my program, if that helps.

Code: Select all

#ifdef DEBUG
#include <arch/gdb.h>
#endif

int main(int argc, char *argv[]) {
#ifdef DEBUG
	/* This is needed for the Debug target.
	   Please don't remove this part of code if you want to use the Code::Blocks debugger.
	   Also, you'll need to configure Dreamcast Tool (dc-tool) from the DreamSDK Manager. */
	gdb_init();
	printf("Connection established to %s!", PROJECT_NAME);
#endif
If anyone knows what this error means, any insight would be greatly appreciated. Let me know if any more information is needed. Thanks!
User avatar
ThePerfectK
Insane DCEmu
Insane DCEmu
Posts: 128
Joined: Thu Apr 27, 2006 10:15 am
Has liked: 21 times
Been liked: 19 times

Re: Socket Error when Debugging with Code::Blocks IDE (DreamSDK)

Post by ThePerfectK » Mon Apr 13, 2020 3:34 am

It's not an issue with your cable, because it's sending data. If it was an issue with your cable, you would never get to the point. It appears to be a time out error, socket error 10053 occurs when an established connection is timed out. You mention your dreamcast seems to freeze, then you get this socket error. Is the socket error instant? Or does it hang on "waiting for gdb client connection" for a while, and then the socket error occurs? Because if it's the latter, what that means is you are timing out, gdb is being opened and waiting for a connection and I guess whatever IDE you are using is never actually opening sh-elf-gdb to the right port.

I don't use code::blocks or windows when programming, so deploying sh-elf-gdb on windows isn't something I normally do, so I can't really walk you through doing that. I'd suggest talking to SiZiOuS, he's active on twitter if not here, as well as obscuregamers. He could probably help you figure out how to launch sh-elf-gdb on windows.
Still Thinking!~~
Post Reply