Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better display struct #500

Open
Freed-Wu opened this issue Mar 29, 2023 · 1 comment
Open

better display struct #500

Freed-Wu opened this issue Mar 29, 2023 · 1 comment

Comments

@Freed-Wu
Copy link

#if 0
gcc -g "$0" -oa && exec ./a "$@"
#endif
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
  FILE *fp = fopen("a.c", "r+");
}

In gdb,

❯ p *fp
$3 = {_flags = 0xfbad2480, _IO_read_ptr = 0x0, _IO_read_end = 0x0, _IO_read_base = 0x0,
  _IO_write_base = 0x0, _IO_write_ptr = 0x0, _IO_write_end = 0x0, _IO_buf_base = 0x0, _IO_buf_end = 0x0,
  _IO_save_base = 0x0, _IO_backup_base = 0x0, _IO_save_end = 0x0, _markers = 0x0,
  _chain = 0x7ffff7ec74c0 <_IO_2_1_stderr_>, _fileno = 0xa, _flags2 = 0x0, _old_offset = 0x0,
  _cur_column = 0x0, _vtable_offset = 0x0, _shortbuf = "", _lock = 0x555555559380,
  _offset = 0xffffffffffffffff, _codecvt = 0x0, _wide_data = 0x555555559390, _freeres_list = 0x0,
  _freeres_buf = 0x0, __pad5 = 0x0, _mode = 0x0, _unused2 = '\000' <repeats 19 times>}
❯ p fp
$4 = (FILE *) 0x5555555592a0

screen-2023-03-29-17-05-46

In cling:

[cling]$ #include <stdio.h>
[cling]$ FILE *fp = fopen("a.c", "r+");
[cling]$ fp
(FILE *) 0x55b016c9e3f0
[cling]$ *fp
(FILE &) @0x55b016c9e3f0

Why not let *fp display like gdb?

@Axel-Naumann
Copy link
Member

Agreed, that would be nice! I'm not sure we (CERN) will have anyone who can work on this - we have different plans, such as rebasing cling on top of clang-repl etc... I.e. we have plans, but not that one :-)

Which means: PRs welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants