Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS-UAE hangs during startup of a.exe #199

Closed
gylead opened this issue Jan 3, 2023 · 20 comments
Closed

FS-UAE hangs during startup of a.exe #199

gylead opened this issue Jan 3, 2023 · 20 comments

Comments

@gylead
Copy link

gylead commented Jan 3, 2023

When I run the "template" project from VS Code, fs-uae hangs when running a.exe. There is no difference if I run the program using F5 or Ctrl-F5. I have to kill fs-uae hard (kill -9).

If I remove the remote debugger configuration lines from the config file and run fs-uae from the command line it works well.

  • VS Code version 1.74.2
  • extension version v1.6.8
  • Ubuntu 20.04

Any idea what I should check? The log file ends with the following lines, nothing special. It looks like not everything is written to the file.

=KS ROM v1.3 (A3000)(SK) rev 34.5 (256k)
mousehack_reset
PAL mode V=50.0804Hz H=15625.0879Hz (227x312+0) IDX=10 (PAL) D=0 RTG=0/0
draw outwidth/height = 752x574
Buffer size (752*574) Native
[DRAWING] init_aspect_maps
[DRAWING] init_row_map (maybe)
[DRAWING] init_row_map rowbytes=3016
reset_custom_limits
RTGFREQ: 312*50.0804 = 15625.0879 / 50.1 = 312
[FSE] [AUD] Resume audio (FIXME!)
gfx_set_picasso_state monid=0 on=0
[DRAWING] init_aspect_maps
[DRAWING] init_row_map (maybe)
[DRAWING] init_row_map rowbytes=3016
reset_custom_limits
Autoconfig board list:
Card 01: 'UAE Boot ROM' no autoconfig 00f00000 - 00f0ffff.
Card 02: 'UAE FS ROM'
  d1.52.40.00.07.db.00.00.00.03.20.00.00.00.00.00
  MID 2011 (07db) PID 82 (52) SER 00000003
  Z2 0x00e90000 0x00e90000   64K ROM 0
END
Card 0: skipping autoconfig (not autoconfig)
CPU cycleunit: 256 (0.500)
hardreset, memory cleared
init_sound
open_sound returning 1
SNDRATE 312.0*227.0*50.080410=3546895.000000
[FSE] [FRM] Emulation frame rate is now 50.080410 Hz
[FAE] [   ] [INPUT] Got port change event port_index=0 mode_index=2
amiga_set_joystick_port_mode port=1 mode=2
handle_custom_action 2263
[FAE] [   ] [INPUT] Got port change event port_index=1 mode_index=1
amiga_set_joystick_port_mode port=0 mode=1
handle_custom_action 2272
[DRAWING] init_row_map (maybe)
[DRAWING] init_row_map rowbytes=3016
[FSE] [INP] fsemu_inputport_set_mode_index 2 for port: Joystick Port 1
[FSE] [INP] fsemu_inputport_set_mode_index 1 for port: Joystick Port 0
Illegal instruction: 4e7b at 00FC0564 -> 00FC0582
SERIAL: period=372, baud=9600, hsyncs=14, bits=8, PC=fc2234
MMAN: mapped_malloc 0x00000000 start=0x00e90000 Filesystem autoconfig (*)
MMAN: Flags: IO SAFE
mapped_malloc nodirect Filesystem autoconfig 0x7f464488db50
Card 2: Z2 0x00e90000   64K ROM Filesystem autoconfig
Memory map after autoconfig:
00000000    2048K/4 =     512K ID* C16 Chip memory
00200000    8192K/0 =    8192K --  F16 <none>
00A00000    2048K/0 =    2048K --  CIA CIA
00C00000     512K/1 =     512K ID* C16 Slow memory
00C80000    1024K/0 =    1024K --  C16 Custom chipset
00D80000     256K/0 =     256K --  C16 <none>
00DC0000      64K/0 =      64K --  C16 Battery backed up clock (MSM6242B)
00DD0000      64K/0 =      
@BartmanAbyss
Copy link
Owner

