[lldb/Plugin] Sort the ScriptedProcess' thread list before creating threads
With Scripted Processes, in order to create scripted threads, the blueprint provides a dictionary that have each thread index as the key with the respective thread instance as the pair value. In Python, this is fine because a dictionary key can be of any type including integer types: ``` >>> {1: "one", 2: "two", 10: "ten"} {1: 'one', 2: 'two', 10: 'ten'} ``` However, when the python dictionary gets bridged to C++ we convert it to a `StructuredData::Dictionary` that uses a `std::map<ConstString, ObjectSP>` for storage. Because `std::map` is an ordered container and ours uses the `ConstString` type for keys, the thread indices gets converted to strings which makes the dictionary sorted alphabetically, instead of numerically. If the ScriptedProcess has 10 threads or more, it causes thread “10” (and higher) to be after thread “1”, but before thread “2”. In order to solve this, this sorts the thread info dictionary keys numerically, before iterating over them to create ScriptedThreads. rdar://90327854 Differential Revision: https://reviews.llvm.org/D122429 Signed-off-by:Med Ismail Bennani <medismail.bennani@gmail.com>
Loading
Please sign in to comment