Hacker News new | past | comments | ask | show | jobs | submit login

GDB supports expressions on both sides of the @ sign, so you could also probably do

    p *values@array_size(values)
and that is probably short enough that you could wrap that in a macro. (Of course, Python is definitely the more extensible/hackable option - but quick 'n' dirty can often be highly effective for debugging!)



Yes, I'm aware! I didn't show/use it here to try to make it more obvious what '@' would do to those less familiar with GDB. You would also have to either manually count the number of elements or print the array size by itself afterwards (if you care about the size).

I also used this as a stepping stone into some of the more complicated extensions, which I hope to share in the future.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: