User forums > General (but related to Code::Blocks)

Breakpoints in assembly code

(1/4) > >>

druizm:
Hello,

I would like to add a breakpoint in my assembly code. My project is composed by two files: one C file and one ASM file. I compile asm file with "nasm -g -f elf64" and c file with "gcc -g -O0 -o". Project compiles OK and, then, I can debug it. If I add a breakpoint in my c source code, when I run "Debug" execution stops at the line that contains the breakpoint in the c file. However, if I remove that breakpoint and add another one in one "mov" line in the asm file, the debug execution stops at the line that calls the asm file from the c file, but NOT ENTER into the asm file.

Could anybody help me?

Thanks

oBFusCATed:
What is the output of  command "info breakpoints" (you can execute it in the debugger's log)?
Are you sure nasm could produce compatible debug symbols?
What OS are you using?

druizm:
If I execute "info breakpoints" from the Debugger tab (during debugging), I receive this information:

--- Quote ---> info breakpoints
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   0x00007ffff7b32920 exception throw
2       breakpoint     keep y   0x00000000004005c1 /root/CodeBlocks-workspace/Test/assembler.asm:21
   breakpoint already hit 1 time
In arand.cont () ()
#2  0x0000000000400668 in main () at /root/CodeBlocks-workspace/Test/Test-manual-Tomas.c:25
/root/CodeBlocks-workspace/Test/Test-manual-Tomas.c:25:483:beg:0x400668
At /root/CodeBlocks-workspace/Test/Test-manual-Tomas.c:25
--- End quote ---

So it seems debugger detects correctly breakpoint located within the asm file, but execution stops at C code and not jumps to ASM code, so F7 (Next Line) execute all line in asm code but remains at the same line in C code (it's a function in assembler code), so I can't debug line-by-line after breakpoint inside the asm code.

I can't know if nasm is producting compatible debug symbols. My CodeBlocks configuration for asm file is this:

--- Quote ---Command line macro:
nasm -g -f elf64 -o obj/Debug/$file_name.o $file
--- End quote ---

so I suppose nasm is generating compatible debug symbols.

I'm running CodeBlocks 17.12 in a CentOS-7_x86_64

Thanksk.

druizm:
I don't know what I have reconfigured in my CodeBlocks user interface (options) but I have seen this message when I run F7:
"Cannot find bounds of current function"

Could be that message the reason I can't debug line-by-line inside assembler code?

Thanks.

oBFusCATed:
This probably means that you nasm compiler has failed to generate a proper frame info for your asm function or something similar. Does stepping using the instruction commands? Does breaking on an address works?

Navigation

[0] Message Index

[#] Next page

Go to full version