[Bug build/30488] New: [gdb/build] Code guarded with HANDLE_MULTIBYTE is dead

vries at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Thu May 25 11:48:30 GMT 2023


https://sourceware.org/bugzilla/show_bug.cgi?id=30488

            Bug ID: 30488
           Summary: [gdb/build] Code guarded with HANDLE_MULTIBYTE is dead
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: build
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

I noticed a use of HANDLE_MULTIBYTE in gdb:
...
./gdb/completer.c:#if defined (HANDLE_MULTIBYTE)
./gdb/completer.c:#if defined (HANDLE_MULTIBYTE)
./gdb/completer.c:#if defined (HANDLE_MULTIBYTE)
./gdb/completer.c:#if defined (HANDLE_MULTIBYTE)
./gdb/completer.c:#if defined (HANDLE_MULTIBYTE)
./gdb/completer.c:#if defined (HANDLE_MULTIBYTE)
./gdb/completer.c:#if defined (HANDLE_MULTIBYTE)
...
while the macro seems to be defined in readline:
...
./readline/readline/rlmbutil.h:#    define HANDLE_MULTIBYTE      1
...

I first looked at system readline.

It seems that the library is build with multi-byte support:
...
$ nm -D /lib64/libreadline.so.7.0 | grep mbrtowc
                 U mbrtowc
...

But in the exported header files the macro is not set in any way:
...
$ find /usr/include/readline/ -type f | xargs grep HANDLE_MULTIBYTE
$
...

I then tried without system readline, and build gdb with this patch:
...
diff --git a/gdb/completer.c b/gdb/completer.c
index 91a29daee36..62bd87cc939 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -2435,6 +2435,7 @@ get_max_completions_reached_message (void)
 #undef VISIBLE_STATS

 #if defined (HANDLE_MULTIBYTE)
+#error bla
 #define MB_INVALIDCH(x) ((x) == (size_t)-1 || (x) == (size_t)-2)
 #define MB_NULLWCH(x)   ((x) == 0)
 #endif
...
which build fine.

So, in both cases HANDLE_MULTIBYTE is undefined, and the code guarded by it is
currently dead.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list