Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
132 user(s) are online (123 user(s) are browsing Forums)

Members: 1
Guests: 131

MartinW, more...

Support us!

Headlines

 
  Register To Post  

« 1 2 3 4 (5) 6 »
Re: DEbug 101
Home away from home
Home away from home


See User information
@Elwood

As far as i know, GDB will debug for you only binary on os4. I.e when process crashes, and if crash only in the library, then gdb can not be attached.

And even if GDB on os4 can debug .so, its imho cant debug .library at all.

That can be good addition if debug101 can debug later as well as .so, as well as .library :)

While debugging of .so can be done the same way as it done in GDB, for .library, we can go or almost the same way, or the way as Olly-debugger (win32) debug .dlls(why i say about dll, because it the same as .library in general):

1. you load program which use some .dll (of course dll and program should be compiled with debug info, for allow to do all those source-level debugging).

2. press alt+e , and you have window with all the libs (dll) which are used by your loaded binary to debuger.

3. choice any .dll, press enter, and you inside the dll code. Set breakpoint on anything you need, and then, run the main loaded program, and it will Breaks on DLL code, and you can debug it.

The same way can be done for .library on aos4, and while its nice addition (and will help developers pretty well) , i not sure how easy it will be to implement.

@alfkil
How hard you think will be add that ? I mean user load binary, and you have some button for list "libs" (or maybe list+sobjs) which used by binary. Then, choice any library/so will jump you on code of library (with debug info from), and then BP, run main program, and so on.

@all
Btw, i do not remember, but did any debugger on os3 debug libraryes ? SAS-C debugger maybe can do that ?

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: DEbug 101
Just can't stay away
Just can't stay away


See User information
@abalaban
Quote:
The advantage of GDB over DEbug 101 is that it can (theoretically) attach itself to an already running process, that's a huge thing IMHO


That is also going to be possible with db101 in the future.

@Elwood
Quote:
I'm not a expert but as far as I understand you can debug anything with GDB. When a process crashes, you attach the process to GDB and you can navigate forward or backward in your code.


Debugging of libraries is currently _not_ possible in the amigaos version of GDB. The reason for this is, that there is no API for it in the exec debug interface. If such an api is added, db101 will also be able to debug libraries.

Currently the only thing possible (with GDB or db101 when it is implemented) is to step through the assembly of the library or shared object, but it is not possible to read the debug info.

Go to top
Re: DEbug 101
Home away from home
Home away from home


See User information
@alfkil

Quote:

alfkil wrote:
Debugging of libraries is currently _not_ possible in the amigaos version of GDB. The reason for this is, that there is no API for it in the exec debug interface. If such an api is added, db101 will also be able to debug libraries.

Currently the only thing possible (with GDB or db101 when it is implemented) is to step through the assembly of the library or shared object, but it is not possible to read the debug info.


