Skip to content

Unable to invoke accessors on json objects in lldb #1745

@sbroberg

Description

@sbroberg

Is there something I need to do to be able to interactively query the state of the json objects while debugging in lldb? For example, this sample program produces output as expected

#include "json.h"

int main(int argc, char **argv)
{
    json j;
    j["a"] = 1;
    j["b"] = "foo";
    j["c"] = 3;

    for (json::const_iterator element = j.begin(); element != j.end(); ++element) {
        std::cout << element.key() << ": " << element.value() << std::endl;
    }
}

but if I set a breakpoint on the "cout" line, attempting print the value of element.key() produces the error:

(lldb) print element.key()
error: Couldn't lookup symbols:
  __ZNK8nlohmann6detail9iter_implIKNS_10basic_jsonIT_S3_NSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEbxydS3_S3_EEE3keyEv

I'm currently compiling with -O0 and and -g, but I've also tried all combinations of -fno-inline -mllvm -inline-threshold=1, as well as explicitly instantiating the template with:

template class nlohmann::basic_json<
  std::__1::map,
  std::__1::vector,
  std::__1::basic_string< char, std::__1::char_traits< char >, std::__1::allocator< char > >,
  bool,
  long long,
  unsigned long long,
  double,
  std::__1::allocator,
  nlohmann::adl_serializer >;

Metadata

Metadata

Assignees

No one assigned

    Labels

    state: stalethe issue has not been updated in a while and will be closed automatically soon unless it is updated

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions