Implementation of debugger using INT 3
Posted: Wed Nov 27, 2019 8:37 am
Dear.
I would like to have a minimal debugger implemented as the software-generated breakpoint for my OS.
What I try to implement is a function to generate a breakpoint and look at some variables in my C code.
for instance:
What I have read is that I should know exactly in which memory address, I have to put the INT 3.
The question is that which strategies should I follow for this reason?
Is it good to have the address of variable n (i.e. int* m = &n;) and set the INT 3 at that particular address?
In the end I need it for variables changing in a large loop. Perhaps simply using printf would not be a good way.
Best regards.
Iman.
I would like to have a minimal debugger implemented as the software-generated breakpoint for my OS.
What I try to implement is a function to generate a breakpoint and look at some variables in my C code.
for instance:
Code: Select all
void do_something(void)
{
int n = 0;
n += 10;
// here comes the function call to generate the breakpoint to look at the value of the variable n
[...]
}
The question is that which strategies should I follow for this reason?
Is it good to have the address of variable n (i.e. int* m = &n;) and set the INT 3 at that particular address?
In the end I need it for variables changing in a large loop. Perhaps simply using printf would not be a good way.
Best regards.
Iman.