Why exactly do you need special support for it in the exec debug interface? When I get a crash in a test version of minigl.library, I can get the line number using addr2line (via minigl.library.debug as the actual library doesn't contain the debug symbols). It seems to me that all the required information is already available. All you need is a library with debug symbols (or a .debug file if you work the way that I do), and the source-code.

Obviously, if the library/shared-object has been stripped of debug symbols, and you don't have them in a separate file, then there will be no way to step through the source-code, but this is true of any executable.

How does the grim-reaper extract its information? It's pretty clear that it's there.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: DEbug 101
Home away from home
Home away from home


See User information
@alfkil
Tryed v0.7:

Loading of db101 binary to debuger give DSI:

Quote:

Trap type: DSI exception
Machine State (raw): 0x200f030
Machine State (verbose): [ExtInt on] [User] [FPU on] [IAT on] [DAT on]
Instruction pointer: in module kernel+0x19d6c (0x1819d6c)
Crashed process: db101 (0x65023b60)


That with usage of elf.library.kmod from quickfix update (which i use later for all the tests). Imho very possible that at this point only new beta-version of elf.library.kmod are need it ?

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: DEbug 101
Just can't stay away
Just can't stay away


See User information
@Hans

Ok, you have a point here and I'll have to modify my statement:

It IS possible _once you're inside the library_ to call IElf->OpenElf (OET_MemoryAddr, ...) and thereby get an elf handle, that you can then use to extract the debug info.

It is NOT possible to load up your executable and straight away set a breakpoint inside a shared object, because there is no way to get a list of elf handles to the shared objects used by your executable.

There IS a tag in the debug hook that allows you to know every time your executable loads a standard amigaos .library. But there is no such tag for shared objects. Also, if you attach yourself to an already running process, there is no way to get a list of already opened amigaos libraries.

I hope this clarifies things a bit.


Edited by alfkil on 2010/10/2 14:50:36
Go to top
Re: DEbug 101
Just can't stay away
Just can't stay away


See User information
@kas1e

Quote:
Loading of db101 binary to debuger give DSI:


Yeah... Typedef stuff was basically totally broken in v.0.7. I have uploaded v. 0.7.1, which (hopefully) solves the issue.

Go to top
Re: DEbug 101
Just popping in
Just popping in


See User information
@thread

Would a program like kcov be of any use ?

Kcov coverage tester

http://simonkagstrom.github.com/kcov/index.html

Go to top
Re: DEbug 101
Home away from home
Home away from home


See User information
@alfkil
Quote:

Yeah... Typedef stuff was basically totally broken in v.0.7. I have uploaded v. 0.7.1, which (hopefully) solves the issue.

Yep, now it loads fine. But now new bug is here: load hello-word binary, then "start" and it crashes with GR, with such stracktrace:
Quote:

Symbol info:
Instruction pointer 0x0193CF5C belongs to module "elf.library.kmod" (HUNK/Kickstart)

Stack trace:
native kernel module elf.library.kmod+0x00000f9c
native kernel module elf.library.kmod+0x00001190
native kernel module elf.library.kmod+0x000010d8
db101:close_elfhandle()+0x60 (section 1 @ 0x1a44)
db101:event_loop()+0x400 (section 1 @ 0x45fc)
db101:main()+0x2C (section 1 @ 0x214)
native kernel module newlib.library.kmod+0x00001f44
native kernel module newlib.library.kmod+0x00002bd8
native kernel module newlib.library.kmod+0x00002d54
db101:_start()+0x170 (section 1 @ 0x170)
native kernel module dos.library.kmod+0x0001b524
native kernel module kernel+0x0003ef08
native kernel module kernel+0x0003ef88

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: DEbug 101
Just can't stay away
Just can't stay away


See User information
@kas1e

Again I was a little too quick on the trigger, sorry! I have uploaded a new version, that also solves a problem when debugging db101 with itself .

Go to top
Re: DEbug 101
Home away from home
Home away from home


See User information
@alfkil
Quote:

Again I was a little too quick on the trigger, sorry! I have uploaded a new version, that also solves a problem when debugging db101 with itself :)

Yep, now all is fine here , thanks for fix :)

But found one more UI bug: pressing on the close gadget of main window, while disassemble window are active give a lockup. How to reproduce: load any binary, set any breakpoint, start, spawn disassemble window, and press close gadget in main window - debugger will quits, but disassemble window will still stay open, and after a while give lockup. All other windowses (registers, globals and so on) not have such problem.

Also when you press "generate stack trace" it give DSI by memguard at some stage, but i think its because that option are in progress. Anyway, reproducing are easy: select file hello word, and then press "generate stack trace" , give DSI with such output:
Quote:

Trap type: DSI exception
Machine State (raw): 0x200f030
Machine State (verbose): [ExtInt on] [User] [FPU on] [IAT on] [DAT on]
Instruction pointer: 0x7ec30700
Crashed process: db101 (0x667f9350)
DSI verbose error description: Access not found in hash or BAT (page fault)
Access was a load operation

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: DEbug 101
Just can't stay away
Just can't stay away


