Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

pretty print c struct's content at runtime.

License

NotificationsYou must be signed in to change notification settings

haifenghuang/pprint4c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pretty print struct's content at runtime.

Use

  • Need to output struct pointer's contents at runtime
  • Don't care about the speed
  • For debugging purpose

Don't use

  • For production environment
  • Care about the speed

Example

structperson{intage;intheight;structlike {char*type;char*name;    }like;};intmain(){structpersonjohndoe= {    .age=6,    .like= {      .type="Software-Developing",      .name="C"    }  };structInfoperson_info[]= {    {      .data=&johndoe,      .structName="person",      .level=0/* the first must be level 0 */    },  };pprint_struct("johndoe",person_info,ARRAY_SIZE(person_info));return0;}

Result:

johndoe = {  age = 6,   height = 0,   like = {    type = 0x400934 "Software-Developing",     name = 0x400948 "C"  }}

Limitation

  • Only works for gdb debugger
  • Only tested on linux

see also

stackoverflow

License

MIT

About

pretty print c struct's content at runtime.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp