cyrus-and / gdb-dashboard

Modular visual interface for GDB in Python
MIT License
11.01k stars 768 forks source link

Cannot write the dashboard: Invalid character '?' in expression #57

Closed xeyownt closed 7 years ago

xeyownt commented 7 years ago

On my platform, info registers returns a very huge list of registers (like 80 registers), some registers being quite long.

Sometimes, when starting dashboard, I get the error:

Cannot write the dashboard: Invalid character '?' in expression

Where the ? is some strange symbol character. When that happens, dashboard fails to print the register list. In fact, when issuing the command info reg in the CLI, I noticed that the output is corrupted for some registers (usually the long ones, where some funny characters appears here and there).

This problem happens at random. Starting gdb several times, I maybe get the problem 1 out of 4. When I get it, info reg remains corrupted for the whole session it seems.

I don't know if this is a problem in dashboard, but it only happens when I use dashboard. I tried like 10+ times without dashboard, and can't reproduce the problem.

Any idea what could corrupt the output of gdb?

Note that this is very low priority because actually I currently patched dashboard to only keep the most important registers, and these apparently are never corrupted.

cyrus-and commented 7 years ago

In fact, when issuing the command info reg in the CLI, I noticed that the output is corrupted for some registers (usually the long ones, where some funny characters appears here and there).

Can you show me an example of offending info registers output? To avoid copy/paste problems with those characters paste here the output of the following GDB command:

python print(gdb.execute('info registers', True, True).encode('base64'))
cyrus-and commented 7 years ago

Bump.

xeyownt commented 7 years ago

Hello,

I'll collect the information you requested. Sorry for long delay.

xeyownt commented 7 years ago

Hi cyrus-and,

I attached the file showing an example of offending output (dashboard_info_registers_b64.txt). See decoded result below.

Note that i tried to trigger the problem several times without success, then added the line

dashboard -style syntax_highlighting 'manni'

to my .gdbinit and got it the first time. So maybe this is related.

In any case, as you can see, it seems the problem arises whenever the register name is 16 char or more.

PC             0x004000d4   0x004000d4
SR             0xffffffff   0xffffffff
...
R14            0x00400262   0x00400262
SP             0xff8    0xff8
DEBUG1_FLAG_1  0x0  0x0
DEBUG1_FLAG_2  0x0  0x0
DEBUG_UP_FLAG  0x0  0x0
DEBUG_STACK_CFG_1÷ˆs$
0x0    0x0
DEBUG_STACK_CFG_2÷ˆs$
0x0    0x0
DEBUG_STACK_CFG_3÷ˆs$
0x0    0x0
CC_CFG         0xffffffff   0xffffffff
STANDBY_CORE_CFG<÷ˆs$
0x0    0x0
STANDBY_CORE_LVL<÷ˆs$
0x0    0x0
STANDBY_CORE_LL1<÷ˆs$
0x0    0x0
STANDBY_CORE_DBG_ENs$
0x0    0x0
STDBY_INIT_VALUE<÷ˆs$
0x0    0x0
STDBY_START_VAL0xffffffff   0xffffffff
STDBY_WAKEUP_EN0xf  0xf
cyrus-and commented 7 years ago

Thanks for the output. Well, this is quite strange. But since:

this is likely to be a problem (memory corruption?) with your platform's GDB code. You may want to try to file an issue against that if possible.

I'm closing this as there's nothing I can do, I mean I could strip invalid ASCII bytes from the register names, but it doesn't feel right. Feel free to provide additional information if you think that it could be useful.