See User information
@kas1e

1) disassembler window bug has been fixed.

2) Stacktrace is junk, because I don't know how to do it. I'm waiting for help from os developer team (ssolie), but I think they are busy with other stuff.

3) There is a bug in the linker (dl) that leaves out a bunch of debug info from the final executable. What this means is, that if you are compiling multiple files into one executable, you are not going to be able to read the typedefs properly. So when the "Locals" or "Globals" windows just show you "UNKNOWN", this is _not_ my fault, it is a bug in the linker... Doh!

Go to top
Re: DEbug 101 (v.0.7)
Just popping in
Just popping in


See User information
@alfkil

I don't know if it's the info you're looking for, but for PPC EABI stackframes are single-linked in a chain, you can handle them using (e.g.) the following header:

Quote:

struct StackFrame
{
struct StackFrame *backChain;
uint32 savedLR;
uint32 dummy;
};


and of course you get the address of the first one in R1.

Go to top
Re: DEbug 101 (v.0.7)
Just can't stay away
Just can't stay away


See User information
@centaurz

Thanks, that might be very helpful .

Go to top
Re: DEbug 101
Amigans Defender
Amigans Defender


See User information
@alfkil
Sorry, haven't had much time to breath lately. AmiWest and related activities is taking up a majority of my time lately.

As for the debug symbols, make sure to use -gstabs especially for larger binaries.

ExecSG Team Lead
Go to top
Re: DEbug 101
Home away from home
Home away from home


See User information
@ssolie

Quote:

As for the debug symbols, make sure to use -gstabs especially for larger binaries.

Btw, there any other way that -g/-gstabs for adding debug information to binary ? As i know there is only one way (-g and -gstabs), which imho not matter large binary or small (if coder add -g or -gstabs , debug info should be provided without matter of size of binary imho). Also i think all the time that -g and -gstabs its absolutly the same (just -g its short version of -gstabs).

So, if alfkil have any debug info already, than imho mean that he already add that info by that -g/-gstabs.

Or i miss something here ?

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: DEbug 101
Just can't stay away
Just can't stay away


See User information
@kas1e & ssolie

-gstabs is already there, the problem is, that the linker leaves out any info from include files except for the very first file to be linked. Ot at least that's what I think is happening...

First I do this:

gcc -gstabs -S somefile.c

... and all the info is right there in place. Then I

gcc <the whole project> -o myproject

... and then I load myproject into db101. Then I print every stabstr there is, and all the include file data is now gone. Gone is therefore also any typedefs (and structures), that might occur inside one of the include files. This is nasty, and I sincerely hope, that someone can fix it...

Go to top
Re: DEbug 101
Home away from home
Home away from home


See User information
@alfkil

Are you add -gstabs on the linking stage ? I mean not

Quote:

gcc <the whole project> -o myproject


But

Quote:

gcc -gstabs <the whole project> -o myproject


I do it always like this. -g for all the objects, and -g for the whole binary too.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: DEbug 101
Just can't stay away
Just can't stay away


See User information
@kas1e

Yes, what I _meant_ to say was this:

Quote:

gcc -gstabs <the whole project> -o myproject


...which is what my makefile is saying. I'm pretty sure it's a bug in the liner, anything else wouldn't make sense.

Go to top
Re: DEbug 101
Just can't stay away
Just can't stay away


See User information
A fresh version (0.8) of db101 has been uploaded. See original post.

Go to top
Re: DEbug 101
Home away from home
Home away from home


See User information
@alfkil

Quote:

...which is what my makefile is saying. I'm pretty sure it's a bug in the liner, anything else wouldn't make sense.


Just as one more "maybe": maybe for testing purposes trying to do:

gcc -g -c somefile.c and then link to whole project ? (i mean not -S, but -c). Of course it should make no sense in the final result, but maybe ..

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top

  Register To Post
« 1 2 3 4 (5) 6 »

 




Currently Active Users Viewing This Thread: 3 ( 0 members and 3 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project