Page 1 of 2

peter-bochs , a bochs gui debugger

Posted: Tue Nov 17, 2009 2:58 am
by mcheung63
peter-bochs , a bochs gui debugger

http://code.google.com/p/peter-bochs/

Re: peter-bochs , a bochs gui debugger

Posted: Tue Nov 17, 2009 12:44 pm
by stlw
mcheung63 wrote:peter-bochs , a bochs gui debugger

http://code.google.com/p/peter-bochs/
I didn't understand why it is Linux only if it is written in java ...

Stanislav

Re: peter-bochs , a bochs gui debugger

Posted: Tue Nov 17, 2009 1:30 pm
by mcheung63
Hi, In linux, i can send a command "kill -3" to pause bochs.
But In windows, there is not SIGINT can be send between process, so I don't know how to pause bochs :)

Re: peter-bochs , a bochs gui debugger

Posted: Tue Nov 17, 2009 2:09 pm
by ru2aqare
mcheung63 wrote:Hi, In linux, i can send a command "kill -3" to pause bochs.
But In windows, there is not SIGINT can be send between process, so I don't know how to pause bochs :)
I think you should open a process token via OpenProcess and call SuspendThread/ResumeThread on its threads. See http://www.codeproject.com/KB/threads/pausep.aspx for more.

Re: peter-bochs , a bochs gui debugger

Posted: Tue Nov 17, 2009 10:38 pm
by mcheung63
Thanks ru2aqare , after suspend the bochs debugger, it is just suspended (without responding), but cannot make bochs debugger get back to the command line.

thanks
from Peter

Re: peter-bochs , a bochs gui debugger

Posted: Thu Nov 19, 2009 2:59 pm
by stlw
mcheung63 wrote:Thanks ru2aqare , after suspend the bochs debugger, it is just suspended (without responding), but cannot make bochs debugger get back to the command line.

thanks
from Peter
BTW, if I add to Bochs a button (similar to reset and others) which will break Bochs into command line debugger - will it be good enough to support Win32 as well ?
The button called PAUSE could just PAUSE for case internal debugger isn't enabled (similar to effect CONFIG button pressed but with no dialogs opened) and break to debugger command line if it exists.

Stanislav

Re: peter-bochs , a bochs gui debugger

Posted: Fri Nov 20, 2009 8:43 am
by mcheung63
thanks for the concern. If you add a button, it will not help. My bochs gui create the bochs debugger process, sending the command through the pipeline. If I want to pause bochs, I create another process which is "killall -3 bochs", which will send SIGINT to bochs, then bochs paused.

In windows, there is no SIGINT, so I don't know how to pause bochs.

If you are willing to help, here is the solution: When I want to pause bochs, i place a file into the directory, if bochs debugger see this file exist, then pause itself and delete that file. sound stupid, but must work :)

thanks
from Peter

Re: peter-bochs , a bochs gui debugger

Posted: Fri Nov 20, 2009 12:04 pm
by ru2aqare
mcheung63 wrote:thanks for the concern. If you add a button, it will not help. My bochs gui create the bochs debugger process, sending the command through the pipeline. If I want to pause bochs, I create another process which is "killall -3 bochs", which will send SIGINT to bochs, then bochs paused.

In windows, there is no SIGINT, so I don't know how to pause bochs.

If you are willing to help, here is the solution: When I want to pause bochs, i place a file into the directory, if bochs debugger see this file exist, then pause itself and delete that file. sound stupid, but must work :)

thanks
from Peter
Why not modify/patch Bochs so that it receives commands from a named pipe? That would be the most straightforward solution. Or shared memory.

To continuously check for the existence of a file would - in my opinion - be a waste of resources and CPU cycles.

Re: peter-bochs , a bochs gui debugger

Posted: Fri Nov 20, 2009 1:25 pm
by stlw
Why not modify/patch Bochs so that it receives commands from a named pipe? That would be the most straightforward solution. Or shared memory.

To continuously check for the existence of a file would - in my opinion - be a waste of resources and CPU cycles.
Agree 100%.

I think the right way of dealing with Bochs should be through named pipe/socket using some protocol.
Ideal way of doing GUI for Bochs is RFB GUI - Bochs connecting with display viewer (VNC) through socket. Idea way of doing debugger is also placing Bochs in external binary and connect with Bochs using some "bochs debugger" protocol. This way anyone could develop any GUI for Bochs debugger using his favorite language - even for money.

The problem that I don't write any external debugger for Bochs so I am not a person to define such protocol.
And nobody else seems to be interested :(

Stanislav

Re: peter-bochs , a bochs gui debugger

Posted: Fri Nov 20, 2009 1:47 pm
by mcheung63
Stanislav, what part you are working with bochs?

Re: peter-bochs , a bochs gui debugger

Posted: Fri Nov 20, 2009 1:50 pm
by stlw
mcheung63 wrote:Stanislav, what part you are working with bochs?
What do you mean ?
Me and Volker are currently only developers in Bochs.
I do CPU and debugger and Volker all the rest :)
I still hope somebody will join us and take some part ...

Stanislav

Re: peter-bochs , a bochs gui debugger

Posted: Fri Nov 20, 2009 1:56 pm
by mcheung63
I feel amazing , why you know all the mechanism of cpu and write an emulator. Would you like to share this knowledge with us?

My personally opinion for bochs team is : enhance the debugger, the biggest advantage of bochs is just because it has a debugger, I believe many people think like me.

I added a memory search, see bottom http://code.google.com/p/peter-bochs/wiki/features

