Software Archive
Read-only legacy content
17060 Discussions

How to debug assembly code in native mode

Deyang_Gu
Beginner
359 Views

Hi all,

I have a main function written in C and another function written in assembly using binutil assembler syntax (.s file). I can compile and run and debug the program with no problem but I cannot go into the function written in assembly code. I know there is no debug information in the .s file. But is it possible to go into it and run each instruction? I have tried nexti and stepi but no luck. Currently the only way is:

disassemble the main function, find the call instruction in main function and obtain the memory location for the instructions of the function written in assembly, set breakpoints at that location and for each instruction I have set one breakpoint so I can run single instruction in that way. This makes debugging such a nightmare...

My question is: is it possible for idbc to do this automatically? I mean, break the function written in assembly code and run single instruction at one time. Any help is greatly appreciated. Thank you very much!

Best

Deyang Gu

0 Kudos
2 Replies
Frances_R_Intel
Employee
359 Views

I am certainly no expert at debugging assembly but I would have expected stepi to work. Have you tried using gdb? The idbc debugger has gone into maintenance mode and from here on in, any fixes or new features will be put into gdb.

0 Kudos
Deyang_Gu
Beginner
359 Views

Frances Roth (Intel) wrote:

I am certainly no expert at debugging assembly but I would have expected stepi to work. Have you tried using gdb? The idbc debugger has gone into maintenance mode and from here on in, any fixes or new features will be put into gdb.

Yes. It actually works...I am sorry I made a silly mistake and asked such a stupid question...I am really sorry for that. 

The thing is, I need to run "disassemble Address1 Address2" so I can see all the instructions at the same time. Then by adding a breakpoint at the point of address1, I am able to use ni and si to navigate instruction by instruction.

I haven't got a chance to try gdb yet. I am not the system administrator and I don't even know if GDB is available now. The project is an intensive one. I will report again if I have a chance and time to try it. Thanks Frances.

Best

Deyang Gu

0 Kudos
Reply