[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-23 Thread Greg Clayton via lldb-commits
@@ -0,0 +1,65 @@ +//===-- SBAddressRange.h *- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-23 Thread Greg Clayton via lldb-commits
@@ -0,0 +1,28 @@ +%extend lldb::SBAddressRangeList { +#ifdef SWIGPYTHON +%pythoncode%{ +def __len__(self): + '''Return the number of address ranges in a lldb.SBAddressRangeList object.''' + return self.GetSize() + +def __iter__(self): + '''Iterate over

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-23 Thread Greg Clayton via lldb-commits
@@ -0,0 +1,65 @@ +//===-- SBAddressRange.h *- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)

2024-05-22 Thread Greg Clayton via lldb-commits
@@ -570,11 +586,13 @@ static void ParseOpenBSDProcInfo(ThreadData _data, } llvm::Expected> -ProcessElfCore::parseSegment(const DataExtractor ) { +ProcessElfCore::parseSegment(const DataExtractor , + unsigned long segment_size) { lldb::offset_t

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)

2024-05-22 Thread Greg Clayton via lldb-commits
@@ -983,6 +1001,66 @@ llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment( } } +bool ProcessElfCore::IsElf(lldb::addr_t address) { + uint8_t buf[4]; + Status error; + size_t byte_read = ReadMemory(address, buf, 4, error); + if (byte_read != 4) +return

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)

2024-05-22 Thread Greg Clayton via lldb-commits
@@ -983,6 +1001,66 @@ llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment( } } +bool ProcessElfCore::IsElf(lldb::addr_t address) { + uint8_t buf[4]; + Status error; + size_t byte_read = ReadMemory(address, buf, 4, error); + if (byte_read != 4) +return

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)

2024-05-22 Thread Greg Clayton via lldb-commits
@@ -983,6 +1001,66 @@ llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment( } } +bool ProcessElfCore::IsElf(lldb::addr_t address) { + uint8_t buf[4]; + Status error; + size_t byte_read = ReadMemory(address, buf, 4, error); + if (byte_read != 4) +return

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)

2024-05-22 Thread Greg Clayton via lldb-commits
@@ -983,6 +1001,66 @@ llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment( } } +bool ProcessElfCore::IsElf(lldb::addr_t address) { + uint8_t buf[4]; + Status error; + size_t byte_read = ReadMemory(address, buf, 4, error); + if (byte_read != 4) +return

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)

2024-05-22 Thread Greg Clayton via lldb-commits
@@ -117,6 +117,7 @@ class ProcessElfCore : public lldb_private::PostMortemProcess { lldb::addr_t end; lldb::addr_t file_ofs; std::string path; +lldb_private::UUID uuid; //.note.gnu.build-id clayborg wrote: Add a comment letting the user know

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)

2024-05-22 Thread Greg Clayton via lldb-commits
https://github.com/clayborg requested changes to this pull request. https://github.com/llvm/llvm-project/pull/92492 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)

2024-05-22 Thread Greg Clayton via lldb-commits
@@ -570,11 +586,13 @@ static void ParseOpenBSDProcInfo(ThreadData _data, } llvm::Expected> -ProcessElfCore::parseSegment(const DataExtractor ) { +ProcessElfCore::parseSegment(const DataExtractor , + unsigned long segment_size) {

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)

2024-05-22 Thread Greg Clayton via lldb-commits
https://github.com/clayborg edited https://github.com/llvm/llvm-project/pull/92492 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)

2024-05-22 Thread Greg Clayton via lldb-commits
@@ -983,6 +1001,66 @@ llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment( } } +bool ProcessElfCore::IsElf(lldb::addr_t address) { + uint8_t buf[4]; + Status error; + size_t byte_read = ReadMemory(address, buf, 4, error); + if (byte_read != 4) +return

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)