Re: peter-bochs , a bochs gui debugger

Posted: Fri Nov 20, 2009 2:16 pm
by stlw
I feel amazing , why you know all the mechanism of cpu and write an emulator.
That easy. Just few years of experience as x86 expert and CPU architect.
Would you like to share this knowledge with us?
This is that I do by writing emulator and answering questions here.
My personally opinion for bochs team is : enhance the debugger, the biggest advantage of bochs is just because it has a debugger, I believe many people think like me.
The problem that I personally almost not using the debugger. I am studying x86 architecture and software to make hardware CPUs better. That I need is instrumentation and only some small part of debugger. Also I hate doing GUI :)
So I prefer somebody else to take this job from me ...

BTW, your debugger GUI looks amazing to me and I would like to support it from inside.
But I have no idea how it works (because it is external app which doesn't(?) talk with Bochs) and if you need anything inside Bochs to make your life easier.
Bochs debugger could be extended significantly but we need people who will: a) use it b) report problems and ask for features c) take part in development.
Also, wouldn't you like to extend debugger to x86-64 ?
I added a memory search, see bottom http://code.google.com/p/peter-bochs/wiki/features
Saw it. Although I think page table corruption is better to be debugged using memory access tracing.
The only usage for search in memory I see - searching for ACPI or MP table signature in memory. It could be more useful if you will search for something larger inside memory - a string for example.

Stanislav

Re: peter-bochs , a bochs gui debugger

Posted: Sat Nov 21, 2009 9:10 am
by mcheung63
stlw wrote:
I feel amazing , why you know all the mechanism of cpu and write an emulator.
That easy. Just few years of experience as x86 expert and CPU architect.
This is very impossible. It is really really hard to know all the behaviour of intel CPU. I guess, you have a in-circuit-emulator, during the development of bochs, when you are not sure how cpu behaviour, you just use your ICE to emulate it. Am I right? If you are american, you should able to get a high paid job in Intel.
stlw wrote:
Would you like to share this knowledge with us?
This is that I do by writing emulator and answering questions here.
My personally opinion for bochs team is : enhance the debugger, the biggest advantage of bochs is just because it has a debugger, I believe many people think like me.
The problem that I personally almost not using the debugger. I am studying x86 architecture and software to make hardware CPUs better. That I need is instrumentation and only some small part of debugger. Also I hate doing GUI :)
So I prefer somebody else to take this job from me ...

BTW, your debugger GUI looks amazing to me and I would like to support it from inside.
But I have no idea how it works (because it is external app which doesn't(?) talk with Bochs) and if you need anything inside Bochs to make your life easier.
The gui just sending the debug command to bochs and capture the result. But very sadly it can't run in windows :(
stlw wrote:
Bochs debugger could be extended significantly but we need people who will: a) use it b) report problems and ask for features c) take part in development.
Also, wouldn't you like to extend debugger to x86-64 ?
I added a memory search, see bottom http://code.google.com/p/peter-bochs/wiki/features
Saw it. Although I think page table corruption is better to be debugged using memory access tracing.
The only usage for search in memory I see - searching for ACPI or MP table signature in memory. It could be more useful if you will search for something larger inside memory - a string for example.

Stanislav
For the memory search, it accepts string as the input :)


Yes, I will make it support x86-64. These feature i want to implement too
1) back trace (need to add some code to bochs's source)
2) c/c++ level single step trace (don't know how to make it)

Some questions:
1) what debug command I get get DR0-DR7 ?
2) In linux , when i type in "r" , it will show eax. But in windows, it will show rax. Also, the output format is different. In windows, one line show two registers, but in linux, one line per register.

thanks
from Peter

Re: peter-bochs , a bochs gui debugger

Posted: Sat Nov 21, 2009 10:48 am
by stlw
stlw wrote: That easy. Just few years of experience as x86 expert and CPU architect.
This is very impossible. It is really really hard to know all the behaviour of intel CPU. I guess, you have a in-circuit-emulator, during the development of bochs, when you are not sure how cpu behaviour, you just use your ICE to emulate it. Am I right? If you are american, you should able to get a high paid job in Intel.
No, I don't have in-circuit-emulator of Intel CPU, if I am not sure how things should behave usually I test it on real hardware.
And yes, I work for Intel already :)
There are not so many companies where I could do x86 or cpu architecture.
The gui just sending the debug command to bochs and capture the result. But very sadly it can't run in windows :(
But if you know to send commands - you probably could send Ctrl-C as well, no ?
SIGINT is the only way you could talk with running Bochs window ? I thought you could send keys into it as well.
Yes, I will make it support x86-64. These feature i want to implement too
1) back trace (need to add some code to bochs's source)
2) c/c++ level single step trace (don't know how to make it)
What is back trace ?
Ability to "undo" every instruction or just ability to print X last instuctions occured ?
If second - probably I need to implement hardware CPU LBR feature (record last 16 branches occured in MSRs) and so you could read them in debugger and generate your backtrace offline.

And what is c/c++ level single step trace ? How do you know which ask instructions correspond to single c/c++ line ?
And what about software not written in C/C++ ?
Some questions:
1) what debug command I get get DR0-DR7 ?
> dreg
2) In linux , when i type in "r" , it will show eax. But in windows, it will show rax. Also, the output format is different. In windows, one line show two registers, but in linux, one line per register.
This is not difference between linux and windows - this is difference between x86-64 enabled and disabled.
If x86-64 not compiled in Bochs looks slightly different as you could see ...

Stanislav