Author Topic: GDB  (Read 22540 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?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB
« Reply #15 on: February 11, 2011, 08:29:38 pm »
Have you tried to execute:
Code
shell avarice -g -j USB -P $(MCU) -j usb localhost:4242

Is this on windows?
And what is $(MCU) ?

I still don't understand why the 'additional shell commands' can't have the same implementation like the 'Tools' menu?
Because it is easier to just remove them :)
(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 #16 on: February 11, 2011, 11:37:32 pm »
Have you tried to execute:
Code
shell avarice -g -j USB -P $(MCU) -j usb localhost:4242
Yes I've tried to execute every possible combination. With quotes, without quotes, with full path, without full path, some other executables like winamp etc... just to make sure that it isn't implemented as it's expressed on the link I posted on my previous post.

Is this on windows?
And what is $(MCU) ?
Yup windows, tried on both XP SP3 and Vista SP1. $(MCU) is a variable loaded with the target microcontroller type upon the execution of the AVR project template which I inserted into the template. It works fine on the tools menu and other things where needed.

I still don't understand why the 'additional shell commands' can't have the same implementation like the 'Tools' menu?
Because it is easier to just remove them :)
Doesn't compute! Remove what? Even though 'shell' gets implemented some day to AVR-gdb, there are other mcus on the market which have their own gdb servers and if they don't also support 'shell' that makes codeblocks inattractive imo if 'additional shell commands' won't be implemented. And I still think implementing them with just the same functionality of the 'tools' menu would be more than enough for now. Can the 'tools' menu code just copied and pasted with little modification to implement them?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB
« Reply #17 on: February 12, 2011, 12:56:27 am »
Yes I've tried to execute every possible combination. With quotes, without quotes, with full path, without full path, some other executables like winamp etc... just to make sure that it isn't implemented as it's expressed on the link I posted on my previous post.
Can you post a quote from the link, because there is no mention of shell in it. And as you can see here it looks pretty much as the normal gdb man page: http://linux.die.net/man/1/gdb

Can the 'tools' menu code just copied and pasted with little modification to implement them?
I've intended to to remove the additional shell commands or implement them using the gdb shell command.
Can you try something:
1. Start a debug session and break on some breakpoint
2. In combo where gdb commands can be executed type "shell dir" and execute the command
3. Paste the output here

If the shell command doesn't work everywhere probably I can use the tools code.
(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 #18 on: February 12, 2011, 10:51:31 am »
Yes I've tried to execute every possible combination. With quotes, without quotes, with full path, without full path, some other executables like winamp etc... just to make sure that it isn't implemented as it's expressed on the link I posted on my previous post.
Can you post a quote from the link, because there is no mention of shell in it. And as you can see here it looks pretty much as the normal gdb man page: http://linux.die.net/man/1/gdb

Sry my bad, I thought it wasn't implemented because there was no mention of it but it seems it's implemented.

I've intended to to remove the additional shell commands or implement them using the gdb shell command.
Can you try something:
1. Start a debug session and break on some breakpoint
2. In combo where gdb commands can be executed type "shell dir" and execute the command
3. Paste the output here

Ok, 'shell' works when executed as a gdb command during a debugging session but I couldn't manage to make it work through the 'additional gdb commands'. It just doesn't execute the command. I also tried it with a mingw project and it works with mingw-gdb either way but with avr-gdb, it only works when typed in and executed as a gdb command. Even though if it works somehow I have some concerns regarding this implementation.
1. This will be a VERY VERY VERY debugger specific implementation. How will it be when other debuggers without shell support will be supported by codeblocks?
2. Will it be as useful as 'tools' menu item (like piping, macros and other things)?
3. It will be a clear implementation to use 'additional shell commands' instead of 'additional gdb commands' in my opinion.

If the shell command doesn't work everywhere probably I can use the tools code.

Please implement it like 'tools' menu to make it future proof. ;)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB
« Reply #19 on: February 12, 2011, 02:43:04 pm »
scarphin: Keep in mind that the GUI in the project -> properties is added by the GDB plugin itself and it is not common for all plugins.
  So other plugins should implement it the best they can.

Have you looked at the debugger's debug log when using avr-gdb? Also I think you should use the debuggers branch, in trunk the commands weren't working if I remember correctly.
(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 #20 on: February 12, 2011, 03:40:24 pm »
scarphin: Keep in mind that the GUI in the project -> properties is added by the GDB plugin itself and it is not common for all plugins.
  So other plugins should implement it the best they can.

Well didn't know that and that renders it quite useless really. I think u are working on separating the debugger and the gui, can it be implemented in the gui side after it's done then?

Have you looked at the debugger's debug log when using avr-gdb? Also I think you should use the debuggers branch, in trunk the commands weren't working if I remember correctly.

I've checked every tab related with the debugger and there is no trace of a directory listing with avr-gdb. Mingw however, lists the directories on the debugger(debug) tab. There isn't any problem executing shell commands when typed though. I'm always using the debuggers branch as the debugger doesn't launch for a 'native' target on the trunk branch which was a bug u corrected last summer. It can still be related with the target type like 'native' or 'console application' etc... Can u check that if they all have same options for a 'shell' execution or something?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB
« Reply #21 on: February 12, 2011, 05:00:05 pm »
I've checked every tab related with the debugger and there is no trace of a directory listing with avr-gdb. Mingw however, lists the directories on the debugger(debug) tab.
Do you see the shell commands executed in the debugger (debug) tab?
Where do you add them?
(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 #22 on: February 13, 2011, 12:28:04 am »
Here is mingw's log:
Code
Command-line: C:\GNU\MinGW\bin\gdb.exe -nx -fullname  -quiet -args bin/Debug/exC.exe
Working dir : D:\Coding\Projects\exC\src\
> set prompt >>>>>>cb_gdb:
Reading symbols from D:\Coding\Projects\exC\src/bin/Debug/exC.exe...done.
(gdb) >>>>>>cb_gdb:
> show version
GNU gdb (GDB) 7.1
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
>>>>>>cb_gdb:
> set confirm off
>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:
> set print elements -1
>>>>>>cb_gdb:
> set debugevents on
>>>>>>cb_gdb:
> set new-console on
>>>>>>cb_gdb:
> set disassembly-flavor att
>>>>>>cb_gdb:
> catch throw
Function "__cxa_throw" not defined.
Catchpoint 1 (throw)
>>>>>>cb_gdb:
> source C:\GNU\CodeBlocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
>>>>>>cb_gdb:
> directory D:/Coding/Projects/exC/src/
>>>>>>cb_gdb:
> shell dir
 Volume in drive D is Data
 Volume Serial Number is 743E-2D50
 Directory of D:\Coding\Projects\exC\src
02/12/2011  16:39    <DIR>          .
02/12/2011  16:39    <DIR>          ..
01/31/2011  20:28    <DIR>          bin
02/12/2011  16:28             1,392 exC.cbp
02/12/2011  16:39               238 exC.layout
01/31/2011  20:28               609 main.c
01/31/2011  20:28    <DIR>          obj
               3 File(s)          2,239 bytes
               4 Dir(s)  60,906,680,320 bytes free
>>>>>>cb_gdb:
> break main
Breakpoint 2 at 0x4013ce: file D:\Coding\Projects\exC\src\main.c, line 12.
>>>>>>cb_gdb:
> run
gdb: windows_init_thread_list
[New Thread 3936.0xfd0]
Breakpoint 2, main () at D:\Coding\Projects\exC\src\main.c:12
D:\Coding\Projects\exC\src\main.c:12:172:beg:0x4013ce
>>>>>>cb_gdb:
> set debugevents off
>>>>>>cb_gdb:
> info registers
eax            0x1 1
ecx            0x1 1
edx            0x0 0
ebx            0x7efde000 2130567168
esp            0x27ff00 0x27ff00
ebp            0x27ff28 0x27ff28
esi            0x0 0
edi            0x0 0
eip            0x4013ce 0x4013ce <main+14>
eflags         0x202 [ IF ]
cs             0x23 35
ss             0x2b 43
ds             0x2b 43
es             0x2b 43
fs             0x53 83
gs             0x2b 43
>>>>>>cb_gdb:
> bt 30
#0  main () at D:\Coding\Projects\exC\src\main.c:12
>>>>>>cb_gdb:
> if 1
disassemble 0x4013ce
info frame
end
 > > >Dump of assembler code for function main:
   0x004013c0 <+0>: push   %ebp
   0x004013c1 <+1>: mov    %esp,%ebp
   0x004013c3 <+3>: and    $0xfffffff0,%esp
   0x004013c6 <+6>: sub    $0x20,%esp
   0x004013c9 <+9>: call   0x401a80 <__main>
=> 0x004013ce <+14>: movl   $0x40140f,0x4(%esp)
   0x004013d6 <+22>: movl   $0x16,(%esp)
   0x004013dd <+29>: call   0x401cf8 <signal>
   0x004013e2 <+34>: movl   $0x401434,0x4(%esp)
   0x004013ea <+42>: movl   $0x2,(%esp)
   0x004013f1 <+49>: call   0x401cf8 <signal>
   0x004013f6 <+54>: lea    0x1c(%esp),%eax
   0x004013fa <+58>: mov    %eax,0x4(%esp)
   0x004013fe <+62>: movl   $0x403064,(%esp)
   0x00401405 <+69>: call   0x401d00 <scanf>
   0x0040140a <+74>: call   0x401d08 <abort>
End of assembler dump.
Stack level 0, frame at 0x27ff30:
 eip = 0x4013ce in main (D:\Coding\Projects\exC\src\main.c:12); saved eip 0x4010db
 source language c.
 Arglist at 0x27ff28, args:
 Locals at 0x27ff28, Previous frame's sp is 0x27ff30
 Saved registers:
  ebp at 0x27ff28, eip at 0x27ff2c
>>>>>>cb_gdb:
> x/32xb 0x0
Cannot access memory at address 0x0
0x0: >>>>>>cb_gdb:
> info threads
* 1 Thread 3936.0xfd0  main () at D:\Coding\Projects\exC\src\main.c:12
>>>>>>cb_gdb:
> disassemble 0x004013ce
Dump of assembler code for function main:
   0x004013c0 <+0>: push   %ebp
   0x004013c1 <+1>: mov    %esp,%ebp
   0x004013c3 <+3>: and    $0xfffffff0,%esp
   0x004013c6 <+6>: sub    $0x20,%esp
   0x004013c9 <+9>: call   0x401a80 <__main>
=> 0x004013ce <+14>: movl   $0x40140f,0x4(%esp)
   0x004013d6 <+22>: movl   $0x16,(%esp)
   0x004013dd <+29>: call   0x401cf8 <signal>
   0x004013e2 <+34>: movl   $0x401434,0x4(%esp)
   0x004013ea <+42>: movl   $0x2,(%esp)
   0x004013f1 <+49>: call   0x401cf8 <signal>
   0x004013f6 <+54>: lea    0x1c(%esp),%eax
   0x004013fa <+58>: mov    %eax,0x4(%esp)
   0x004013fe <+62>: movl   $0x403064,(%esp)
   0x00401405 <+69>: call   0x401d00 <scanf>
   0x0040140a <+74>: call   0x401d08 <abort>
End of assembler dump.
>>>>>>cb_gdb:
U can see the 'shell dir' is executed and the directory list after.

And avr-gdb's:
Code
Command-line: C:\GNU\WinAVR\bin\avr-gdb.exe -nx -fullname  -quiet -args bin/Release/RmCont
Working dir : D:\Electronics\Projects\RmCont\source\
> set prompt >>>>>>cb_gdb:
bin/Release/RmCont: No such file or directory.
(gdb) >>>>>>cb_gdb:
> show version
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-mingw32 --target=avr".
>>>>>>cb_gdb:
> set confirm off
>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:
> set print elements -1
>>>>>>cb_gdb:
> set debugevents on
No symbol table is loaded.  Use the "file" command.
>>>>>>cb_gdb:
> set disassembly-flavor att
No symbol table is loaded.  Use the "file" command.
>>>>>>cb_gdb:
> catch throw
No symbol table is loaded.  Use the "file" command.
>>>>>>cb_gdb:
> source C:\GNU\CodeBlocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
>>>>>>cb_gdb:
> directory D:/Electronics/Projects/RmCont/source/
>>>>>>cb_gdb:
> run
Don't know how to run.  Try "help target".
>>>>>>cb_gdb:

As u can see there is no sign of 'shell dir' on the avr-gdb log. They are both entered in the 'additional gdb commands' 'before connection' part. I don't have the needed hardware at home so avr-gdb can't connect to target, can this be the reason for 'shell' not to work? Also as I said before mingw project is a 'console application' and avr-gdb is 'native'.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB
« Reply #23 on: February 13, 2011, 08:27:16 am »
Hm, can you enter any other valid gdb command in the avr project and see if it is executed.
If it isn't, can you try to switch it to console?
Probably this is another bug and it should be fixed.
(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 #24 on: February 13, 2011, 09:47:26 am »
Tried with the 'help' command, same results, works with mingw but not with avr.

If it isn't, can you try to switch it to console?
Sorry, how is 'switching to console' performed?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB
« Reply #25 on: February 13, 2011, 10:12:17 am »
Project -> properties -> build targets -> type -> console
(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 #26 on: February 13, 2011, 11:42:37 am »
Project -> properties -> build targets -> type -> console
Oh sry I though it was something related with the debugger. ;) Switched to console saved the project options and everything and restarted cb and the same result, it doesn't work. But there is something wrong though. While debugging that project gdb stops at 'main' at the start which is a result of execution of the 'break main' command. But I can't also see that being executed on the log. I guess the problem might be something related with gdb being connected to the gdb-server or not. I'm going to check that tomorrow at work where I have the equipment to debug.

cbuser405

  • Guest
Re: GDB
« Reply #27 on: February 14, 2011, 08:51:44 am »
OK. It works.
What do you prefer, combined list or two separe lists (probably I should check CDB) ?

I think one list is enough

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?

It is right be done at the project level.
« Last Edit: February 15, 2011, 01:47:49 pm by cbuser405 »

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: GDB
« Reply #28 on: February 15, 2011, 11:25:44 am »
Sry for the delay. I think the problem was the target type, when I switched to 'debug' from 'release' it worked, don't know why? Unfortunately there are other problems which are much more worse imo. Here is the log:
Code
Command-line: C:\GNU\WinAVR\bin\avr-gdb.exe -nx -fullname  -quiet -args bin/Debug/RmCont
Working dir : D:\Electronics\Projects\RmCont\source\
> set prompt >>>>>>cb_gdb:
(gdb) >>>>>>cb_gdb:
> show version
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-mingw32 --target=avr".
>>>>>>cb_gdb:
> set confirm off
>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:
> set print elements -1
>>>>>>cb_gdb:
> set debugevents on
No symbol "debugevents" in current context.
>>>>>>cb_gdb:
> set disassembly-flavor att
No symbol "disassembly" in current context.
>>>>>>cb_gdb:
> catch throw
Function "__cxa_throw" not defined.
>>>>>>cb_gdb:
> source C:\GNU\CodeBlocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
>>>>>>cb_gdb:
> directory D:/Electronics/Projects/RmCont/source/
>>>>>>cb_gdb:
> shell avarice -g -j USB -P attiny2313 -j usb localhost:4242
AVaRICE version 2.9, Jan  7 2010 22:42:57
Defaulting JTAG bitrate to 250 kHz.
avarice -g -j USB -P attiny2313 -j usb localhost:4242 exited with status 1
read error from AVaRICE: Connection reset by peer
>>>>>>cb_gdb:
> target remote tcp:localhost:4242
tcp:localhost:4242: No connection could be made because the target machine actively refused it.
>>>>>>cb_gdb:
> break main
Breakpoint 1 at 0x486: file RmCont.c, line 216.
>>>>>>cb_gdb:
> continue
The program is not being run.
>>>>>>cb_gdb:
> quit
As u can see the gdbserver is launched with the line 'shell avarice -g -j USB -P attiny2313 -j usb localhost:4242'. Server is there waiting for connection but gdb doesn't resume till shell command exits so I had to kill avarice (exited with status 1) to make gdb resume its initialization and as u can guess it couldn't connect to server (which I had to kill to make gdb resume ;)) and quit.
Macros also doesn't work. I had to replace my '$MCU' with its actual value to make it work. In the tools menu I can use '$MCU' without a problem. And the working dir, is there any way to define the working dir, it might be needed.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB
« Reply #29 on: February 15, 2011, 11:58:15 am »
1. You can make a shell script which uses "avarice  .... & "
2. Macros could be implemented, I think
(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 #30 on: February 15, 2011, 01:01:34 pm »
Shell script, ;/ that shouldn't be the way to implement it imo. Macros won't be of any importance if a xhell script will be used. I stll think implementing the 'additional shell commands' in the gui would be the best way but never mind if it can't be done, codeblocks is more that enough for lots of things. ;) Thnx anyway.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB
« Reply #31 on: February 15, 2011, 02:52:02 pm »
What is the problem with the shell script? Why don't you like it?
You could try to execute the "shell avahi ...  &" but I don't think it will work.

I prefer to have only one GUI, less code => less bugs :)
(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 #32 on: February 15, 2011, 04:43:08 pm »
The reason I don't like shell script is it will be OS dependant and macros cannot be used. Apart from that it will be debugger dependent. By GUI I meant the splitted debugger GUI, the general one for all debuggers which u are trying to split afaik. I perefer also less code => less bugs. ;) As I said before that's just my thoughts as a user using cb for embedded programming mostly and as always I am grateful for what's done so far. ;) Thnk u.

What's 'avahi' btw?

Another idea: Can gdb be adjusted to not wait till the shell command exits somehow?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB
« Reply #33 on: February 15, 2011, 05:04:18 pm »
The reason I don't like shell script is it will be OS dependant and macros cannot be used.
1. The can be used to abstract OS differences
2. Shell scripts can have parameters, so macros can be used.

Apart from that it will be debugger dependent. By GUI I meant the splitted debugger GUI, the general one for all debuggers which u are trying to split afaik.
The GUI in the project is not common for all debuggers. It has not split at the moment.

What's 'avahi' btw?
Replace it with the real command you've used, it thought mistake :)

Another idea: Can gdb be adjusted to not wait till the shell command exits somehow?
Ask on the gdb's mailing list or in #gdb @ irc.freenode.net or .org (not 100% sure).
(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 #34 on: February 15, 2011, 06:15:53 pm »
Another idea: Can gdb be adjusted to not wait till the shell command exits somehow?
Ask on the gdb's mailing list or in #gdb @ irc.freenode.net or .org (not 100% sure).

Ok, will try, thnx. I guess I need to learn to code in C++ (working on it though) to become aware of some things. ;)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB
« Reply #35 on: February 15, 2011, 06:43:09 pm »
GDB is written in C (probably ANSI C), so no need to learn C++:)
(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 #36 on: February 16, 2011, 01:21:58 pm »
OK. It works.
What do you prefer, combined list or two separe lists (probably I should check CDB) ?

I think one list is enough

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?

It is right be done at the project level.

Is there any progress on my request?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB
« Reply #37 on: February 16, 2011, 02:33:05 pm »
No, I've other things with higher priority at the moment.
(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!]