0

As an example lets say I have a linked list implemented in C. Can I use the GDB python API to implement a custom array access operator so that I can get a value from the list like myList[0] while debugging?

Have tried reading through the docs but could find nothing on it

3
  • With the XMethod API this should be possible, but I don't actually know if this would work for C as well (since you can't define operator[] in C). Commented Feb 20, 2023 at 5:36
  • Thank you! That half works it seems. I can define xmethods, but they don't seem to run for C (I need to set the language to c++ and then they run) Commented Feb 20, 2023 at 9:37
  • @YupDeDup Indeed. The XMethod API is designed to provide C++ operators - often these operators are inlined in compiled code and so not available for GDB to call while debugging. As C has no operator overload feature the XMethods are not applied when debugging C code. Commented Feb 20, 2023 at 10:51

0

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.