Ah good spot, I'd started going down the path of tidying up the 6.3 version but Alfkil's Spotless one looks nicer, using APIs like IMMU->GetPhysicalAddress() rather than doing the relocation stuff by hand. I'll copy/steal that idea
@billifish When I talked with Alfkil a few weeks ago about all sort of things, he says that he coded Spotless exactly for the reasons people can "steal" his code in "normal" debuggers :) So I am sure he will be more than happy to know that things back to the GDB in end :)
And we basically better to refer to SpotLess with stealing all other ideas, as Alfkil spend quite a lot of time with all this, and do all probably in most proper for today realms way (and he was in contact with kernel devs, so surely he's code is one to refer).
Btw, related to the x5000 issue with old GDB when we set a breakpoint and then instead of a break, we catch a "SIGBUS signal, bus error". I enabled debug in old-working-on-other-platforms GDB, and that the output we had on x5000:
target_fetch_registers (r1) = 65341d10 0x65341d10 1697914128
Breakpoint 1, main () at test.c:3
3 {
target_create_inferior (RAM Disk:test_dwarf2, , xxx, 1)
Current language: auto; currently minimal
(gdb)
See, in target_wait() , x5k received "signal = SIGBUS" while on peg2 we receive there "signal = SIGTRAP". Also on x5k status = 1640258176, while on peg2 status = 1750208704 whatever it means ..
So what did it means at all :)? That on x5k signals messed up? Probably we can find out the answer after breakpoint_insert added, then we can add printfs to signals handling to see wtf happens. I very much hope it will be possible to work around it without the need for fixes in the kernel.
See, in target_wait() , x5k received "signal = SIGBUS" while on peg2 we receive there "signal = SIGTRAP". Also on x5k status = 1640258176, while on peg2 status = 1750208704 whatever it means ..
So what did it means at all :)? That on x5k signals messed up? Probably we can find out the answer after breakpoint_insert added, then we can add printfs to signals handling to see wtf happens. I very muych hope it will be possible to work around it without the need for fixes in the kernel.
Could well be. Once I've got the debug hook and breakpoint code in which will be pretty quick to do, it's just finding the time, then we can see. The trap_to_signal () function may need to be adapted for the x5000 possibly.
@billyfish Damn, was in hope you were already done with when found that you answer in the topic :) Hope it will not take long, monitoring that topic and your github acc every day.
I can't currently get on my amiga to test whether it works but I've uploaded a version with some "possible working" breakpoint code in there I've tried to integrate what Aflkil does in Spotless.
Once I've got a new hard drive in there I'll be able to boot up my amiga and check whether it actually works!
Hi, what attribs/tags do I need to add to compile a simple helloworld.c so it can be used with your GDB?
Now I use: ppc-amigaos-gcc helloworld.c -o helloworld -gstabs -Wall
'cos I get: #SDK:C/gdb helloworld _initialize_amigaos_nat [New inferior 0] GNU gdb (GDB) 7.5.1 Copyright (C) 2012 Free Software Foundation, Inc. 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 "ppc-amigaos". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /Devel/SDK/ejemplos/helloworld...target_terminal_ours () I'm sorry, Dave, I can't do that. Symbol format `elf32-amiga' unknown. (gdb) quit quit target_close (1) target_close (0) #
@jabirulo I will be at home tomorrow so can check, but at first, you may try the previous commit from billfish's repo which 100% works for loading binaries.
@billyfish Tried latest commits: there at first copy+paste error in the "Add breakpoint function": print says "trying to remove" instead of "trying to insert". But that just a minor copy+paste error.
Next, I tried on x5000 firstly, that what we have on the serial:
3/0.Work:aa> gdb_751_commit_43 -q test
_initialize_amigaos_nat
[New inferior 0]
Reading symbols from /Work/aa/test...done.
(gdb) break 1
break 1
target_memory_map ()
target_get_section_table ()
exec:target_xfer_partial (2, (null), 0x6192f038, 0x0, 0x10004d4, 4) = 4, bytes = 3d 20 01 00
target_get_section_table ()
exec:target_xfer_partial (2, (null), 0x6192f108, 0x0, 0x10004d4, 4) = 4, bytes = 3d 20 01 00
target_get_section_table ()
exec:target_xfer_partial (2, (null), 0x6192f458, 0x0, 0x10004d4, 4) = 4, bytes = 3d 20 01 00
target_get_section_table ()
exec:target_xfer_partial (2, (null), 0x6192f6d0, 0x0, 0x10004d4, 4) = 4, bytes =
3d 20 01 00
Breakpoint 1 at 0x10004d4: file test.c, line 1.
(gdb) r
r
t: PowerPC PPCBug monitor on port 0
t: PowerPC PPCBug monitor on port 1
t: DINK32 monitor
t: Debug an Amiga process
amigaos_can_run returning 1
t: Remote serial target in gdb-specific protocol
t: Extended remote serial target in gdb-specific protocol
t: Local trace dump file
t: Local core dump file
t: Local exec file
t: Process record and replay target
t: Process record and replay target
Starting program: /Work/aa/test
t: PowerPC PPCBug monitor on port 0
t: PowerPC PPCBug monitor on port 1
t: DINK32 monitor
t: Debug an Amiga process
amigaos_can_run returning 1
t: Remote serial target in gdb-specific protocol
t: Extended remote serial target in gdb-specific protocol
t: Local trace dump file
t: Local core dump file
t: Local exec file
t: Process record and replay target
t: Process record and replay target
[New process 1726860704]
target_create_inferior (/Work/aa/test, , xxx, 1)
target_terminal_ours ()
target_get_section_table ()
subtask:target_xfer_partial (10, target.xml, 0x64e78fd8, 0x0, 0x0, 4095) = -1
target_thread_architecture (process 1726860704) = 0x617b8f30 [powerpc:common]
ptid_equal (null_ptid, ptid (1726860704, 0,0)
pid 1726860704 for ptid (1726860704, 0,0)
get_thread_arch_regcache (process 1726860704) = 0x617c26c8
ptid_equal (null_ptid, ptid (1726860704, 0,0)
pid 1726860704 for ptid (1726860704, 0,0)
get_thread_arch_regcache (process 1726860704) = 0x617c26c8
target_fetch_registers (pc) = 00000000 0x0 0
target_get_section_table ()
subtask:target_xfer_partial (11, (null), 0x64e79430, 0x0, 0x0, 4095) = -1
target_memory_map ()
target_get_section_table ()
subtask:target_xfer_partial (2, (null), 0x6192f2f8, 0x0, 0x10004d4, 4) = 4, bytes = 3d 20 01 00
ptid_equal (null_ptid, ptid (1726860704, 0,0)
pid 1726860704 for ptid (1726860704, 0,0)
get_thread_arch_regcache (process 1726860704) = 0x617c26c8
ptid_equal (null_ptid, ptid (1726860704, 0,0)
pid 1726860704 for ptid (1726860704, 0,0)
get_thread_arch_regcache (process 1726860704) = 0x617c26c8
target_insert_breakpoint (0x010004d4, xxx) = 0
ptid_equal (null_ptid, ptid (1726860704, 0,0)
pid 1726860704 for ptid (1726860704, 0,0)
get_thread_arch_regcache (process 1726860704) = 0x617c26c8
ptid_equal (null_ptid, ptid (1726860704, 0,0)
pid 1726860704 for ptid (1726860704, 0,0)
get_thread_arch_regcache (process 1726860704) = 0x617c26c8
t: PowerPC PPCBug monitor on port 0
t: PowerPC PPCBug monitor on port 1
t: DINK32 monitor
t: Debug an Amiga process
amigaos_can_run returning 1
t: Remote serial target in gdb-specific protocol
t: Extended remote serial target in gdb-specific protocol
t: Local trace dump file
t: Local core dump file
t: Local exec file
t: Process record and replay target
t: Process record and replay target
target_terminal_inferior ()
target_resume (-1, continue, 0)
t: PowerPC PPCBug monitor on port 0
t: PowerPC PPCBug monitor on port 1
t: DINK32 monitor
t: Debug an Amiga process
asdf
amigaos_can_run returning 1
t: Remote serial target in gdb-specific protocol
t: Extended remote serial target in gdb-specific protocol
t: Local trace dump file
t: Local core dump file
t: Local exec file
t: Process record and replay target
t: Process record and replay target
target_wait (-1, status) = 1726860704, status->kind = exited, status = 0
target_terminal_ours ()
[Inferior 1 (process 1726860704) exited normally]
target_close (0)
target_mourn_inferior ()
target_terminal_ours ()
(gdb)
At this point "break" didn't break. I.e. all execution continue till the end, without stopping on my breakpoint.
Then I tried also on pegasos2 just in case and the same result. So it's not an x5k specific issue for now: on both platforms breakpoints sets, but the process didn't stop, so we can checking registers, stack, doing "steps", etc.
@Javier You just need to copy+paste things from readme, i.e.:
cd gdb-7.5.1
mkdir gdb-build
cd gdb-build
../configure --host=ppc-amigaos --target=ppc-amigaos --build=x86_64 --disable-nls --disable-werror --disable-sim LDFLAGS="-lunix"
make -j4
But for now, testing will make no big sense anyway, as breakpoints seem not works at the moment. I.e. they seem installed, but the process didn't pause as I can see from the log, and instead continue till the end.
@billifish
Btw, do you think we need "debug interrupts to work" there in GDB at this point? I mean, to have the ability to use just software breakpoints (which we tried to do now)? I think no? I just fear that debug-interrupts don't work on x5000 at all currently.
gdb/exec.c : added amigaos4 file attach hook the same as were done in 6.3a before. Making also exec_seglist in gdb/amigaos-nat.c/amigaos_create_inferior be not NULL, so we can go futher
But for now, testing will make no big sense anyway, as breakpoints seem not works at the moment. I.e. they seem installed, but the process didn't pause as I can see from the log, and instead continue till the end.
Ack, was worth a try but I couldn't test the code to check so hopefully it's a simple fix to get it working. I should have a new hard drive in the next day or two so I'll then be able to get my amiga working again as it has had to donate its hard drive to the computer I use for work.
Quote:
Btw, do you think we need "debug interrupts to work" there in GDB at this point? I mean, to have the ability to use just software breakpoints (which we tried to do now)? I think no? I just fear that debug-interrupts don't work on x5000 at all currently.
They're definitely something I want to get working, basically if a program crashes when running under GDB it will be the debug interrupt that will be called and stop the program at that point so you can inspect what is wrong. It requires the breakpoint code to be working first so that's the priority
As for the X5000, I hope it will work but I'll be relying on you for testing as I've just got an X1000
@jabirulo
The error message that you were getting was in the bfd part of the code and unless I've done something really stupid, which is always possible , the last few commits shouldn't have affected that as I haven't been touching that part of the code.
If you run sashimi, it should produce a debug output which will hopefully give more of an insight.
The only thing that I can think of that you're doing differently is that you're building it on Cygwin and I'm on Linux, I'm not sure what Roman is using. This might what the problem is as the code that builds gdb uses sed sometimes to get certain functions to add to gdb's automatically-generated code and this normally is at the start of a line, so it might be a line terminator issue?
The error message that you were getting was in the bfd part of the code and unless I've done something really stupid, which is always possible, the last few commits shouldn't have affected that as I haven't been touching that part of the code.
No no, I tested your latest commit today: all builds and works as expected (i.e. binary loads, etc and breakpoints do not work as I wrote). But it definitely runs and loads up binaries as before.
On my side I use Cygwin.
My bet that Javier may try to build it differently (i.e. configure part), and that can be the reason for failure.
No no, I tested your latest commit today: all builds and works as expected (i.e. binary loads, etc and breakpoints do not work as I wrote). But it definitely runs and loads up binaries as before.
phew!
Quote:
On my side I use Cygwin.
My bet that Javier may try to build it differently (i.e. configure part), and that can be the reason for failure.
#SDK:C/gdb helloworld _initialize_amigaos_nat [New inferior 0] GNU gdb (GDB) 7.5.1 Copyright (C) 2012 Free Software Foundation, Inc. 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 "ppc-amigaos". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /Devel/SDK/ejemplos/helloworld...done. (gdb) list list target_memory_map () target_get_section_table () exec:target_xfer_partial (2, (null), 0x58eb4488, 0x0, 0x10004d4, 4) = 4, bytes = 3d 20 01 00 target_get_section_table () exec:target_xfer_partial (2, (null), 0x58eb4558, 0x0, 0x10004d4, 4) = 4, bytes = 3d 20 01 00 1 ;/* 2 ppc-amigaos-gcc helloworld.c -o helloworld -gstabs -Wall 3 quit 4 */ 5 6 #include <stdio.h> 7 8 int main(void) 9 { 10 printf("asd\n"); (gdb)
Edited by jabirulo on 2021/3/22 13:15:26 Edited by jabirulo on 2021/3/22 13:16:43