@grahambates

@BartmanAbyss
Copy link
Owner

Anything in the output window? Maybe gdb failed to launch and FS-UAE just waits for a connection?

@grahambates
Copy link
Contributor

Is that the entire log output?
i.e. is the last line actually cut off like that?

@grahambates
Copy link
Contributor

All the above output is way before the GDB server starts waiting for a connection. @gylead can you see if the bundled fs-uae binary starts ok if you run it directly outside of vscode?

@gylead
Copy link
Author

gylead commented Jan 4, 2023

Yes, that is the end of the logfile. Cut in the middle of a log line, isn't it?

The bundled fs-uae runs perfectly from the command line using the applied default config as long as I remove the remote-debugger config lines. The Abyss template program as it was compiled by VS Code runs perfectly.

If I keep the remote debugger lines in the config file it also hangs when I start fs-uae from command line.

So, even that the log file is not complete, I assume the hanging fs-uae is related to the remote debugger feature.

@gylead
Copy link
Author

gylead commented Jan 6, 2023

I have some more information:

When I run the program with F5 using Configuration "AROS", the fs-uae and the gdb are both started. But the debugger doesn't stop on any breakpoint which I have set.

When I run the program with F5 using Configuration "A500" (or "A1200"), the fs-uae is started but gdb is not.

When I copy the "kickstart" config line from configuration "A500" into "AROS", I see the same problem as with original configuration "A500".

@gylead
Copy link
Author

gylead commented Jan 6, 2023

Question: I am using kickstart files that need the "rom.key" otherwise fs-uae cannot load the kickstart files. Might that be related to this issue?

@grahambates
Copy link
Contributor

This sounds like it could be similar or related to #193.

Can you see if the issue still occurs on current master with the unreleased fix?

@gylead
Copy link
Author

gylead commented Jan 6, 2023

I did the following:

  • clone master
  • run npm install
  • open directory "vscode-amiga-debug"
  • verified that the timeout-change is present in amigaDebug.ts (it is!)
  • enabled DEBUG=true
  • and pressed F5. VS Code was opened
  • Opened the folder with the test program
  • Pressed F5 with configuration A500.
  • fs-uae still hangs and no gdb ist started. I definetly verified this before the 10 second timeout
  • In the DEBUG CONSOLE of the first VS Code I got the following output:
activating extension
starting language server
(node:42616) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `code --trace-deprecation ...` to show where the warning was created)
updateCustomBrowseConfiguration
updateCustomBrowseConfiguration
rejected promise not handled within 1 second: RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 262153. Received 262154
stack trace: RangeError: The value of "offset" is out of range. It must be >= 0 and <= 262153. Received 262154
	at new NodeError (node:internal/errors:371:5)
	at boundsError (node:internal/buffer:86:9)
	at Buffer.readInt16BE (node:internal/buffer:506:5)
	at new Kickstart (/home/jochen/projects/3rd_party/vscode-amiga-debug/dist/extension.js:21714:27)
	at AmigaDebugSession.launchRequest (/home/jochen/projects/3rd_party/vscode-amiga-debug/dist/extension.js:11260:31)
	at process.processTicksAndRejections (node:internal/process/task_queues:96:5)

What else can I check? Can I find an error log for the failing startup of the gdb somewhere?

@grahambates
Copy link
Contributor

Ok thanks for this, the stack trace is really useful. It does look like it might be something specific to your kickstart ROM. I'll look into it properly in a bit.

@BartmanAbyss
Copy link
Owner

Hmm maybe my code still tries to do something with the kickstart and fails because it is encrypted? I never tried anything with encrypted kickstarts.

@BartmanAbyss
Copy link
Owner

I‘ll have a look at it tomorrow.

@gylead
Copy link
Author

gylead commented Jan 6, 2023

I got the kickstarts from a Cloanto CD I bought many years ago. I don't know if the kickstarts are still encrypted nowadays but at that time it was needed for some licensing reasons AFAIK.

@BartmanAbyss
Copy link
Owner

BartmanAbyss commented Jan 6, 2023

As a workaround for now, Can you try with some non-encrypted kickstart? Easily found with google.

@gylead
Copy link
Author

gylead commented Jan 7, 2023

With a non-encrypted kickstart it runs the program - as long as I do not set any breakpoint. With version1.6.8 I get an timeout error for gdb, with master gdb also does not stop onbreakpoint and I get the following output in DEBUG CONSOLE:

From client: initialize({"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"amiga","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"de","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true,"supportsArgsCanBeInterpretedByShell":true,"supportsMemoryEvent":true})
To client: {"seq":0,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsHitConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsConditionalBreakpoints":true,"supportsFunctionBreakpoints":true,"supportsDataBreakpoints":true,"supportsEvaluateForHovers":true,"supportsSetVariable":true,"supportsRestartRequest":true,"supportsReadMemoryRequest":true,"supportsWriteMemoryRequest":true}}
From client: launch({"type":"amiga","request":"launch","preLaunchTask":"compile","name":"Amiga 500","config":"A500","program":"/home/jochen/projects/amiga/vs-code/test1/out/a","kickstart":"/home/jochen/FS-UAE/Kickstarts/kick13.rom","internalConsoleOptions":"openOnSessionStart","__configurationTarget":6,"debugServer":39905,"__sessionId":"31af1847-79bf-486d-8eec-78a5b092265c"})
To client: {"seq":0,"type":"event","event":"initialized"}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"log","output":"=> 1-gdb-set mi-async on\n"}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"log","output":"=> 2-enable-pretty-printing\n"}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"log","output":"=> 3-interpreter-exec console "target remote localhost:2345"\n"}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"log","output":"=> 4-interpreter-exec console "info file"\n"}}
From client: setBreakpoints({"source":{"name":"main.c","path":"/home/jochen/projects/amiga/vs-code/test1/main.c"},"lines":[363],"breakpoints":[{"line":363}],"sourceModified":false})
From client: setFunctionBreakpoints({"breakpoints":[]})
From client: setDataBreakpoints({"breakpoints":[]})
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"log","output":"removeBreakpoints\n"}}
To client: {"seq":0,"type":"response","request_seq":5,"command":"setDataBreakpoints","success":true,"body":{"breakpoints":[]}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"log","output":"<= =thread-group-added,id="i1"\n~"Reading symbols from /home/jochen/projects/amiga/vs-code/test1/out/a.elf...\n"\n"}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"console","output":"Reading symbols from /home/jochen/projects/amiga/vs-code/test1/out/a.elf...\n"}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"log","output":"<= &"\nwarning: "\n&"Section .debug_aranges in /home/jochen/projects/amiga/vs-code/test1/out/a.elf entry at offset 112 has unsupported version 3, ignoring .debug_aranges.\n"\n(gdb) \n"}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"log","output":"\nwarning: \n"}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"log","output":"Section .debug_aranges in /home/jochen/projects/amiga/vs-code/test1/out/a.elf entry at offset 112 has unsupported version 3, ignoring .debug_aranges.\n"}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"log","output":"<= 1^done\n(gdb) \n2^done\n(gdb) \n"}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"log","output":"<= &"localhost:2345: Connection timed out.\n"\n"}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"log","output":"localhost:2345: Connection timed out.\n"}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"log","output":"<= 3^error,msg="localhost:2345: Connection timed out."\n(gdb) \n~"Symbols from \"/home/jochen/projects/amiga/vs-code/test1/out/a.elf\".\n"\n~"Local exec file:\n"\n~"\t/home/jochen/projects/amiga/vs-code/test1/out/a.elf', file type elf32-m68k.\\n\"\n~\"\\tEntry point: 0x0\\n\"\n~\"\\t0x00000000 - 0x0000175e is .text\\n\"\n~\"\\t0x0000175e - 0x00001830 is CODE\\n\"\n~\"\\t0x00001830 - 0x000033fa is .rodata\\n\"\n~\"\\t0x000033fa - 0x0000347a is .MEMF_CHIP\\n\"\n~\"\\t0x00004000 - 0x00004000 is .data\\n\"\n~\"\\t0x00004000 - 0x00012b7d is .INCBIN.MEMF_CHIP\\n\"\n~\"\\t0x00012b80 - 0x00012ba8 is .bss\\n\"\n4^done\n(gdb) \n"}} To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"console","output":"Symbols from \"/home/jochen/projects/amiga/vs-code/test1/out/a.elf\".\n"}} To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"console","output":"Local exec file:\n"}} To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"console","output":"\t/home/jochen/projects/amiga/vs-code/test1/out/a.elf', file type elf32-m68k.\n"}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"console","output":"\tEntry point: 0x0\n"}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"console","output":"\t0x00000000 - 0x0000175e is .text\n"}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"console","output":"\t0x0000175e - 0x00001830 is CODE\n"}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"console","output":"\t0x00001830 - 0x000033fa is .rodata\n"}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"console","output":"\t0x000033fa - 0x0000347a is .MEMF_CHIP\n"}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"console","output":"\t0x00004000 - 0x00004000 is .data\n"}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"console","output":"\t0x00004000 - 0x00012b7d is .INCBIN.MEMF_CHIP\n"}}
To client: {"seq":0,"type":"event","event":"custom-output","body":{"category":"console","output":"\t0x00012b80 - 0x00012ba8 is .bss\n"}}
To client: {"seq":0,"type":"response","request_seq":2,"command":"launch","success":true}
To client: {"seq":63,"type":"response","request_seq":2,"command":"launch","success":false,"message":"Failed to launch GDB: localhost:2345: Connection timed out. (from interpreter-exec console "target remote localhost:2345")","body":{"error":{"id":103,"format":"Failed to launch GDB: localhost:2345: Connection timed out. (from interpreter-exec console "target remote localhost:2345")","showUser":true}}}
From client: get-arguments(undefined)
To client: {"seq":0,"type":"response","request_seq":6,"command":"get-arguments","success":true,"body":{"type":"amiga","request":"launch","preLaunchTask":"compile","name":"Amiga 500","config":"A500","program":"/home/jochen/projects/amiga/vs-code/test1/out/a","kickstart":"/home/jochen/FS-UAE/Kickstarts/kick13.rom","internalConsoleOptions":"openOnSessionStart","__configurationTarget":6,"debugServer":39905,"__sessionId":"31af1847-79bf-486d-8eec-78a5b092265c","endcli":false,"uaelog":true}}

