RTEMS | Draft: Add new section: .debug_gdb_scripts, across all executables on RTEMS (!98)

Suraj Kumar (@the.m3chanic) gitlab at rtems.org
Tue Jul 16 09:03:21 UTC 2024




Suraj  Kumar commented on a discussion on cpukit/sapi/src/exinit.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/98#note_109364

 >  
 > +/* 
 > + * Additional Macro to add custom section (.debug_gdb_scripts) to 
 > + * every ELF being built on RTEMS, in order to add auto-loading 
 > + * support for Python scripts (specifically, GCC's pretty-printing
 > + * scripts), by in-lining the Python script in the section.
 > + */
 > +#define DEFINE_GDB_PY() \
 > +  asm( \
 > +    ".pushsection \".debug_gdb_scripts\", \"MS\", at progbits,1\n" \
 > +    ".byte 4\n" \
 > +    ".ascii \"gdb.inlined-script\\n\"\n" \
 > +    ".ascii \"import sys\\n\"\n" \
 > +    ".ascii \"import os.path\\n\"\n" \
 > +    ".ascii \"sys.path.append(os.path.join(gdb.PYTHONDIR, 'rtems'))\\n\"\n" \
 > +    ".ascii \"import rtems.stdcxx as stdcxx\\n\"\n" \

@sebhub Also, we need not ever change this code as it essentially only points to (loads) another script in `rtems-tools`, which we can modify at will. The `stdcxx.py` script, as Chris has already mentioned, would be installed fresh with every new build with the modifications to the RSB.

@chris Are you suggesting we make a new file (`pprinters.py` ) and have that load `stdcxx.py` and other printers? What I had in mind was a little different: We could have a separate directory under `share/gdb/python/rtems` specially for RTEMS specific pretty-printers, and leave `stdcxx.py` as it is since it is only for loading the printers that GCC provides. I felt that would also provide a nice distinction between the two. We can modify `__init__.py` under `gdb/python/rtems` to automatically import every file under that directory at initialisation time, so the support is always there for both regardless and we would not need to modify the custom section at all. Please let me know what you think of this.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/98#note_109364
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20240716/19a29d2f/attachment-0001.htm>


More information about the bugs mailing list