1

How do I print the full aligned_depth.get_data(). It should be a char array: https://gist.github.com/richardrl/224eb53d4bc1cedda36f5bda1d78ca18#file-realsense_multicam-cpp-L390

These are a few things I tried:

(gdb) print *aligned_depth.get_data()@depth_size
Attempt to dereference a generic pointer.
(gdb) print (char*) aligned_depth.get_data()@depth_size
Only values in memory can be extended with '@'.
(gdb) print (char*)aligned_depth.get_data()@depth_size
Only values in memory can be extended with '@'.

get_data is here: https://intelrealsense.github.io/librealsense/doxygen/classrs2_1_1frame.html#a4b373fc81617be881b691a97b0f8358c

2

1 Answer 1

1

This should work:

(gdb) p *((char*)aligned_depth.get_data())@depth_size

At least it does work for me using GDB-10.0 given this test:

const char p[] = "abcd\0efgh";
const int  data_size = sizeof(p);
const void* get_data() { return p; }

int main() { return 0; }
gcc -g -w x.c && gdb -ex start -q ./a.out

Reading symbols from ./a.out...
Temporary breakpoint 1 at 0x113a: file x.c, line 5.
Starting program: /tmp/a.out

Temporary breakpoint 1, main () at x.c:5
5       int main() { return 0; }

(gdb) p *((char*)get_data())@data_size
$1 = "abcd\000efgh"
Sign up to request clarification or add additional context in comments.

1 Comment

does that work with dynamic size? print (char[$eax])*($rbx) is a syntax error. there seems to be no eval in gdb... currently i use p/x *($rbx)@$eax but thats verbose

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.