Code::Blocks Forums

User forums => Help => Topic started by: thela_kid on January 24, 2015, 01:39:48 am

Title: How to set watches to Hexidecimal?
Post by: thela_kid on January 24, 2015, 01:39:48 am
Hi, I'm trying to debug my program by looking at the local variables in the watches window, however there doesn't seem to be a way to view these values as HEX or binary. How can I do this?
Title: Re: How to set watches to Hexidecimal?
Post by: oBFusCATed on January 24, 2015, 11:06:38 am
Unfortunately this is not possible for the locals.
You have to add separate watch variables and then right click -> properties -> hexadecimal.

As far as I can see there is no way to tell gdb to list locals or args in hexadecimal format.
C::B uses 'info locals' and 'info args' commands.
Title: Re: How to set watches to Hexidecimal?
Post by: thela_kid on January 25, 2015, 12:27:28 am
I see, thank you.
Title: Re: How to set watches to Hexidecimal?
Post by: ca1e on January 22, 2019, 01:44:59 am
Unfortunately this is not possible for the locals.
You have to add separate watch variables and then right click -> properties -> hexadecimal.

As far as I can see there is no way to tell gdb to list locals or args in hexadecimal format.
C::B uses 'info locals' and 'info args' commands.

- i have an array of many variables
- they are memory pointers
- in this case, decimal integers are not useful
- right-clicking every single variable not possible

currently i am using windows calculator to convert from decimal to hex, because it is faster than;

- adding a new watchlist entry for a variable
- then right-clicking it
- then ticking a box in a a popup window

it is now 2019. is it possible with today's technology to display a hex number?
Title: Re: How to set watches to Hexidecimal?
Post by: BlueHazzard on January 22, 2019, 02:06:13 pm
You select your array variable, you rightclick->Add watch
you select the watch in the watches window->right click->properties->Format->hex
Then you select start and count for the amount of array entries you want to watch

now you can view the whole array in hex...

If you are talking about c++ std::array things will get complicated. Then you will have to write some python script for gdb....
Title: Re: How to set watches to Hexidecimal?
Post by: oBFusCATed on January 22, 2019, 07:37:06 pm
He/she is talking about hex by default if I understand him/her correctly. This is currently not possible even in 2019...
Title: Re: How to set watches to Hexidecimal?
Post by: ca1e on February 10, 2019, 05:41:23 am
hex by default

exactly..
is there any possible way in the universe which we live that this could be achieved?
it would make debugging much, much easier.. .. ..
Title: Re: How to set watches to Hexidecimal?
Post by: oBFusCATed on February 10, 2019, 11:16:02 am
Yes, patch C::B...
Title: Re: How to set watches to Hexidecimal?
Post by: BlueHazzard on February 10, 2019, 02:43:23 pm
or use the memory view...