Author Topic: Debugging MSP430 from within C::B  (Read 47910 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugging MSP430 from within C::B
« Reply #15 on: August 25, 2010, 01:00:46 am »
Are you also asking if the stop button not working depends on it being a remote target?
Cannot compute :)
Can you explain what you had in mind with this sentence?
(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 pfong

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Debugging MSP430 from within C::B
« Reply #16 on: August 25, 2010, 01:31:14 am »
Do you know if the problem happens for normal remote debugging (PC <-> PC) ?
I don't have any experience with embedded development and I can test or improve the code.
But if the behaviour is the same when the connection is PC<->PC I can.

I installed Code::Blocks on Windows with the bundled MinGW and saw that it includes gdbserver.  So, I replicated the test above (gdbserver and gdb on the same machine) on Windows and the process pausing with the stop button problem occurs.  Code::Blocks says "Trying to pause running process..." and the process doesn't pause.

So, both problems can be replicated using only 1 machine.  You don't need an embedded target just a remote target.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugging MSP430 from within C::B
« Reply #17 on: August 25, 2010, 02:08:51 am »
Great, I'll see what I can do to fix 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 pfong

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Debugging MSP430 from within C::B
« Reply #18 on: August 25, 2010, 04:02:45 am »
It seems the debugger pausing problem has been discussed before. See: http://forums.codeblocks.org/index.php?topic=8577.0

Offline pfong

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Debugging MSP430 from within C::B
« Reply #19 on: August 26, 2010, 09:12:55 pm »
Would it be better if I put the information that I find in the bugs or here or both?

I did some more research on the break problem.  It seems that in Windows you can send a SIGINT with the WM_CHAR message (See http://msdn.microsoft.com/en-us/library/ms811896#ucmgch09_topic3).  Unfortunately, the documentation here is not detailed and I have not been able to get this to work.  I made a program that uses SendMessage to send messages indicating Ctrl is pressed and then C but it doesn't seem to do any thing.  I haven't even been able to use it to press keys in Notepad and get characters to appear.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugging MSP430 from within C::B
« Reply #20 on: August 26, 2010, 11:06:45 pm »
I think, I've gathered enough info, just need to do some testing + implementation.

I'll see if I can find some time this weekend...
(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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Debugging MSP430 from within C::B
« Reply #21 on: August 27, 2010, 08:41:06 am »
Great, I'll see what I can do to fix them:)
You are the first person I know saying "Great" if a bug is found. :lol: :lol: :lol:
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugging MSP430 from within C::B
« Reply #22 on: August 27, 2010, 09:20:33 am »
You are the first person I know saying "Great" if a bug is found. :lol: :lol: :lol:
I say "Great", when I know how to reproduce a bug, because most of the work is done at this 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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugging MSP430 from within C::B
« Reply #23 on: August 29, 2010, 09:18:04 pm »
Yes, the run vs cont problem occurs even when the target is a PC.  I ran "gdbserver :2314 helloworld" in a terminal window and set the remote target in the project to 127.0.0.1:2314.
This does not happen in my tests. C::B sends the correct continue command, when I'm remote debugging.
I've tested on windows and linux, both worked.
I've tested with CB from the debuggers branch.

Are you also asking if the stop button not working depends on it being a remote target?
The stop but happens for me too...

Edit: If you can't fix the continue/run problem please provide simple example project, please setup it to connect to localhost:1234 and specify all steps required to reproduce the problem...
« Last Edit: August 29, 2010, 11:34:47 pm 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!]

Offline pfong

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Debugging MSP430 from within C::B
« Reply #24 on: September 01, 2010, 02:28:56 am »
This does not happen in my tests. C::B sends the correct continue command, when I'm remote debugging.
I've tested on windows and linux, both worked.
I've tested with CB from the debuggers branch.

Edit: If you can't fix the continue/run problem please provide simple example project, please setup it to connect to localhost:1234 and specify all steps required to reproduce the problem...

I've attached a simple helloworld project.  I am testing with Code::Blocks 10.05 on Windows.  This is the behavior that I observe...
Situation 1:
Make sure "Do *not* run debugee" is checked off (enabled).  In one window in the helloworld directory run "gdbserver :1234 bin\Debug\helloworld.exe".  In Code::Blocks press the "run/continue" button.  You will see the gdbserver report "Remote debugging from host 127.0.0.1".  If you press "run/continue" again, it will send "run" to gdb.  This causes the gdbserver say "Killing inferior" and exit.  The local gdb runs the process locally and a console window pops up.
Situation 2:
Make sure "Do *not* run debugee" is NOT checked off (enabled).  In one window in the helloworld directory run "gdbserver :1234 bin\Debug\helloworld.exe".  In Code::Blocks press the "run/continue" button.  You will see the gdbserver report "Remote debugging from host 127.0.0.1".  Then "Hello world!" is printed out in the window with gdbserver and it waits in the while (1) loop.

The behavior in situation 1 is broken.  It should send "continue" when you press the "run/continue" so that the process runs where gdbserver is running just like in situation 2.

The workaround I've been using is to use
"define run
     continue
end"
in the GDB initialization to redefine run to be the same as continue.


Are you also asking if the stop button not working depends on it being a remote target?
The stop but happens for me too...
Are you saying it works correctly (stops the program) or that it is broken (prints out "Trying to pause running process..." and nothing happens)?


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugging MSP430 from within C::B
« Reply #25 on: September 01, 2010, 09:52:39 am »
I've attached a simple helloworld project.  I am testing with Code::Blocks 10.05 on Windows.  This is the behavior that I observe...
Situation 1:
Make sure "Do *not* run debugee" is checked off (enabled).  In one window in the helloworld directory run "gdbserver :1234 bin\Debug\helloworld.exe".  In Code::Blocks press the "run/continue" button.  You will see the gdbserver report "Remote debugging from host 127.0.0.1".  If you press "run/continue" again, it will send "run" to gdb.  This causes the gdbserver say "Killing inferior" and exit.  The local gdb runs the process locally and a console window pops up.
Situation 2:
Make sure "Do *not* run debugee" is NOT checked off (enabled).  In one window in the helloworld directory run "gdbserver :1234 bin\Debug\helloworld.exe".  In Code::Blocks press the "run/continue" button.  You will see the gdbserver report "Remote debugging from host 127.0.0.1".  Then "Hello world!" is printed out in the window with gdbserver and it waits in the while (1) loop.

The behavior in situation 1 is broken.  It should send "continue" when you press the "run/continue" so that the process runs where gdbserver is running just like in situation 2.
Thanks will test tonight...

The stop but happens for me too...
"but" should have been "bug", sorry for the typo.
And yes, the bug is present on my machine.
And also it will be very hard to solve, probably impossible
or at least will require replacing wxProcess with something else (or patching wxProcess).
I'm still testing and do not have a final opinion on the matter.

(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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugging MSP430 from within C::B
« Reply #26 on: September 03, 2010, 02:34:54 am »
The "run/continue" bug should be fixed with this patch: http://forums.codeblocks.org/index.php/topic,10908.msg88984.html#msg88984
(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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugging MSP430 from within C::B
« Reply #27 on: September 05, 2010, 03:42:41 pm »
The interrupting bug should be fixed with this patch: http://forums.codeblocks.org/index.php/topic,10908.msg89081.html#msg89081
(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 pfong

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Debugging MSP430 from within C::B
« Reply #28 on: September 09, 2010, 11:31:14 pm »
Nice work.  I have not had time to try a build of the debugger branch yet though.  I've been using Code::Blocks on Ubuntu instead.

Should we update the bugs in the bug tracker 017441 and 017451?  I'm not familiar with the Berilos bug tracker and don't see how to update the status.

BTW, has any one working on the debugger branch looked at bug 017461 ""Additional GDB Commands -> Before Connection" broken"? I discovered that problem while trying to setup the target board using GDB commands in that setting.  The bug report was submitted by my colleague.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugging MSP430 from within C::B
« Reply #29 on: September 10, 2010, 09:23:59 pm »
Should we update the bugs in the bug tracker 017441 and 017451?  I'm not familiar with the Berilos bug tracker and don't see how to update the status.
I think only the devs/admins can do that (also there are some duplicates).
But first verify that the bugs are fixed in your environment....

BTW, has any one working on the debugger branch looked at bug 017461 ""Additional GDB Commands -> Before Connection" broken"? I discovered that problem while trying to setup the target board using GDB commands in that setting.  The bug report was submitted by my colleague.
I've not, but will look at it some day:)
(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!]