Skip to content

Commit

Permalink
Fix bad inline GDB pretty printer escaping.
Browse files Browse the repository at this point in the history
  • Loading branch information
ned14 committed Aug 12, 2024
1 parent a6689af commit 9d03628
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions include/status-code/status_code.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,17 +717,21 @@ SYSTEM_ERROR2_NAMESPACE_END

#ifndef SYSTEM_ERROR2_DISABLE_INLINE_GDB_PRETTY_PRINTERS
#if defined(__ELF__)
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverlength-strings"
#endif
__asm__(
".pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n"
".byte 4 /* Python Text */\n"
".ascii \"\\4SYSTEM_ERROR2_INLINE_GDB_PRETTY_PRINTERS_H\\n\"\n"
".ascii \"gdb.inlined-script\\n\"\n"
".ascii \"import gdb.printing\\n\"\n"
".ascii \"import gdb\\n\"\n"
".ascii \"import os\\n\"\n"

".ascii \"def synthesise_gdb_value_from_string(s):\\n\"\n"
".ascii \" '''For when you want to return a synthetic string from children()'''\\n\"\n"
".ascii \" return gdb.Value(s + '\\0').cast(gdb.lookup_type('char').pointer())\\n\"\n"
".ascii \" return gdb.Value(s + '\\\\0').cast(gdb.lookup_type('char').pointer())\\n\"\n"

".ascii \"class StatusCodePrinter(object):\\n\"\n"
".ascii \" '''Print a system_error2::status_code<T>'''\\n\"\n"
Expand Down Expand Up @@ -761,9 +765,13 @@ __asm__(
".ascii \" gdb.printing.register_pretty_printer(obj, build_pretty_printer(), replace = True)\\n\"\n"

".ascii \"register_printers(gdb.current_objfile())\\n\"\n"

".byte 0\n"
".popsection\n");
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif
#endif // defined(__ELF__)
#endif // !defined(SYSTEM_ERROR2_DISABLE_INLINE_GDB_PRETTY_PRINTERS)

#endif

0 comments on commit 9d03628

Please sign in to comment.