2024-05-22 Thread Greg Clayton via lldb-commits
@@ -167,7 +178,8 @@ class ProcessElfCore : public lldb_private::PostMortemProcess { AddAddressRangeFromMemoryTagSegment(const elf::ELFProgramHeader ); llvm::Expected> - parseSegment(const lldb_private::DataExtractor ); + parseSegment(const lldb_private::DataExtractor ,

[Lldb-commits] [lldb] [lldb/DWARF] Make sure bad abbreviation codes do not crash lldb (PR #93006)

2024-05-22 Thread Greg Clayton via lldb-commits
https://github.com/clayborg commented: We have to back out the PeekDieName() patch locally at Meta because it was crashing us due to this assertion due to .debug_names tables having incorrect values for type units. Only one type unit will appear in the final file and type units can have

[Lldb-commits] [lldb] [lldb] Added Debuginfod tests and fixed a couple issues (PR #92572)

2024-05-22 Thread Greg Clayton via lldb-commits
https://github.com/clayborg closed https://github.com/llvm/llvm-project/pull/92572 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb] Added Debuginfod tests and fixed a couple issues (PR #92572)

2024-05-22 Thread Greg Clayton via lldb-commits
https://github.com/clayborg approved this pull request. https://github.com/llvm/llvm-project/pull/92572 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb] Adds additional fields to ProcessInfo (PR #91544)

2024-05-20 Thread Greg Clayton via lldb-commits
@@ -250,10 +268,12 @@ class ProcessInstanceInfo : public ProcessInfo { lldb::pid_t m_parent_pid = LLDB_INVALID_PROCESS_ID; lldb::pid_t m_process_group_id = LLDB_INVALID_PROCESS_ID; lldb::pid_t m_process_session_id = LLDB_INVALID_PROCESS_ID; - struct timespec m_user_time

[Lldb-commits] [lldb] [lldb] Adds additional fields to ProcessInfo (PR #91544)

2024-05-20 Thread Greg Clayton via lldb-commits
@@ -195,48 +195,66 @@ class ProcessInstanceInfo : public ProcessInfo { return m_process_session_id != LLDB_INVALID_PROCESS_ID; } - struct timespec GetUserTime() const { return m_user_time; } + struct timespec GetUserTime() const { return m_user_time.value(); }

[Lldb-commits] [lldb] [lldb] Adds additional fields to ProcessInfo (PR #91544)

2024-05-20 Thread Greg Clayton via lldb-commits
@@ -195,48 +195,66 @@ class ProcessInstanceInfo : public ProcessInfo { return m_process_session_id != LLDB_INVALID_PROCESS_ID; } - struct timespec GetUserTime() const { return m_user_time; } + struct timespec GetUserTime() const { return m_user_time.value(); }

[Lldb-commits] [lldb] [lldb] Adds additional fields to ProcessInfo (PR #91544)

2024-05-20 Thread Greg Clayton via lldb-commits
@@ -195,48 +195,66 @@ class ProcessInstanceInfo : public ProcessInfo { return m_process_session_id != LLDB_INVALID_PROCESS_ID; } - struct timespec GetUserTime() const { return m_user_time; } + struct timespec GetUserTime() const { return m_user_time.value(); }

[Lldb-commits] [lldb] [lldb] Adds additional fields to ProcessInfo (PR #91544)

2024-05-20 Thread Greg Clayton via lldb-commits
https://github.com/clayborg requested changes to this pull request. We should either truly use `std::optional` and return `std::optional` for all getters, or just not use them. This patch adds a `bool IsZombieValid()` which the user must know to call prior to calling `bool IsZombie()`, which

[Lldb-commits] [lldb] [lldb] Adds additional fields to ProcessInfo (PR #91544)

2024-05-20 Thread Greg Clayton via lldb-commits
@@ -195,48 +195,66 @@ class ProcessInstanceInfo : public ProcessInfo { return m_process_session_id != LLDB_INVALID_PROCESS_ID; } - struct timespec GetUserTime() const { return m_user_time; } + struct timespec GetUserTime() const { return m_user_time.value(); }

[Lldb-commits] [lldb] [lldb] Adds additional fields to ProcessInfo (PR #91544)

2024-05-20 Thread Greg Clayton via lldb-commits
@@ -250,10 +268,12 @@ class ProcessInstanceInfo : public ProcessInfo { lldb::pid_t m_parent_pid = LLDB_INVALID_PROCESS_ID; lldb::pid_t m_process_group_id = LLDB_INVALID_PROCESS_ID; lldb::pid_t m_process_session_id = LLDB_INVALID_PROCESS_ID; - struct timespec m_user_time

[Lldb-commits] [lldb] [lldb] Adds additional fields to ProcessInfo (PR #91544)

2024-05-20 Thread Greg Clayton via lldb-commits
https://github.com/clayborg edited https://github.com/llvm/llvm-project/pull/91544 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb] Adds additional fields to ProcessInfo (PR #91544)

2024-05-20 Thread Greg Clayton via lldb-commits
@@ -147,96 +148,111 @@ class ProcessInstanceInfo : public ProcessInfo { ProcessInstanceInfo() = default; ProcessInstanceInfo(const char *name, const ArchSpec , lldb::pid_t pid) - : ProcessInfo(name, arch, pid), m_euid(UINT32_MAX), m_egid(UINT32_MAX), -

[Lldb-commits] [lldb] SBDebugger: Add new APIs `AddDestroyCallback` and `RemoveDestroyCallback` (PR #89868)

2024-05-20 Thread Greg Clayton via lldb-commits
https://github.com/clayborg closed https://github.com/llvm/llvm-project/pull/89868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] Add new Python API `SBCommandInterpreter::GetTranscript()` (PR #90703)

2024-05-20 Thread Greg Clayton via lldb-commits
https://github.com/clayborg closed https://github.com/llvm/llvm-project/pull/90703 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-20 Thread Greg Clayton via lldb-commits
@@ -203,3 +208,38 @@ void AddressRange::DumpDebug(Stream *s) const { static_cast(m_base_addr.GetSection().get()), m_base_addr.GetOffset(), GetByteSize()); } + +bool AddressRange::GetDescription(Stream *s, Target *target) const { + const char *file_name

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-20 Thread Greg Clayton via lldb-commits
@@ -0,0 +1,65 @@ +//===-- SBAddressRange.h *- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-20 Thread Greg Clayton via lldb-commits
@@ -0,0 +1,216 @@ +""" +Test SBAddressRange APIs. +""" + +import lldb +from lldbsuite.test.lldbtest import * + + +class AddressRangeTestCase(TestBase): +NO_DEBUG_INFO_TESTCASE = True + +def setUp(self): +TestBase.setUp(self) + +self.build() +exe =

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-20 Thread Greg Clayton via lldb-commits
@@ -203,3 +208,38 @@ void AddressRange::DumpDebug(Stream *s) const { static_cast(m_base_addr.GetSection().get()), m_base_addr.GetOffset(), GetByteSize()); } + +bool AddressRange::GetDescription(Stream *s, Target *target) const { + const char *file_name

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-20 Thread Greg Clayton via lldb-commits
@@ -203,3 +208,38 @@ void AddressRange::DumpDebug(Stream *s) const { static_cast(m_base_addr.GetSection().get()), m_base_addr.GetOffset(), GetByteSize()); } + +bool AddressRange::GetDescription(Stream *s, Target *target) const { + const char *file_name

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-20 Thread Greg Clayton via lldb-commits
https://github.com/clayborg requested changes to this pull request. See inlined comments as the `SBAddressRange::GetDescription()` could have crashed if we had an address with a no section and we did supply a valid target. So changes needed: - add a test for a SBAddressRange object that is

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-20 Thread Greg Clayton via lldb-commits
https://github.com/clayborg edited https://github.com/llvm/llvm-project/pull/92014 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] SBDebugger: Add new APIs `AddDestroyCallback` and `RemoveDestroyCallback` (PR #89868)

2024-05-20 Thread Greg Clayton via lldb-commits
https://github.com/clayborg approved this pull request. Thanks for all of the changes. Looks good. https://github.com/llvm/llvm-project/pull/89868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org

[Lldb-commits] [lldb] Add new Python API `SBCommandInterpreter::GetTranscript()` (PR #90703)

2024-05-20 Thread Greg Clayton via lldb-commits
https://github.com/clayborg approved this pull request. https://github.com/llvm/llvm-project/pull/90703 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] Improve performance of .debug_names lookups when DW_IDX_parent attributes are used (PR #91808)

2024-05-20 Thread Greg Clayton via lldb-commits
clayborg wrote: > What's an actual test case for this issue? The example given above doesn't > look like it'd produce entries for the declaration of ios_base? Like here's > something that looks equivalent, but is complete, and doesn't have a > DW_IDX_parent on the nested typedef entry in the

[Lldb-commits] [lldb] Add new Python API `SBCommandInterpreter::GetTranscript()` (PR #90703)

2024-05-20 Thread Greg Clayton via lldb-commits
https://github.com/clayborg edited https://github.com/llvm/llvm-project/pull/90703 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] Add new Python API `SBCommandInterpreter::GetTranscript()` (PR #90703)

2024-05-20 Thread Greg Clayton via lldb-commits
@@ -766,6 +771,14 @@ class CommandInterpreter : public Broadcaster, CommandUsageMap m_command_usages; StreamString m_transcript_stream; clayborg wrote: We should mention in a comment that this will only be filled in if the setting is true.

[Lldb-commits] [lldb] Add new Python API `SBCommandInterpreter::GetTranscript()` (PR #90703)

2024-05-20 Thread Greg Clayton via lldb-commits
https://github.com/clayborg commented: Just a few comments to fixup as mentioned and this is good to go. https://github.com/llvm/llvm-project/pull/90703 ___ lldb-commits mailing list lldb-commits@lists.llvm.org

[Lldb-commits] [lldb] Add new Python API `SBCommandInterpreter::GetTranscript()` (PR #90703)

2024-05-20 Thread Greg Clayton via lldb-commits
@@ -766,6 +771,14 @@ class CommandInterpreter : public Broadcaster, CommandUsageMap m_command_usages; StreamString m_transcript_stream; + + /// Contains a list of handled commands and their details. Each element in clayborg wrote: We should mention the

[Lldb-commits] [lldb] SBDebugger: Add new APIs `AddDestroyCallback` and `RemoveDestroyCallback` (PR #89868)

2024-05-20 Thread Greg Clayton via lldb-commits
@@ -62,12 +62,15 @@ typedef void *thread_arg_t; // Host thread argument type typedef void *thread_result_t; // Host thread result type typedef void *(*thread_func_t)(void *); // Host thread function type typedef int pipe_t; // Host

[Lldb-commits] [lldb] SBDebugger: Add new APIs `AddDestroyCallback` and `RemoveDestroyCallback` (PR #89868)

2024-05-20 Thread Greg Clayton via lldb-commits
@@ -62,12 +62,15 @@ typedef void *thread_arg_t; // Host thread argument type typedef void *thread_result_t; // Host thread result type typedef void *(*thread_func_t)(void *); // Host thread function type typedef int pipe_t; // Host

[Lldb-commits] [lldb] SBDebugger: Add new APIs `AddDestroyCallback` and `RemoveDestroyCallback` (PR #89868)

2024-05-20 Thread Greg Clayton via lldb-commits
@@ -731,8 +747,12 @@ class Debugger : public std::enable_shared_from_this, lldb::TargetSP m_dummy_target_sp; Diagnostics::CallbackID m_diagnostics_callback_id; - lldb_private::DebuggerDestroyCallback m_destroy_callback = nullptr; - void *m_destroy_callback_baton =

[Lldb-commits] [lldb] SBDebugger: Add new APIs `AddDestroyCallback` and `RemoveDestroyCallback` (PR #89868)

2024-05-20 Thread Greg Clayton via lldb-commits
@@ -1427,8 +1440,30 @@ void Debugger::SetLoggingCallback(lldb::LogOutputCallback log_callback, void Debugger::SetDestroyCallback( lldb_private::DebuggerDestroyCallback destroy_callback, void *baton) { - m_destroy_callback = destroy_callback; - m_destroy_callback_baton

[Lldb-commits] [lldb] SBDebugger: Add new APIs `AddDestroyCallback` and `RemoveDestroyCallback` (PR #89868)

2024-05-20 Thread Greg Clayton via lldb-commits
@@ -731,8 +747,12 @@ class Debugger : public std::enable_shared_from_this, lldb::TargetSP m_dummy_target_sp; Diagnostics::CallbackID m_diagnostics_callback_id; - lldb_private::DebuggerDestroyCallback m_destroy_callback = nullptr; - void *m_destroy_callback_baton =

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)

2024-05-17 Thread Greg Clayton via lldb-commits
@@ -983,6 +1005,73 @@ llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment( } } +bool ProcessElfCore::IsElf(const lldb::addr_t address) { + uint8_t buf[4]; + Status error; + size_t byte_read = ReadMemory(address, buf, 4, error); + if (byte_read != 4) +

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)

2024-05-17 Thread Greg Clayton via lldb-commits
@@ -983,6 +1005,73 @@ llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment( } } +bool ProcessElfCore::IsElf(const lldb::addr_t address) { + uint8_t buf[4]; + Status error; + size_t byte_read = ReadMemory(address, buf, 4, error); + if (byte_read != 4) +

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)

2024-05-17 Thread Greg Clayton via lldb-commits
@@ -1649,6 +1679,26 @@ class Process : public std::enable_shared_from_this, lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status ); + /// Find a string within a memory region. + /// + /// This function searches for the string represented by the provided

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)

2024-05-17 Thread Greg Clayton via lldb-commits
@@ -33,12 +35,17 @@ #include "Plugins/Process/elf-core/RegisterUtilities.h" #include "ProcessElfCore.h" #include "ThreadElfCore.h" +#include "lldb/lldb-types.h" using namespace lldb_private; namespace ELF = llvm::ELF; LLDB_PLUGIN_DEFINE(ProcessElfCore) +#define

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)

2024-05-17 Thread Greg Clayton via lldb-commits
@@ -117,6 +117,13 @@ class ProcessElfCore : public lldb_private::PostMortemProcess { lldb::addr_t end; lldb::addr_t file_ofs; std::string path; +lldb_private::UUID uuid; //.note.gnu.build-id + }; + + struct Section_Note { +uint32_t namesz; +uint32_t

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)

2024-05-17 Thread Greg Clayton via lldb-commits
@@ -983,6 +1005,73 @@ llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment( } } +bool ProcessElfCore::IsElf(const lldb::addr_t address) { + uint8_t buf[4]; + Status error; + size_t byte_read = ReadMemory(address, buf, 4, error); + if (byte_read != 4) +

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)

2024-05-17 Thread Greg Clayton via lldb-commits
@@ -1649,6 +1679,26 @@ class Process : public std::enable_shared_from_this, lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status ); + /// Find a string within a memory region. clayborg wrote: Change to: ``` /// Find bytes within a memory

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)

2024-05-17 Thread Greg Clayton via lldb-commits
@@ -1649,6 +1679,26 @@ class Process : public std::enable_shared_from_this, lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status ); + /// Find a string within a memory region. + /// + /// This function searches for the string represented by the provided

[Lldb-commits] [lldb] [LLDB/Coredump] Only take the Pthread from stack start to the stackpointer + red_zone (PR #92002)

2024-05-16 Thread Greg Clayton via lldb-commits
https://github.com/clayborg closed https://github.com/llvm/llvm-project/pull/92002 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [LLDB/Coredump] Only take the Pthread from stack start to the stackpointer + red_zone (PR #92002)

2024-05-16 Thread Greg Clayton via lldb-commits
https://github.com/clayborg approved this pull request. https://github.com/llvm/llvm-project/pull/92002 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [LLDB/Coredump] Only take the Pthread from stack start to the stackpointer + red_zone (PR #92002)

2024-05-16 Thread Greg Clayton via lldb-commits
@@ -6335,16 +6335,51 @@ static void AddRegion(const MemoryRegionInfo , bool try_dirty_pages, ranges.push_back(CreateCoreFileMemoryRange(region)); } +static void +SaveOffRegionsWithStackPointers(Process , + const MemoryRegionInfos , +

[Lldb-commits] [lldb] [LLDB/Coredump] Only take the Pthread from stack start to the stackpointer + red_zone (PR #92002)

2024-05-16 Thread Greg Clayton via lldb-commits
@@ -490,9 +491,12 @@ findStackHelper(const lldb::ProcessSP _sp, uint64_t rsp) { return llvm::createStringError( std::errc::not_supported, "unable to load stack segment of the process"); - - const addr_t addr = range_info.GetRange().GetRangeBase(); -

[Lldb-commits] [lldb] [LLDB/Coredump] Only take the Pthread from stack start to the stackpointer + red_zone (PR #92002)

2024-05-16 Thread Greg Clayton via lldb-commits
@@ -6335,16 +6335,51 @@ static void AddRegion(const MemoryRegionInfo , bool try_dirty_pages, ranges.push_back(CreateCoreFileMemoryRange(region)); } +static void +SaveOffRegionsWithStackPointers(Process , + const MemoryRegionInfos , +

[Lldb-commits] [lldb] [LLDB/Coredump] Only take the Pthread from stack start to the stackpointer + red_zone (PR #92002)

2024-05-16 Thread Greg Clayton via lldb-commits
https://github.com/clayborg requested changes to this pull request. https://github.com/llvm/llvm-project/pull/92002 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [LLDB/Coredump] Only take the Pthread from stack start to the stackpointer + red_zone (PR #92002)

2024-05-16 Thread Greg Clayton via lldb-commits
https://github.com/clayborg edited https://github.com/llvm/llvm-project/pull/92002 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [LLDB/Coredump] Only take the Pthread from stack start to the stackpointer + red_zone (PR #92002)

2024-05-16 Thread Greg Clayton via lldb-commits
@@ -6335,16 +6335,51 @@ static void AddRegion(const MemoryRegionInfo , bool try_dirty_pages, ranges.push_back(CreateCoreFileMemoryRange(region)); } +static void +SaveOffRegionsWithStackPointers(Process , + const MemoryRegionInfos , +

[Lldb-commits] [lldb] [LLDB/Coredump] Only take the Pthread from stack start to the stackpointer + red_zone (PR #92002)

2024-05-16 Thread Greg Clayton via lldb-commits
@@ -6410,12 +6410,20 @@ GetCoreFileSaveRangesStackOnly(Process , if (!reg_ctx_sp) continue; const addr_t sp = reg_ctx_sp->GetSP(); +const size_t red_zone = process.GetABI()->GetRedZoneSize(); lldb_private::MemoryRegionInfo sp_region; if

[Lldb-commits] [lldb] SBDebugger: Add new APIs `AddDestroyCallback` and `RemoveDestroyCallback` (PR #89868)

2024-05-16 Thread Greg Clayton via lldb-commits
@@ -731,8 +746,11 @@ class Debugger : public std::enable_shared_from_this, lldb::TargetSP m_dummy_target_sp; Diagnostics::CallbackID m_diagnostics_callback_id; - lldb_private::DebuggerDestroyCallback m_destroy_callback = nullptr; - void *m_destroy_callback_baton =

[Lldb-commits] [lldb] Add new Python API `SBCommandInterpreter::GetTranscript()` (PR #90703)

2024-05-16 Thread Greg Clayton via lldb-commits
@@ -766,6 +768,12 @@ class CommandInterpreter : public Broadcaster, CommandUsageMap m_command_usages; StreamString m_transcript_stream; + + /// Contains a list of handled commands, output and error. Each element in + /// the list is a dictionary with three keys:

[Lldb-commits] [lldb] Add new Python API `SBCommandInterpreter::GetTranscript()` (PR #90703)

2024-05-16 Thread Greg Clayton via lldb-commits
@@ -766,6 +768,12 @@ class CommandInterpreter : public Broadcaster, CommandUsageMap m_command_usages; StreamString m_transcript_stream; + + /// Contains a list of handled commands, output and error. Each element in + /// the list is a dictionary with three keys:

[Lldb-commits] [lldb] Add new Python API `SBCommandInterpreter::GetTranscript()` (PR #90703)

2024-05-16 Thread Greg Clayton via lldb-commits
@@ -571,6 +571,15 @@ SBStructuredData SBCommandInterpreter::GetStatistics() { return data; } +SBStructuredData SBCommandInterpreter::GetTranscript() { + LLDB_INSTRUMENT_VA(this); + + SBStructuredData data; + if (IsValid()) +

[Lldb-commits] [lldb] Add new Python API `SBCommandInterpreter::GetTranscript()` (PR #90703)

2024-05-16 Thread Greg Clayton via lldb-commits
@@ -766,6 +768,12 @@ class CommandInterpreter : public Broadcaster, CommandUsageMap m_command_usages; StreamString m_transcript_stream; + + /// Contains a list of handled commands, output and error. Each element in + /// the list is a dictionary with three keys:

[Lldb-commits] [lldb] SBDebugger: Add new APIs `AddDestroyCallback` and `RemoveDestroyCallback` (PR #89868)

2024-05-15 Thread Greg Clayton via lldb-commits
@@ -743,9 +743,28 @@ DebuggerSP Debugger::CreateInstance(lldb::LogOutputCallback log_callback, } void Debugger::HandleDestroyCallback() { - if (m_destroy_callback) { -m_destroy_callback(GetID(), m_destroy_callback_baton); -m_destroy_callback = nullptr; +

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-15 Thread Greg Clayton via lldb-commits
@@ -0,0 +1,102 @@ +//===-- SBAddressRange.cpp ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92078)

2024-05-14 Thread Greg Clayton via lldb-commits
clayborg wrote: > Can we make this less brute force? I believe searching for the Build ID Note > should be a completely deterministic process, without the need for > heuristics. You start with the elf header, find the program headers, iterate > to find the PT_NOTE segment (there could be more

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-14 Thread Greg Clayton via lldb-commits
@@ -0,0 +1,78 @@ +//===-- SBAddressRange.cpp ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-14 Thread Greg Clayton via lldb-commits
@@ -0,0 +1,58 @@ +//===-- SBAddressRangeList.h *- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-14 Thread Greg Clayton via lldb-commits
@@ -0,0 +1,13 @@ +%extend lldb::SBAddressRangeList { +#ifdef SWIGPYTHON +%pythoncode%{ +def __len__(self): + '''Return the number of address ranges in a lldb.SBAddressRangeList object.''' + return self.GetSize() + +def __iter__(self): + '''Iterate over

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-14 Thread Greg Clayton via lldb-commits
@@ -0,0 +1,13 @@ +%extend lldb::SBAddressRangeList { clayborg wrote: If we add a method to SBAddressRangeList: ``` bool GetDescription(lldb::SBStream ); ``` Then we can add this to this file: ``` STRING_EXTENSION_OUTSIDE(SBAddressRangeList) ``` And then we can

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-14 Thread Greg Clayton via lldb-commits
https://github.com/clayborg commented: We might want SBAddressRange and SBAddressRangeList to have methods: ``` bool GetDescription(lldb::SBStream ); ``` Then make sure we add stuff to the .i files so python `str()` calls this. We do this in many other classes.

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-14 Thread Greg Clayton via lldb-commits
@@ -0,0 +1,13 @@ +%extend lldb::SBAddressRangeList { +#ifdef SWIGPYTHON +%pythoncode%{ +def __len__(self): + '''Return the number of address ranges in a lldb.SBAddressRangeList object.''' + return self.GetSize() + +def __iter__(self): + '''Iterate over

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92078)

2024-05-14 Thread Greg Clayton via lldb-commits
@@ -983,6 +995,44 @@ llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment( } } +bool ProcessElfCore::IsElf(const NT_FILE_Entry entry) { + const uint8_t elf_header[4] = {0x7f, 0x45, 0x4c, + 0x46}; // ELF file begin with this 4

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92078)

2024-05-14 Thread Greg Clayton via lldb-commits
@@ -983,6 +995,44 @@ llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment( } } +bool ProcessElfCore::IsElf(const NT_FILE_Entry entry) { + const uint8_t elf_header[4] = {0x7f, 0x45, 0x4c, + 0x46}; // ELF file begin with this 4

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92078)

2024-05-14 Thread Greg Clayton via lldb-commits
@@ -983,6 +995,44 @@ llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment( } } +bool ProcessElfCore::IsElf(const NT_FILE_Entry entry) { + const uint8_t elf_header[4] = {0x7f, 0x45, 0x4c, + 0x46}; // ELF file begin with this 4

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92078)

2024-05-14 Thread Greg Clayton via lldb-commits
@@ -983,6 +995,44 @@ llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment( } } +bool ProcessElfCore::IsElf(const NT_FILE_Entry entry) { + const uint8_t elf_header[4] = {0x7f, 0x45, 0x4c, + 0x46}; // ELF file begin with this 4

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92078)

2024-05-14 Thread Greg Clayton via lldb-commits
@@ -983,6 +995,44 @@ llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment( } } +bool ProcessElfCore::IsElf(const NT_FILE_Entry entry) { + const uint8_t elf_header[4] = {0x7f, 0x45, 0x4c, + 0x46}; // ELF file begin with this 4

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92078)

2024-05-14 Thread Greg Clayton via lldb-commits
@@ -977,35 +977,6 @@ class CommandObjectMemoryFind : public CommandObjectParsed { Options *GetOptions() override { return _option_group; } protected: - class ProcessMemoryIterator { - public: -ProcessMemoryIterator(ProcessSP process_sp, lldb::addr_t base) -:

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92078)

2024-05-14 Thread Greg Clayton via lldb-commits
@@ -3191,6 +3191,33 @@ Status Process::Halt(bool clear_thread_plans, bool use_run_lock) { return Status(); } +lldb::addr_t Process::FastSearch(lldb::addr_t low, lldb::addr_t high, clayborg wrote: rename to `FindInMemory`

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92078)

2024-05-14 Thread Greg Clayton via lldb-commits
@@ -983,6 +995,44 @@ llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment( } } +bool ProcessElfCore::IsElf(const NT_FILE_Entry entry) { + const uint8_t elf_header[4] = {0x7f, 0x45, 0x4c, + 0x46}; // ELF file begin with this 4

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92078)

2024-05-14 Thread Greg Clayton via lldb-commits
@@ -117,6 +117,8 @@ class ProcessElfCore : public lldb_private::PostMortemProcess { lldb::addr_t end; lldb::addr_t file_ofs; std::string path; +lldb_private::UUID +uuid; // extracted from .note.gnu.build-id section from core file

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92078)

2024-05-14 Thread Greg Clayton via lldb-commits
@@ -983,6 +995,44 @@ llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment( } } +bool ProcessElfCore::IsElf(const NT_FILE_Entry entry) { + const uint8_t elf_header[4] = {0x7f, 0x45, 0x4c, + 0x46}; // ELF file begin with this 4

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92078)

2024-05-14 Thread Greg Clayton via lldb-commits
@@ -983,6 +995,44 @@ llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment( } } +bool ProcessElfCore::IsElf(const NT_FILE_Entry entry) { + const uint8_t elf_header[4] = {0x7f, 0x45, 0x4c, + 0x46}; // ELF file begin with this 4

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92078)

2024-05-14 Thread Greg Clayton via lldb-commits
@@ -983,6 +995,44 @@ llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment( } } +bool ProcessElfCore::IsElf(const NT_FILE_Entry entry) { + const uint8_t elf_header[4] = {0x7f, 0x45, 0x4c, + 0x46}; // ELF file begin with this 4

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92078)

2024-05-14 Thread Greg Clayton via lldb-commits
https://github.com/clayborg edited https://github.com/llvm/llvm-project/pull/92078 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92078)

2024-05-14 Thread Greg Clayton via lldb-commits
@@ -158,6 +160,15 @@ class ProcessElfCore : public lldb_private::PostMortemProcess { // Returns number of thread contexts stored in the core file uint32_t GetNumThreadContexts(); + // Populate gnu uuid for each NT_FILE entry + void UpdateBuildIdForNTFileEntries(); + +

[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92078)

2024-05-14 Thread Greg Clayton via lldb-commits
https://github.com/clayborg requested changes to this pull request. https://github.com/llvm/llvm-project/pull/92078 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-14 Thread Greg Clayton via lldb-commits
clayborg wrote: > > I forgot to ask, what is the motivation behind this change? Is there > > something you can't do with the SBAPI right now or that is better expressed > > with SBAddressRange and SBAddressRangeList? > > Yes, I want to add the following API: > > lldb::SBError

[Lldb-commits] [lldb] [LLDB/Coredump] Only take the Pthread from stack start to the stackpointer + red_zone (PR #92002)

2024-05-13 Thread Greg Clayton via lldb-commits
@@ -6410,12 +6410,20 @@ GetCoreFileSaveRangesStackOnly(Process , if (!reg_ctx_sp) continue; const addr_t sp = reg_ctx_sp->GetSP(); +const size_t red_zone = process.GetABI()->GetRedZoneSize(); lldb_private::MemoryRegionInfo sp_region; if

[Lldb-commits] [lldb] [LLDB/Coredump] Only take the Pthread from stack start to the stackpointer + red_zone (PR #92002)

2024-05-13 Thread Greg Clayton via lldb-commits
https://github.com/clayborg requested changes to this pull request. Change look good for the `GetCoreFileSaveRangesStackOnly`, but we want this to work for the other two modes `modified-memory` and `full`. So we need to fix `GetCoreFileSaveRangesFull` and `GetCoreFileSaveRangesDirtyOnly`.

[Lldb-commits] [lldb] [LLDB/Coredump] Only take the Pthread from stack start to the stackpointer + red_zone (PR #92002)

2024-05-13 Thread Greg Clayton via lldb-commits
https://github.com/clayborg edited https://github.com/llvm/llvm-project/pull/92002 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-13 Thread Greg Clayton via lldb-commits
@@ -0,0 +1,63 @@ +//===-- SBAddressRange.h *- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-13 Thread Greg Clayton via lldb-commits
@@ -0,0 +1,63 @@ +//===-- SBAddressRange.h *- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)

2024-05-13 Thread Greg Clayton via lldb-commits
@@ -0,0 +1,3 @@ +#include + +int main() { std::cout << "Hello World!" << std::endl; } clayborg wrote: No need to use here right? I would just do a simpler `main`: ``` int main() { return 0; } ``` (remove `#include` and use of `std::cout`). This will reduce

  1   2   3   4   5   6   7   8   9   10   >