gdbinit / Gdbinit

Gdbinit for OS X, iOS and others - x86, x86_64 and ARM
https://reverse.put.as
1.69k stars 458 forks source link

Don't color prompt when $USECOLOR == 0 #20

Closed tyilo closed 10 years ago

gdbinit commented 10 years ago

I think they should stay independent because colored prompt has issues with history and can be disabled now from the .gdbinit.local file.

tyilo commented 10 years ago

With this you can still have non-colored prompt and other colors using $USECOLOR == 1 and $COLOREDPROMPT == 0.

This only has an effect if $USECOLOR == 0 and $COLOREDPROMPT == 1, where then the prompt will not be colored.

gdbinit commented 10 years ago

Er... if usecolor is 0 the prompt will never be colored, which might not be what is intended.

tyilo commented 10 years ago

Hmm... maybe add a $NEVERUSECOLOR or something like that, which will disable all colors every where. $USECOLOR == 0 and $COLOREDPROMPT == 0 doesn't disable all colors.

See lines https://github.com/gdbinit/Gdbinit/blob/master/gdbinit#L150 and https://github.com/gdbinit/Gdbinit/blob/master/gdbinit#L194-L204 .

This may not be a problem normally as the colors will not do anything, when $USECOLOR == 0. However if you use a term that doesn't support colors at all (eg. Hopper's GDB Window), different outputs will be filled with [0m's.

gdbinit commented 10 years ago

Let me check it out and add that option to really disable all the colors :-)

tyilo commented 10 years ago

Also one last thing: I thought about checking the $TERM env variable for starting with xterm. If it doesn't, the terminal probably doesn't support colors and you could then set $NEVERUSECOLOR to 1.

gdbinit commented 10 years ago

That could work, needs some shell hacky stuff to retrieve that var. As far as I know you can't get the env variables in gdb. Or can I?

tyilo commented 10 years ago

So yeah you'll need to use shell echo $TERM with redirected stdout etc. :/

gdbinit commented 10 years ago

Check what I just commit. It should those issues with Hopper and terminals with problems.

tyilo commented 10 years ago

Works for me, thanks