如何让gdb调试时正确显示源代码中的汉字?

shmilyxbq 2014-10-20 10:45:59
源码中的注释:“// 类型宽度”在gdb调试的时候显示成“// 绫诲~^~K瀹藉害”,请问如何设置才能正确显示汉字?我的终端是redhat自带的,设置的编码方式是utf8,要调试的代码文件格式是:UTF-8 Unicode C program text,在vim中显示,编辑汉字都没问题
...全文
1762 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复 3
Don't let Chinese appear in your code!!!
lyyiqo 2014-10-23
  • 打赏
  • 举报
回复
引用 8 楼 JEROMEVLX 的回复:
调整终端的编码格式,应该跟gdb的没啥关系
同意楼上的
KEL-1 2014-10-21
  • 打赏
  • 举报
回复
export LANG=相应的语言
  • 打赏
  • 举报
回复
引用 5 楼 shmilyxbq 的回复:
(gdb)show host-charset 显示的也是utf8编码方式,如果有兴趣可以试一下,不过还是感谢! [quote=引用 4 楼 micropentium6 的回复:] does the host-charset is utf8 as well? (gdb)show host-charset To be honest, I never debug any program with comments in Chinese inside gdb...
[/quote] Well, I guess I am luck that I don't have to deal with locale and all these encoding things...
shmilyxbq 2014-10-21
  • 打赏
  • 举报
回复
(gdb)show host-charset 显示的也是utf8编码方式,如果有兴趣可以试一下,不过还是感谢!
引用 4 楼 micropentium6 的回复:
does the host-charset is utf8 as well? (gdb)show host-charset To be honest, I never debug any program with comments in Chinese inside gdb...
  • 打赏
  • 举报
回复
does the host-charset is utf8 as well? (gdb)show host-charset To be honest, I never debug any program with comments in Chinese inside gdb...
shmilyxbq 2014-10-21
  • 打赏
  • 举报
回复
(gdb)show target-charset 显示的是utf8编码,还是不能显示utf8源文件中的中文注释。。。
引用 1 楼 micropentium6 的回复:
what's ur current charset in gdb? (gdb)show target-charset To display the list of supported target character sets, type (gdb)set target-charset TABTAB.
JEROMEVLX 2014-10-21
  • 打赏
  • 举报
回复
调整终端的编码格式,应该跟gdb的没啥关系
  • 打赏
  • 举报
回复
(gdb)set charset charset Set the current host and target character sets to charset. As above, if you type set charset TABTAB, GDB will list the names of the character sets that can be used for both host and target.
  • 打赏
  • 举报
回复
what's ur current charset in gdb? (gdb)show target-charset To display the list of supported target character sets, type (gdb)set target-charset TABTAB.

19,619

社区成员

发帖
与我相关
我的任务
社区描述
系统使用、管理、维护问题。可以是Ubuntu, Fedora, Unix等等
社区管理员
  • 系统维护与使用区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