Author Topic: Show local variables in the debugger  (Read 37449 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Show local variables in the debugger
« Reply #15 on: August 03, 2013, 11:39:27 am »
it only occurs on windows ? or also on linux ?
Everywhere...
(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 ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Show local variables in the debugger
« Reply #16 on: August 03, 2013, 11:43:47 am »
it only occurs on windows ? or also on linux ?
On Windows, when pass a long value (this is a random value) to malloc function, it will failed, then GDB crashes, what my patch do is to limit the size passed to malloc function.
Code
+	  if (length > local_opts.print_max)
+    length = local_opts.print_max;
The value "ocal_opts.print_max = 200 " if you set on GDB command line: set print elements 200
I'm not sure how it works under Linux.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Show local variables in the debugger
« Reply #17 on: August 03, 2013, 03:22:58 pm »
So please stay tuned... I'll post here.
Here it is, hopefully complete... sorry for the delay.
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 cbrmm

  • Single posting newcomer
  • *
  • Posts: 3
Re: Show local variables in the debugger
« Reply #18 on: August 26, 2013, 07:59:21 am »
MortenMacFly

Thanks so much. When trying to apply your patch, however, it doesn't work.
Looking closer it seems that you patch against rev. 7239 but the only 12.11 currently available is rev. 7291.

Detail: I'm on Mint 15 and an example of patchs complaints is a file "src/CodeBlocks_wx29-unix.cbp" that doesn't exist.

I'd very much appreciate if you could provide a working patch because using D (rather than C++) I can't see much other than ints and bools.

Having a way to at least see all locals would be of great help.



Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Show local variables in the debugger
« Reply #19 on: August 28, 2013, 10:07:41 am »
I'd very much appreciate if you could provide a working patch because using D (rather than C++) I can't see much other than ints and bools.
Can you explain what is the problem here? Post a debug log from the debugger?
If GDB can print D structs/classes then it should work out of the box.

p.s. I doubt this patch will help with solving you problem, because by looking at it I think it works for simple values and not for structs/classes/arrays/etc.
« Last Edit: August 28, 2013, 10:09:13 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!]

Offline cbrmm

  • Single posting newcomer
  • *
  • Posts: 3
Re: Show local variables in the debugger
« Reply #20 on: August 30, 2013, 05:21:35 am »
Sorry for expressing myself clumsily.

I'm using Code:Block for D development and there seem to be serious problems to watch variables. So my compromise was to at least see local vars. This, however, doesn't work in 12.11 anymore.

With 10.05 it does work (local vars display) but I'd like, of course, the new CB version and additionally it's a PITA to install CB 10.05 package by package (on Linux Mint).

Ideas? Advice?

Thanks - R

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Show local variables in the debugger
« Reply #21 on: August 30, 2013, 09:19:09 am »
You failed to say what is the exact problem again.
I don't intend to install a D compiler to check how it works with C::B.
So you'll has to provide a debug log from the debugger or continue to use 10.05... See the debugger setting for an option to enable it.
(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 cbrmm

  • Single posting newcomer
  • *
  • Posts: 3
Re: Show local variables in the debugger
« Reply #22 on: August 30, 2013, 11:28:00 pm »
You failed to say what is the exact problem again.
I don't intend to install a D compiler to check how it works with C::B.
So you'll has to provide a debug log from the debugger or continue to use 10.05... See the debugger setting for an option to enable it.

Thanks so much but I don't intend to become a gdb expert. After all, I'm using an ide to *not* have to take care of stuff like that.

To my question: Simple issue.
In CB 10.05, when I enable "watches" in the debugger windows menu, I see local vars (and parameters) in the watches windows.
In CB 12.01 that doesn't work anymore.

Concerning D:

I'm perfectly O.K. with you possibly not caring about D related problems. But then CB shouldn't announce to support D.
I also understand that D is still a floating target and brings its own set of problems for CB, and that we users should - to the best of our abilities - try to do our part to get it working. I'm certainly willing to do that. But it would be helpful if you, the CB specialist, asked in a more CB newbie oriented manner for the detail info you need.
I'm perfectly willing to do my part, I am however not interested if I must first become a CB expert.

Side note: I'm new to D too and just making my first steps there. So, kindly don't expect too much know how from me.

Thanks - R

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Show local variables in the debugger
« Reply #23 on: August 30, 2013, 11:38:02 pm »
Thanks so much but I don't intend to become a gdb expert. After all, I'm using an ide to *not* have to take care of stuff like that.
I've stopped reading at this sentence, sorry, but you don't want help, just want to use 10.05 forever. If you want any help post a log from the 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!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Show local variables in the debugger
« Reply #24 on: September 01, 2013, 07:39:32 pm »
All local variable fanatics could checkout r9283 and start complaining that they are slow and cause gdb/c::b crashes.

Enjoy.
(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 ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Show local variables in the debugger
« Reply #25 on: September 02, 2013, 08:54:47 am »
All local variable fanatics could checkout r9283 and start complaining that they are slow and cause gdb/c::b crashes.

Enjoy.
Hi, Obf, good work, I'm enjoying this new feature now. :)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Show local variables in the debugger
« Reply #26 on: November 24, 2013, 02:05:46 pm »
@OBF:

With the latest GDB (git head), I think debugging/stepping under C::B with local variables shown is accelerated, see the latest comments in the below bug reports:

https://sourceware.org/bugzilla/show_bug.cgi?id=16196
https://sourceware.org/bugzilla/show_bug.cgi?id=12127

The main fix is that GDB now only fetch the maximize size of memory(defined by the user) from the inferior(debugee), GDB was fetch a vary large size(random value if it is an un-initilized local variable) of the memory from the inferior. The size of the element can be set such as:
Code
set print elements 200
So, if you have time, you can build GDB with the latest GIT head, and try to see whether it steps faster. (I heard before that GDB steps very slow if local variable is shown under C::B)




« Last Edit: November 24, 2013, 02:14:51 pm by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Show local variables in the debugger
« Reply #27 on: November 24, 2013, 02:32:23 pm »
Won't help much. The problem is in codeblocks, not in GDB (most of the times).
(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!]