@BartmanAbyss
Copy link
Owner

Crash has been fixed. I can only look at the Windows build. I just rebuilt the template project, set a breakpoint at main.c line 462, and it worked fine with the A500 configuration.

@gylead
Copy link
Author

gylead commented Jan 7, 2023

I pulled the change from master, opened the extension in VS Code and run it. Frmothe new VS Code I open the template project and start it. It stops at the breakpoint. Yeah!

When I continue the program and quit fs-uae, all looks good. But when I start it the second time, starting gdb times out. I have to quit VS Code and restart it to debug the program again.

@grahambates
Copy link
Contributor

Do you have the logs from when it times out the second time? Is it always the on second run and not just generally intermittent?

@gylead
Copy link
Author

gylead commented Jan 13, 2023

Sorry for late reply, I was very busy this week.

After I start VS Code (from within the other VS Code)the first run of the template project succeeds. The program stops at the first break point in main(). I can continue running with F5 and quit the program and fs-uae.

The second run fails. FS-uae starts and runs until it starts the program. But then it hangs. I have to stop the debugger and to kill -9 fs-uae.

The third run again succeeds. The firth run again fails. The fiveth run again succeeds. And so on.

First Run (Works).zip
Second Run (Fails).zip
Third Run (Works).zip

@grahambates
Copy link
Contributor

I'm pretty sure this is the same issue now being discussed in #193 and hopefully fixed in #197.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants