Author Topic: MSP430 debugging closes immediately after connection  (Read 19722 times)

Offline ljstrickler

  • Single posting newcomer
  • *
  • Posts: 9
MSP430 debugging closes immediately after connection
« on: June 04, 2013, 07:05:17 pm »
I am using Mint14 and I had to go to a compiled svn9132 since installing the 12.11 release was going to uninstall a variety of things I did not want uninstalled (like the latest compiler).

It works fine so far except gdb now closes the debug session as soon as it opens the connection to mspdebug. This worked fine with 10.05, I was trying the new one hoping that the ability to start things before the debugger were easier (actually possible) now. Any ideas?

The shell commands before the debugger still doesn't seem to work, at least i haven't been able to get it to do anything. Is there something special that needs to be done? I am trying to use mspdebug rf2500 "gdb"

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: MSP430 debugging closes immediately after connection
« Reply #1 on: June 04, 2013, 07:19:00 pm »
Please post the full debug log (you have to enable it in the settings first). Please use code tags, for the paste...

About the shell commands: a better explanation will be needed here.
What and where you entered, what is expected to happen, what happens?
(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 ljstrickler

  • Single posting newcomer
  • *
  • Posts: 9
Re: MSP430 debugging closes immediately after connection
« Reply #2 on: June 04, 2013, 07:39:41 pm »
Here's the debug log
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: /home/dad/projects/msp430/blink_1/
Adding source dir: /home/dad/projects/msp430/blink_1/
Adding file: /home/dad/projects/msp430/blink_1/bin/Debug/blink2.elf
Changing directory to: /home/dad/projects/msp430/blink_1/bin/Debug
Set variable: LD_LIBRARY_PATH=.:/usr/msp430/lib:

[debug]Command-line: /usr/bin/gdb -nx -fullname  -quiet  -args /home/dad/projects/msp430/blink_1/bin/Debug/blink2.elf
[debug]Working dir : /home/dad/projects/msp430/blink_1/bin/Debug

Starting debugger: /usr/bin/gdb -nx -fullname  -quiet  -args /home/dad/projects/msp430/blink_1/bin/Debug/blink2.elf
done

[debug]Reading symbols from /home/dad/projects/msp430/blink_1/bin/Debug/blink2.elf...done.
[debug](gdb)
[debug]> set prompt >>>>>>cb_gdb:

Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Connecting to remote target
Setting breakpoints

[debug]>>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 7.5-ubuntu
[debug]Copyright (C) 2012 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "x86_64-linux-gnu".
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (GDB) 7.5-ubuntu

[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor intel
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Function "__cxa_throw" not defined.
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source /usr/local/share/codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory /home/dad/projects/msp430/blink_1/
[debug]Source directories searched: /home/dad/projects/msp430/blink_1:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> set remoteaddresssize 16
[debug]>>>>>>cb_gdb:
[debug]> set remotetimeout 999999
[debug]>>>>>>cb_gdb:
[debug]> set download-write-size 512
[debug]No symbol "download" in current context.
[debug]>>>>>>cb_gdb:
[debug]> set remote memory-write-packet-size 512
[debug]>>>>>>cb_gdb:
[debug]> set remote memory-write-packet-size fixed
[debug]>>>>>>cb_gdb:
[debug]> set remote memory-read-packet-size 512
[debug]>>>>>>cb_gdb:
[debug]> set remote memory-read-packet-size fixed
[debug]>>>>>>cb_gdb:
[debug]> target remote tcp:localhost:2000
[debug]Reply contains invalid hex digit 59
[debug]Remote debugging using tcp:localhost:2000
[debug]>>>>>>cb_gdb:

Connected

[debug]> break "/home/dad/projects/msp430/blink_1/main.c:31"
[debug]Breakpoint 2 at 0xc03e: file /home/dad/projects/msp430/blink_1/main.c, line 31.
[debug]>>>>>>cb_gdb:
[debug]> continue
[debug]The program is not being run.
[debug]>>>>>>cb_gdb:

The program is not being run.

[debug]> quit

Debugger finished with status 0


For the shell commands the command I am trying to use is
mspdebug rf2500 "gdb"
This should start the debugger so that when gdb starts it is there to be connected to. Another change I noticed is that I can't specify msp430-gdb as the debugger anymore, there is either a choice of GDB/CDB debugger or invalid debugger. We used to be able to specify our own. It looks like it is using the wrong one.

Offline ljstrickler

  • Single posting newcomer
  • *
  • Posts: 9
Re: MSP430 debugging closes immediately after connection
« Reply #3 on: June 04, 2013, 07:47:02 pm »
When the gdb debugger works it has the following in the version report
This GDB was configured as "--host=i686-pc-linux-gnu --target=msp430"
so it really seems like the wrong debugger is being used and I can't pick the correct one any more?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: MSP430 debugging closes immediately after connection
« Reply #4 on: June 04, 2013, 07:52:00 pm »
Settings -> Debugger -> GDB/CDB Debugger -> Create config -> Your config -> set the path and any other options

Also you need to associate the debugger with the compiler or set the debugger config manually Debug -> Active config -> Your config

And please use code tags, next time!
(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 ljstrickler

  • Single posting newcomer
  • *
  • Posts: 9
Re: MSP430 debugging closes immediately after connection
« Reply #5 on: June 04, 2013, 07:59:18 pm »
Thanks, what good is the predefined entry for the 430 then? I'd think that it would be setup correctly if it is predefined.
Sorry, I thought I was using code tags, who would have thought that a # was code instead of a typewriter, # is a number to me

Offline ljstrickler

  • Single posting newcomer
  • *
  • Posts: 9
Re: MSP430 debugging closes immediately after connection
« Reply #6 on: June 04, 2013, 10:02:27 pm »
Could there be an entry by the debugger configuration that takes you to the setup? This would make it more obvious and create the one for the MSP430 by default since the menu entry is there.

This has been a great application other than some confusing parts.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: MSP430 debugging closes immediately after connection
« Reply #7 on: June 04, 2013, 11:07:14 pm »
And the defaults would be?
(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 ljstrickler

  • Single posting newcomer
  • *
  • Posts: 9
Re: MSP430 debugging closes immediately after connection
« Reply #8 on: June 04, 2013, 11:40:36 pm »
The same as the set up for the rest of the msp430 files, add "msp430-" to the beginning, msp430-gdb. It auto-populated the rest of the file names.

Maybe instead of labelling the line "Debugger" in the compiler setup you can change it to "Configured Debuggers", this at least would give you a clue that it CAN be configured. As it stands now there is nothing there indicating that the debugger can be configured.

Offline ljstrickler

  • Single posting newcomer
  • *
  • Posts: 9
Re: MSP430 debugging closes immediately after connection
« Reply #9 on: June 04, 2013, 11:54:06 pm »
Have you got a clue as to what needs to be done to get the "Additional shell commands" to actually execute? The tools menu effectively prevents you from running pkill or killall as the first command of a multi-command tool when hidden. If not hidden you can use them just fine but you can't exit without a keypress.

The debugger interface starts fine but it can get annoying if you constantly have to either start it by hand or kill it by hand once done, this is why I'm trying to get this to work. Adding the ability of the first line of launching options but allow it to exit without a keypress would also help.


Offline ljstrickler

  • Single posting newcomer
  • *
  • Posts: 9
Re: MSP430 debugging closes immediately after connection
« Reply #10 on: June 04, 2013, 11:59:00 pm »
Oh, and allow the use of multiple tools (add the setsid command to the beginning of the xterm command line. By effectively creating a command line of
Code
setsid xterm -e mspdebug rf2500 "opt gdb_loop true" "gdb" 
with setsid as the executable and the rest as the parameters allows me to run multiple commands (the second one kills this one and uploads the data).

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: MSP430 debugging closes immediately after connection
« Reply #11 on: June 05, 2013, 12:50:27 am »
ljstrickler: I don't you understand it but I'm not an embedded developer, so all these posts mean almost nothing to me.

About autoconfig/detection - patches are welcome. But keep in mind that in the past the config for the debugger to run was stored in the Compiler plugin, not in the debugger. The debugger currently have very simple auto-detected capabilities.

Have you got a clue as to what needs to be done to get the "Additional shell commands" to actually execute?...
How can I get a clue, if you don't tell me the steps needed to reproduce your problem?

I'm not sure what killing, what commands and so on you're talking about (probably gdb-server, but how could I be sure).
Try to write with more meaning/information and less word :)

For setsid, you can try to edit Settings -> Environment -> General -> Terminal...
(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 ljstrickler

  • Single posting newcomer
  • *
  • Posts: 9
Re: MSP430 debugging closes immediately after connection
« Reply #12 on: June 05, 2013, 02:08:39 am »
OK, it has nothing to do with embedded programming. I'd use the same types of things to create a serial terminal for talking with a console or GUI that I was developing.

In this example I'll use gcalctool (calculator) but you can substitute any command that leaves something running that you don't care if all instances are stopped (killed).

To understand what I'm talking about try the following,
First to show what I'm trying to do, execute these at the command line
Code
setsid gcalctool
setsid gcalctool
killall gcalctool
It should bring up two calculators and then kill them when you execute the "killall" command

Now for the CodeBlocks changes, I'm assuming I don't have to tell you every keypress.
Create a new tool "Calc"
Put setsid in the executable entry and gcalctool in the parameters entry.
Set it for the fourth launching option (visible and detached).
Add another tool "Kill Calc"
Put killall in the executable entry and gcalctool in the parameters entry.
Set it for the fourth launching option (visible and detached).
Exit the tools configuration setup

Start a couple of calcs using the tool entry
Use the Kill Calc tool entry to kill them all.

Open a project
Open the properties of the project
Go to the debugger tab
In the Remote debugging support area at the bottom go to the tab for Additional shell commands
In the Before connection area, enter "killall gcalctool"
According to the tip in this area these will be executed whether there is a remote connection or not.
Save the changes and exit the Project/target options

This project should now be setup so that every time you start the debugger the "killall gcalctool" command would be run before starting the gdb session.

Start a couple of session of gcalctool using the Tools menu
Start debugging the project
The calculators should disappear (get killed) when the killall line is executed
They don't.

Anything more you need?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: MSP430 debugging closes immediately after connection
« Reply #13 on: June 05, 2013, 08:37:53 am »
(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!]