Author Topic: GDB  (Read 22514 times)

cbuser405

  • Guest
GDB
« on: February 09, 2011, 05:38:11 pm »
Hi,

Could you implement the remote GDB 'additional shell commands'. As far as I can see almost the entire infrastructure for this already exists. It remains to add functionality to GDB_driver::Prepare().

Thank you,

Maxim

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB
« Reply #1 on: February 09, 2011, 05:45:36 pm »
Probably, but this should be done by someone using these commands.
I don't know how to use them, so it would be hard for me to test the code.

So patches are welcome.
If you take the task, please use the debuggers branch as a base.
You can find it here: http://svn.berlios.de/wsvn/codeblocks/branches/wxpropgrid_debugger/
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

cbuser405

  • Guest
Re: GDB
« Reply #2 on: February 10, 2011, 09:26:16 am »
Thanks for the quick reply. Testing of this functionality is not of great complexity, you can just 'ls> beforeConnect.txt' and 'ls> afterConnect.txt' ('dir' for Windows) or something to like this.
Implementing the shell command, I think, ought to be done in the style of C:: B. Could you give an example of the style in the C:: B a call command shell? It would be just as well to include this fix into the mainline, they are more that the fields entering these commands have been around long enough.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: GDB
« Reply #3 on: February 10, 2011, 10:47:53 am »
I'm desperately looking for that feature also!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB
« Reply #4 on: February 10, 2011, 11:18:14 pm »
What are these commands useful for?
Can you describe a use case where you need them?

Where they should be executed? On the machine running gdb or the machine running gdbserver?

Edit reason: replaced there with these in the first sentence.
« Last Edit: February 11, 2011, 08:55:01 am by oBFusCATed »
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

cbuser405

  • Guest
Re: GDB
« Reply #5 on: February 11, 2011, 08:47:41 am »
Quote
What are there commands useful for?
I do not think that these commands can be especially helpful.

Quote
Can you describe a use case where you need them?
I think that these commands can be useful in the tests. You can check whether they run.

Quote
Where they should be executed? On the machine running gdb or the machine running gdbserver?
They should run on the machine running gdb.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB
« Reply #6 on: February 11, 2011, 08:57:14 am »
I want a real test case, so I can see what features do you need.
Like:
1. do you want to process the output of the commands
2. do you want piping and such things...
or
3. you just need a way to start the gdbserver on the remote machine using some shell script?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

cbuser405

  • Guest
Re: GDB
« Reply #7 on: February 11, 2011, 09:31:25 am »
That's a real commands:
Quote
ssh root@192.168.12.214 "rm hello"
scp hello root@192.168.12.214:
ssh root@192.168.12.214 gdbserver :3333 hello

It would be nice to redirect the output of these commands to 'Program Console' window.

Thank you :)

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: GDB
« Reply #8 on: February 11, 2011, 12:56:52 pm »
I want a real test case, so I can see what features do you need.
Like:
1. do you want to process the output of the commands
2. do you want piping and such things...
or
3. you just need a way to start the gdbserver on the remote machine using some shell script?

The main usage of these commands can be the firing up of the GDB Server before the GDB starts. On a PC a GDB Server may not be needed but on a embedded targat u have to fire up the associated GDB Server to help connect GDB to the target hardware through a debugger or so. So when debugging embedded target u need to fire up the GDB Server before u start GDB and it's have to be done manually currently.

1. In my case the visibility of the output is enough just to see what's going on (ie if it's connected to the target or not).
2. Piping may be useful but can't think of anything right now.
3. That's the idea. Remote or local.
Thnx...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB
« Reply #9 on: February 11, 2011, 02:01:50 pm »
OK, Can you test the "shell" gdb command? http://sourceware.org/gdb/current/onlinedocs/gdb/Shell-Commands.html#Shell-Commands

In the "Additional GDB commands" put something like:
Code
shell ssh root@192.168.12.214 "rm hello"
shell scp hello root@192.168.12.214:
shell ssh root@192.168.12.214 gdbserver :3333 hello
If that works I can implement it in the plugin or I can remove additional shell commands GUI and I can put some info how to do use the shell commands.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: GDB
« Reply #10 on: February 11, 2011, 02:41:43 pm »
I understand that this works after GDB has been run and not available if GDB is not running. If that's the case, how can the GDB Server be fired before GDB tries to connect to it?

cbuser405

  • Guest
Re: GDB
« Reply #11 on: February 11, 2011, 03:37:22 pm »
Quote
If that works I can implement it in the plugin or I can remove additional shell commands GUI and I can put some info how to do use the shell commands.
OK. It works.

Could you add a check box "use extended-remote" to configuration page for GDB RemoteConnection:
if not checked - works as before (send target remote)
if checked - send target extended-remote.

That would be the best solution.

Thank you!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB
« Reply #12 on: February 11, 2011, 03:53:00 pm »
OK. It works.
What do you prefer, combined list or two separe lists (probably I should check CDB) ?

Could you add a check box "use extended-remote" to configuration page for GDB RemoteConnection:
if not checked - works as before (send target remote)
if checked - send target extended-remote.
Is this per project or global setting?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: GDB
« Reply #13 on: February 11, 2011, 04:26:56 pm »
Well it doesn't work here. I used the command line below in the additional GDB commands before connection:
Code
shell cmd "avarice -g -j USB -P $(MCU) -j usb localhost:4242"
and there is no sign of 'avarice' being fired which is the GDB Server for avr. It's in the path btw.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: GDB
« Reply #14 on: February 11, 2011, 05:09:39 pm »
It seems it's not implemented in the AVR target.
http://linux.die.net/man/1/avr-gdb

I still don't understand why the 'additional shell commands' can't have the same implementation like the 'Tools' menu?