'Two LLDB formater get called instead of one

In LLDB script I defined two formatter for two types, int8x16_t and uint8x16_t types. In each formatter I do a print, and during LLDB debugging, print int8x16_t type variable will see the two prints from the two formatter functions, instead of one. Is this an expected formatter behaviour?

Formatter

def print_int8x16_t(valobj, internal_dict):
    print(">>> print_int8x16_t")
    res = 'print_int8x16_t'
    return res

def print_uint8x16_t(valobj, internal_dict):
    print(">>> print_uint8x16_t")
    res = 'print_uint8x16_t'
    return res
def __lldb_init_module(debugger, internal_dict):
    debugger.HandleCommand('type summary add -C no -P int8x16_t -F {:s}.print_int8x16_t'.format(__name__))
    debugger.HandleCommand('type summary add -C no -P uint8x16_t -F {:s}.print_uint8x16_t'.format(__name__))

C++ Code

// NEON_2_SSE.h
typedef __m128i int8x16_t;
typedef __m128i uint8x16_t;
#include "NEON_2_SSEN.h"
int main() {
    uint8_t w8u2[16] = {1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18};
    uint8x16_t vw8u2 = vld1q_u8(w8u2);
    uint8_t buf2[16];

    vst1q_u8(buf2, vw8u2);
    printf("Done2\n");

    int8_t w8u3[16] = {-128, -127, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18};
    int8x16_t vw8u3 = vld1q_s8(w8u3);
    int8_t buf3[16];
    vst1q_s8(buf3, vw8u3);
    printf("Done3\n");
}

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source