LLVM Discussion Forums

LLDB RegInfoBasedABI

Hi,

I’m working on a GDB Server Stub and bumped in to a problem with LLDB.
I run into a problem where LLDB will fail on an assertion in the following pice of code in ABI.cpp:

bool RegInfoBasedABI::GetRegisterInfoByName(ConstString name, RegisterInfo &info) {
  uint32_t count = 0;
  const RegisterInfo *register_info_array = GetRegisterInfoArray(count);
  if (register_info_array) {
    const char *unique_name_cstr = name.GetCString();
    uint32_t i;
    for (i = 0; i < count; ++i) {
      const char *reg_name = register_info_array[i].name;
      assert(ConstString(reg_name).GetCString() == reg_name &&
             "register_info_array[i].name not from a ConstString?");
      if (reg_name == unique_name_cstr) {
        info = register_info_array[i];
        return true;
      }
    }

This assertion will always fail because the register_info_array is static const defined in the ABI*.cpp files.
I’m new to this forum, if this question should be asked elsewhere please point me to that.

Raphael explained to me over email that some ABI files need to be converted to use ConstString.

The reason why the assert triggers for you is because the ABI subclass you’re using
is suffering from the fact that it doesn’t generate its register names with ConstString.

My question is resolved.
thanks.