[Lldb-commits] [lldb] 0d56d88 - [lldb] Update eh-frame-dwarf-unwind-abort.test for a change in llvm assembler
Author: Pavel Labath Date: 2024-04-26T07:13:33Z New Revision: 0d56d88d9fc48f1b97a641422ee23cc6eabcd6ef URL: https://github.com/llvm/llvm-project/commit/0d56d88d9fc48f1b97a641422ee23cc6eabcd6ef DIFF: https://github.com/llvm/llvm-project/commit/0d56d88d9fc48f1b97a641422ee23cc6eabcd6ef.diff LOG: [lldb] Update eh-frame-dwarf-unwind-abort.test for a change in llvm assembler The jump instruction now gets encoded as a near jump, which changes some offsets. Added: Modified: lldb/test/Shell/Unwind/eh-frame-dwarf-unwind-abort.test Removed: diff --git a/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind-abort.test b/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind-abort.test index 477a656a711f90..d5e66ca5e26341 100644 --- a/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind-abort.test +++ b/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind-abort.test @@ -9,12 +9,12 @@ process launch # CHECK: stop reason = signal SIGTRAP thread backtrace -# CHECK: frame #0: {{.*}}`asm_main + 23 +# CHECK: frame #0: {{.*}}`asm_main + 19 # CHECK: frame #1: {{.*}}`main + {{.*}} target modules show-unwind -n asm_main # CHECK: eh_frame UnwindPlan: # CHECK: row[0]:0: CFA=rsp +8 => rip=[CFA-8] -# CHECK: row[1]: 14: CFA=rsp+16 => rbp=[CFA-16] rip=[CFA-8] -# CHECK: row[2]: 17: CFA=rbp+16 => rbp=[CFA-16] rip=[CFA-8] -# CHECK: row[3]: 22: CFA=rsp +8 => rip=[CFA-8] +# CHECK: row[1]: 10: CFA=rsp+16 => rbp=[CFA-16] rip=[CFA-8] +# CHECK: row[2]: 13: CFA=rbp+16 => rbp=[CFA-16] rip=[CFA-8] +# CHECK: row[3]: 18: CFA=rsp +8 => rip=[CFA-8] ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] c4b28bf - [lldb][Docs] Link from platform doc to extensions doc (#90029)
Author: David Spickett Date: 2024-04-26T09:33:29+01:00 New Revision: c4b28bf903644c8c540310594983eba741d45abe URL: https://github.com/llvm/llvm-project/commit/c4b28bf903644c8c540310594983eba741d45abe DIFF: https://github.com/llvm/llvm-project/commit/c4b28bf903644c8c540310594983eba741d45abe.diff LOG: [lldb][Docs] Link from platform doc to extensions doc (#90029) So we aren't describing the same packets twice. Basically turning the platform doc into a list of cross links. qLaunchSuccess was missing a description so I added one. Added: Modified: lldb/docs/resources/lldbgdbremote.md lldb/docs/resources/lldbplatformpackets.md Removed: diff --git a/lldb/docs/resources/lldbgdbremote.md b/lldb/docs/resources/lldbgdbremote.md index cbe5c766d61eef..9a1032818af021 100644 --- a/lldb/docs/resources/lldbgdbremote.md +++ b/lldb/docs/resources/lldbgdbremote.md @@ -130,6 +130,21 @@ The above packet helps when you have remote debugging abilities where you could launch a process on a remote host, this isn't needed for bare board debugging. +## qLaunchSuccess + +### Brief + +Check whether launching a process with the `A` packet succeeded. + +### Description + +Returns the status of the last attempt to launch a process. +Either `OK` if no error ocurred, or `E` followed by a string +describing the error. + +### Priority To Implement + +High, launching processes is a key part of LLDB's platform mode. ## QEnvironment:NAME=VALUE @@ -263,6 +278,20 @@ QSetWorkingDir: ``` This packet must be sent _prior_ to sending a "A" packet. +## qGetWorkingDir + +### Brief + +Get the current working directory of the platform stub in +ASCII hex encoding. + +### Example + +``` +receive: qGetWorkingDir +send: 2f4170706c65496e7465726e616c2f6c6c64622f73657474696e67732f342f5465737453657474696e67732e746573745f646973617373656d626c65725f73657474696e6773 +``` + ## QSetDisableASLR:\ ### Brief @@ -1029,13 +1058,17 @@ a remote host. Request: `qPlatform_mkdir:,` +The request packet has the fields: + 1. mode bits in base 16 + 2. file path in ascii-hex encoding + Reply: * `F` (mkdir called successfully and returned with the given return code) * `Exx` (An error occurred) -## qPlatform_chmod +## vFile:chmod / qPlatform_chmod ### Brief @@ -1900,6 +1933,43 @@ send packet: $qsProcessInfo#00 read packet: $E04#00 ``` +## qPathComplete (Platform Extension) + +### Brief + +Get a list of matched disk files/directories by passing a boolean flag +and a partial path. + +### Example + +``` +receive: qPathComplete:0,6d61696e +send:M6d61696e2e637070 +receive: qPathComplete:1,746573 +send:M746573742f,74657374732f +``` + +If the first argument is zero, the result should contain all +files (including directories) starting with the given path. If the +argument is one, the result should contain only directories. + +The result should be a comma-separated list of hex-encoded paths. +Paths denoting a directory should end with a directory separator (`/` or `\`. + +## qKillSpawnedProcess (Platform Extension) + +### Brief + +Kill a process running on the target system. + +### Example + +``` +receive: qKillSpawnedProcess:1337 +send:OK +``` +The request packet has the process ID in base 10. + ## qLaunchGDBServer (Platform Extension) ### Brief @@ -2397,3 +2467,158 @@ STUB REPLIES: {"process_state_value":48,"process_state string":"dyld_process_sta Low. This packet is needed to prevent lldb's utility functions for scanning the Objective-C class list from running very early in process startup. + +## vFile Packets + +Though some of these may match the ones described in GDB's protocol +documentation, we include our own expectations here in case of +mismatches or extensions. + +### vFile:size + + Brief + +Get the size of a file on the target system, filename in ASCII hex. + + Example + +``` +receive: vFile:size:2f746d702f61 +send:Fc008 +``` + +response is `F` followed by the file size in base 16. +`F-1,errno` with the errno if an error occurs, base 16. + +### vFile:mode + + Brief + +Get the mode bits of a file on the target system, filename in ASCII hex. + + Example + +``` +receive: vFile:mode:2f746d702f61 +send:F1ed +``` + +response is `F` followed by the mode bits in base 16, this `0x1ed` would +correspond to `0755` in octal. +`F-1,errno` with the errno if an error occurs, base 16. + +### vFile:unlink + + Brief + +Remove a file on the target system. + + Example + +``` +receive: vFile:unlink:2f746d702f61 +send:F0 +``` + +Argument is a file path in ascii-hex encoding. +Response is `F` plus the return value of `unlink()`, base 16 encoding. +Return value may optionally be followed by a comma and the base16 +value of errno if unlink failed. + +### vFile:symlink + + Brief + +Create a symbolic link (symlink, soft-link) on the target system. + + Example + +``` +receive:
[Lldb-commits] [lldb] [lldb][Docs] Link from platform doc to extensions doc (PR #90029)
https://github.com/DavidSpickett closed https://github.com/llvm/llvm-project/pull/90029 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] bd53c7c - [lldb][Docs] Document vFile "MD5" and "exists"
Author: David Spickett Date: 2024-04-26T09:45:17+01:00 New Revision: bd53c7cce418fe7f3e171859d4718df15d03dc2b URL: https://github.com/llvm/llvm-project/commit/bd53c7cce418fe7f3e171859d4718df15d03dc2b DIFF: https://github.com/llvm/llvm-project/commit/bd53c7cce418fe7f3e171859d4718df15d03dc2b.diff LOG: [lldb][Docs] Document vFile "MD5" and "exists" This is a Markdown version of https://github.com/llvm/llvm-project/pull/89357. Added: Modified: lldb/docs/resources/lldbgdbremote.md Removed: diff --git a/lldb/docs/resources/lldbgdbremote.md b/lldb/docs/resources/lldbgdbremote.md index 9a1032818af021..05e4f714f7f704 100644 --- a/lldb/docs/resources/lldbgdbremote.md +++ b/lldb/docs/resources/lldbgdbremote.md @@ -2621,4 +2621,46 @@ Request packet has the fields: 2. Offset into file to start from, base 16 3. binary-escaped-data to be written -Response is `F`, followed by the number of bytes written (base 16). \ No newline at end of file +Response is `F`, followed by the number of bytes written (base 16). + +### vFile:MD5 + + Brief + +Generate an MD5 hash of the file at the given path. + + Example + +``` +receive: vFile:MD5:2f746d702f61 +send (success): F, +send (failure): F,x +``` + +Request packet contains the ASCII hex encoded filename. + +If the hash succeeded, the response is `F,` followed by the low 64 +bits of the result, and finally the high 64 bits of the result. Both are in +hex format without a prefix. + +The response is `F,`, followed by `x` if the file did not exist +or failed to hash. + +### vFile:exists + + Brief + +Check whether the file at the given path exists. + + Example + +``` +receive: vFile:exists:2f746d702f61 +send (exists): F,1 +send (does not exist): F,0 +``` + +Request packet contains the ASCII hex encoded filename. + +The response is a return code where 1 means the file exists +and 0 means it does not. \ No newline at end of file ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Docs] Document vFile:exists and vFile:MD5 (PR #89357)
https://github.com/DavidSpickett closed https://github.com/llvm/llvm-project/pull/89357 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Docs] Document vFile:exists and vFile:MD5 (PR #89357)
DavidSpickett wrote: Landed as markdown in https://github.com/llvm/llvm-project/commit/bd53c7cce418fe7f3e171859d4718df15d03dc2b. https://github.com/llvm/llvm-project/pull/89357 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb[Docs] Reduce title noise in packets doc (PR #90183)
https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/90183 This removes the "Brief" and "Description" subtitles and merges the text of both so that the contents listing is clearer. >From 97468a99808fa0562f6c157b8a2703c48acc5ebc Mon Sep 17 00:00:00 2001 From: David Spickett Date: Thu, 25 Apr 2024 09:14:51 +0100 Subject: [PATCH 1/2] [lldb][docs] Remove "Brief" subheading from packet docs This is just noise that clutters up the contents table. --- lldb/docs/resources/lldbgdbremote.md | 128 --- 1 file changed, 128 deletions(-) diff --git a/lldb/docs/resources/lldbgdbremote.md b/lldb/docs/resources/lldbgdbremote.md index 05e4f714f7f704..bc632c8af859e0 100644 --- a/lldb/docs/resources/lldbgdbremote.md +++ b/lldb/docs/resources/lldbgdbremote.md @@ -27,8 +27,6 @@ standard GDB remote protocol packets. ## QStartNoAckMode -### Brief - Try to enable no ACK mode to skip sending ACKs and NACKs. ### Priority To Implement @@ -54,8 +52,6 @@ send packet: + ## QSupported -### Brief - Query the GDB remote server for features it supports ### Priority To Implement @@ -99,8 +95,6 @@ In the example above, three lldb extensions are shown: ## "A" - launch args packet -### Brief - Launch a program using the supplied arguments ### Priority To Implement @@ -132,8 +126,6 @@ debugging. ## qLaunchSuccess -### Brief - Check whether launching a process with the `A` packet succeeded. ### Description @@ -148,8 +140,6 @@ High, launching processes is a key part of LLDB's platform mode. ## QEnvironment:NAME=VALUE -### Brief - Setup the environment up for a new child process that will soon be launched using the "A" packet. @@ -179,8 +169,6 @@ This packet can be sent one or more times _prior_ to sending a "A" packet. ## QEnvironmentHexEncoded:HEX-ENCODING(NAME=VALUE) -### Brief - Setup the environment up for a new child process that will soon be launched using the "A" packet. @@ -206,8 +194,6 @@ This packet can be sent one or more times _prior_ to sending a "A" packet. ## QEnableErrorStrings -### Brief - This packet enables reporting of Error strings in remote packet replies from the server to client. If the server supports this feature, it should send an OK response. The client can expect the @@ -236,8 +222,6 @@ read packet: $OK#00 ## QSetSTDIN:\ / QSetSTDOUT:\ / QSetSTDERR:\ -### Brief - Setup where STDIN, STDOUT, and STDERR go prior to sending an "A" packet. @@ -260,8 +244,6 @@ These packets must be sent _prior_ to sending a "A" packet. ## QSetWorkingDir:\ -### Brief - Set the working directory prior to sending an "A" packet. ### Priority To Implement @@ -280,8 +262,6 @@ This packet must be sent _prior_ to sending a "A" packet. ## qGetWorkingDir -### Brief - Get the current working directory of the platform stub in ASCII hex encoding. @@ -294,8 +274,6 @@ send: 2f4170706c65496e7465726e616c2f6c6c64622f73657474696e67732f342f546573745 ## QSetDisableASLR:\ -### Brief - Enable or disable ASLR on the next "A" packet. ### Priority To Implement @@ -319,8 +297,6 @@ This packet must be sent _prior_ to sending a "A" packet. ## QListThreadsInStopReply -### Brief - Enable the `threads:` and `thread-pcs:` data in the question-mark packet ("T packet") responses when the stub reports that a program has stopped executing. @@ -341,8 +317,6 @@ read packet: OK ## jLLDBTraceSupported -### Brief - Get the processor tracing type supported by the gdb-server for the current inferior. Responses might be different depending on the architecture and capabilities of the underlying OS. @@ -376,8 +350,6 @@ read packet: {"name":, "description":}/E; ## jLLDBTraceStart -### Brief - Start tracing a process or its threads using a provided tracing technology. The input and output are specified as JSON objects. In case of success, an OK response is returned, or an error otherwise. @@ -530,8 +502,6 @@ read packet: OK/E;A ## jLLDBTraceStop -### Brief - Stop tracing a process or its threads using a provided tracing technology. The input and output are specified as JSON objects. In case of success, an OK response is returned, or an error otherwise. @@ -583,8 +553,6 @@ read packet: OK/E;A ## jLLDBTraceGetState -### Brief - Get the current state of the process and its threads being traced by a given trace technology. The response is a JSON object with custom information depending on the trace technology. In case of errors, an @@ -690,8 +658,6 @@ read packet: {...object}/E;A ## jLLDBTraceGetBinaryData -### Brief - Get binary data given a trace technology and a data identifier. The input is specified as a JSON object and the response has the same format as the "binary memory read" (aka "x") packet. In case of failures, an error @@ -722,8 +688,6 @@ read packet: /E;A ## qRegisterInfo\ -### Brief - Discover register information f
[Lldb-commits] [lldb] [lldb[Docs] Reduce title noise in packets doc (PR #90183)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: David Spickett (DavidSpickett) Changes This removes the "Brief" and "Description" subtitles and merges the text of both so that the contents listing is clearer. --- Patch is 35.11 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/90183.diff 1 Files Affected: - (modified) lldb/docs/resources/lldbgdbremote.md (+168-361) ``diff diff --git a/lldb/docs/resources/lldbgdbremote.md b/lldb/docs/resources/lldbgdbremote.md index 05e4f714f7f704..a9fa2a432b7009 100644 --- a/lldb/docs/resources/lldbgdbremote.md +++ b/lldb/docs/resources/lldbgdbremote.md @@ -27,18 +27,8 @@ standard GDB remote protocol packets. ## QStartNoAckMode -### Brief - Try to enable no ACK mode to skip sending ACKs and NACKs. -### Priority To Implement - -High. Any GDB remote server that can implement this should if the -connection is reliable. This improves packet throughput and increases -the performance of the connection. - -### Description - Having to send an ACK/NACK after every packet slows things down a bit, so we have a way to disable ACK packets to minimize the traffic for reliable communication interfaces (like sockets). Below GDB or LLDB will send this @@ -52,17 +42,15 @@ read packet: $OK#9a send packet: + ``` -## QSupported - -### Brief - -Query the GDB remote server for features it supports - ### Priority To Implement -Optional. +High. Any GDB remote server that can implement this should if the +connection is reliable. This improves packet throughput and increases +the performance of the connection. -### Description +## QSupported + +Query the GDB remote server for features it supports QSupported is a standard GDB Remote Serial Protocol packet, but there are several additions to the response that lldb can parse. @@ -96,21 +84,14 @@ In the example above, three lldb extensions are shown: watchpoints, up to a pointer size, `sizeof(void*)`, a reasonable baseline assumption. +### Priority To Implement -## "A" - launch args packet +Optional. -### Brief +## "A" - launch args packet Launch a program using the supplied arguments -### Priority To Implement - -Low. Only needed if the remote target wants to launch a target after -making a connection to a GDB server that isn't already connected to -an inferior process. - -### Description - We have added support for the "set program arguments" packet where we can start a connection to a remote server and then later supply the path to the executable and the arguments to use when executing: @@ -130,14 +111,16 @@ The above packet helps when you have remote debugging abilities where you could launch a process on a remote host, this isn't needed for bare board debugging. -## qLaunchSuccess +### Priority To Implement + +Low. Only needed if the remote target wants to launch a target after +making a connection to a GDB server that isn't already connected to +an inferior process. -### Brief +## qLaunchSuccess Check whether launching a process with the `A` packet succeeded. -### Description - Returns the status of the last attempt to launch a process. Either `OK` if no error ocurred, or `E` followed by a string describing the error. @@ -148,8 +131,6 @@ High, launching processes is a key part of LLDB's platform mode. ## QEnvironment:NAME=VALUE -### Brief - Setup the environment up for a new child process that will soon be launched using the "A" packet. @@ -161,14 +142,6 @@ scan the environment strings before sending, prefer the `QEnvironmentHexEncoded` packet over `QEnvironment`, if it is available. -### Priority To Implement - -Low. Only needed if the remote target wants to launch a target after -making a connection to a GDB server that isn't already connected to -an inferior process. - -### Description - Both GDB and LLDB support passing down environment variables. Is it ok to respond with a `$#00` (unimplemented): ``` @@ -177,9 +150,13 @@ read packet: $OK#00 ``` This packet can be sent one or more times _prior_ to sending a "A" packet. -## QEnvironmentHexEncoded:HEX-ENCODING(NAME=VALUE) +### Priority To Implement + +Low. Only needed if the remote target wants to launch a target after +making a connection to a GDB server that isn't already connected to +an inferior process. -### Brief +## QEnvironmentHexEncoded:HEX-ENCODING(NAME=VALUE) Setup the environment up for a new child process that will soon be launched using the "A" packet. @@ -188,14 +165,6 @@ The only difference between this packet and `QEnvironment` is that the environment key-value pair is ascii hex encoded for transmission. This allows values with gdb-remote metacharacters like `#` to be sent. -### Priority To Implement - -Low. Only needed if the remote target wants to launch a target after -making a connection to a GDB server that isn't already connected to -an inferior process. - -### Description - Both GDB and LLDB support passi
[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)
@@ -1854,6 +1854,49 @@ class VMAddressProvider { }; } +namespace { al45tair wrote: This file already uses anonymous namespaces, but I'll change the function to `static` instead. https://github.com/llvm/llvm-project/pull/90099 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)
@@ -1854,6 +1854,49 @@ class VMAddressProvider { }; } +namespace { + // We have to do this because ELF doesn't have section IDs, and also + // doesn't require section names to be unique. (We use the section index + // for section IDs, but that isn't guaranteed to be the same in separate + // debug images.) + SectionSP FindMatchingSection(const SectionList §ion_list, +SectionSP section) { +SectionSP sect_sp; + +addr_t vm_addr = section->GetFileAddress(); +ConstString name = section->GetName(); +offset_t file_size = section->GetFileSize(); +offset_t byte_size = section->GetByteSize(); +SectionType type = section->GetType(); +bool thread_specific = section->IsThreadSpecific(); +uint32_t permissions = section->GetPermissions(); +uint32_t alignment = section->GetLog2Align(); + +for (auto sect_iter = section_list.begin(); + sect_iter != section_list.end(); + ++sect_iter) { + if ((*sect_iter)->GetName() == name + && (*sect_iter)->GetType() == type + && (*sect_iter)->IsThreadSpecific() == thread_specific + && (*sect_iter)->GetPermissions() == permissions + && (*sect_iter)->GetFileSize() == file_size + && (*sect_iter)->GetByteSize() == byte_size + && (*sect_iter)->GetFileAddress() == vm_addr + && (*sect_iter)->GetLog2Align() == alignment) { al45tair wrote: I didn't want to do that, because I didn't want to give the impression that this was a general purpose way to compare two `Section`s. While it checks _many_ of the section attributes, it doesn't check all of them (intentionally in the case of which object they come from), and I think that would be surprising behaviour from an `==` operator. https://github.com/llvm/llvm-project/pull/90099 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)
@@ -1854,6 +1854,49 @@ class VMAddressProvider { }; } +namespace { + // We have to do this because ELF doesn't have section IDs, and also + // doesn't require section names to be unique. (We use the section index + // for section IDs, but that isn't guaranteed to be the same in separate + // debug images.) + SectionSP FindMatchingSection(const SectionList §ion_list, +SectionSP section) { +SectionSP sect_sp; + +addr_t vm_addr = section->GetFileAddress(); +ConstString name = section->GetName(); +offset_t file_size = section->GetFileSize(); +offset_t byte_size = section->GetByteSize(); +SectionType type = section->GetType(); +bool thread_specific = section->IsThreadSpecific(); +uint32_t permissions = section->GetPermissions(); +uint32_t alignment = section->GetLog2Align(); + +for (auto sect_iter = section_list.begin(); + sect_iter != section_list.end(); + ++sect_iter) { al45tair wrote: Yes, it can (I just checked and apparently we can use C++17 in LLVM code, so that's nice :-)). https://github.com/llvm/llvm-project/pull/90099 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)
@@ -2067,10 +2110,8 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id, SectionList *module_section_list = module_sp ? module_sp->GetSectionList() : nullptr; - // Local cache to avoid doing a FindSectionByName for each symbol. The "const - // char*" key must came from a ConstString object so they can be compared by - // pointer - std::unordered_map section_name_to_section; + // Cache the section mapping al45tair wrote: I'll improve the comment. https://github.com/llvm/llvm-project/pull/90099 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)
al45tair wrote: > Can we add a test for this with obj2yaml? Not sure what you're thinking here. We can't use `yaml2obj` to generate an object with this problem because that tool assumes symbols are in a uniquely named section (which is mostly reasonable), and `obj2yaml` doesn't exercise the code in LLDB. I'll take a look and see what we can do as a test. https://github.com/llvm/llvm-project/pull/90099 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)
https://github.com/al45tair updated https://github.com/llvm/llvm-project/pull/90099 >From ce54a7fb339a00029da266c9f518e344aac5d19e Mon Sep 17 00:00:00 2001 From: Alastair Houghton Date: Thu, 25 Apr 2024 11:35:55 +0100 Subject: [PATCH 1/2] [LLDB][ELF] Fix section unification to not just use names. Section unification cannot just use names, because it's valid for ELF binaries to have multiple sections with the same name. We should check other section properties too. rdar://124467787 --- .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 64 +++ 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 0d95a1c12bde35..60fc68c96bcc1c 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1854,6 +1854,49 @@ class VMAddressProvider { }; } +namespace { + // We have to do this because ELF doesn't have section IDs, and also + // doesn't require section names to be unique. (We use the section index + // for section IDs, but that isn't guaranteed to be the same in separate + // debug images.) + SectionSP FindMatchingSection(const SectionList §ion_list, +SectionSP section) { +SectionSP sect_sp; + +addr_t vm_addr = section->GetFileAddress(); +ConstString name = section->GetName(); +offset_t file_size = section->GetFileSize(); +offset_t byte_size = section->GetByteSize(); +SectionType type = section->GetType(); +bool thread_specific = section->IsThreadSpecific(); +uint32_t permissions = section->GetPermissions(); +uint32_t alignment = section->GetLog2Align(); + +for (auto sect_iter = section_list.begin(); + sect_iter != section_list.end(); + ++sect_iter) { + if ((*sect_iter)->GetName() == name + && (*sect_iter)->GetType() == type + && (*sect_iter)->IsThreadSpecific() == thread_specific + && (*sect_iter)->GetPermissions() == permissions + && (*sect_iter)->GetFileSize() == file_size + && (*sect_iter)->GetByteSize() == byte_size + && (*sect_iter)->GetFileAddress() == vm_addr + && (*sect_iter)->GetLog2Align() == alignment) { +sect_sp = *sect_iter; +break; + } else { +sect_sp = FindMatchingSection((*sect_iter)->GetChildren(), + section); +if (sect_sp) + break; + } +} + +return sect_sp; + } +} + void ObjectFileELF::CreateSections(SectionList &unified_section_list) { if (m_sections_up) return; @@ -2067,10 +2110,8 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id, SectionList *module_section_list = module_sp ? module_sp->GetSectionList() : nullptr; - // Local cache to avoid doing a FindSectionByName for each symbol. The "const - // char*" key must came from a ConstString object so they can be compared by - // pointer - std::unordered_map section_name_to_section; + // Cache the section mapping + std::unordered_map section_map; unsigned i; for (i = 0; i < num_symbols; ++i) { @@ -2275,14 +2316,15 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id, if (symbol_section_sp && module_section_list && module_section_list != section_list) { - ConstString sect_name = symbol_section_sp->GetName(); - auto section_it = section_name_to_section.find(sect_name.GetCString()); - if (section_it == section_name_to_section.end()) + auto section_it = section_map.find(symbol_section_sp); + if (section_it == section_map.end()) { section_it = -section_name_to_section -.emplace(sect_name.GetCString(), - module_section_list->FindSectionByName(sect_name)) -.first; + section_map + .emplace(symbol_section_sp, + FindMatchingSection(*module_section_list, + symbol_section_sp)) + .first; + } if (section_it->second) symbol_section_sp = section_it->second; } >From ccad6269dea865ee61f876e0f28d9cc825d507b0 Mon Sep 17 00:00:00 2001 From: Alastair Houghton Date: Fri, 26 Apr 2024 14:53:20 +0100 Subject: [PATCH 2/2] [LLDB][ELF] Address review feedback, add test. Fixed a couple of nits from review, and fixed up formatting. Also added a test. rdar://124467787 --- .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 87 +- .../ELF/Inputs/two-text-sections.elf | Bin 0 -> 4976 bytes .../ObjectFile/ELF/two-text-sections.test | 8 ++ 3 files changed, 50 insertions(+), 45 deletions(-) create mode 100644 lldb/test/Shell/ObjectFile/ELF/Inputs/two-text-sections.elf create mode 100644 lldb/test/Shell/ObjectFile/ELF/two-text-sections.test diff --git a/ll
[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)
https://github.com/al45tair updated https://github.com/llvm/llvm-project/pull/90099 >From ce54a7fb339a00029da266c9f518e344aac5d19e Mon Sep 17 00:00:00 2001 From: Alastair Houghton Date: Thu, 25 Apr 2024 11:35:55 +0100 Subject: [PATCH 1/2] [LLDB][ELF] Fix section unification to not just use names. Section unification cannot just use names, because it's valid for ELF binaries to have multiple sections with the same name. We should check other section properties too. rdar://124467787 --- .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 64 +++ 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 0d95a1c12bde35..60fc68c96bcc1c 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1854,6 +1854,49 @@ class VMAddressProvider { }; } +namespace { + // We have to do this because ELF doesn't have section IDs, and also + // doesn't require section names to be unique. (We use the section index + // for section IDs, but that isn't guaranteed to be the same in separate + // debug images.) + SectionSP FindMatchingSection(const SectionList §ion_list, +SectionSP section) { +SectionSP sect_sp; + +addr_t vm_addr = section->GetFileAddress(); +ConstString name = section->GetName(); +offset_t file_size = section->GetFileSize(); +offset_t byte_size = section->GetByteSize(); +SectionType type = section->GetType(); +bool thread_specific = section->IsThreadSpecific(); +uint32_t permissions = section->GetPermissions(); +uint32_t alignment = section->GetLog2Align(); + +for (auto sect_iter = section_list.begin(); + sect_iter != section_list.end(); + ++sect_iter) { + if ((*sect_iter)->GetName() == name + && (*sect_iter)->GetType() == type + && (*sect_iter)->IsThreadSpecific() == thread_specific + && (*sect_iter)->GetPermissions() == permissions + && (*sect_iter)->GetFileSize() == file_size + && (*sect_iter)->GetByteSize() == byte_size + && (*sect_iter)->GetFileAddress() == vm_addr + && (*sect_iter)->GetLog2Align() == alignment) { +sect_sp = *sect_iter; +break; + } else { +sect_sp = FindMatchingSection((*sect_iter)->GetChildren(), + section); +if (sect_sp) + break; + } +} + +return sect_sp; + } +} + void ObjectFileELF::CreateSections(SectionList &unified_section_list) { if (m_sections_up) return; @@ -2067,10 +2110,8 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id, SectionList *module_section_list = module_sp ? module_sp->GetSectionList() : nullptr; - // Local cache to avoid doing a FindSectionByName for each symbol. The "const - // char*" key must came from a ConstString object so they can be compared by - // pointer - std::unordered_map section_name_to_section; + // Cache the section mapping + std::unordered_map section_map; unsigned i; for (i = 0; i < num_symbols; ++i) { @@ -2275,14 +2316,15 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id, if (symbol_section_sp && module_section_list && module_section_list != section_list) { - ConstString sect_name = symbol_section_sp->GetName(); - auto section_it = section_name_to_section.find(sect_name.GetCString()); - if (section_it == section_name_to_section.end()) + auto section_it = section_map.find(symbol_section_sp); + if (section_it == section_map.end()) { section_it = -section_name_to_section -.emplace(sect_name.GetCString(), - module_section_list->FindSectionByName(sect_name)) -.first; + section_map + .emplace(symbol_section_sp, + FindMatchingSection(*module_section_list, + symbol_section_sp)) + .first; + } if (section_it->second) symbol_section_sp = section_it->second; } >From 9653351729b4ef2d98faba936b8fa6fb51a9a47c Mon Sep 17 00:00:00 2001 From: Alastair Houghton Date: Fri, 26 Apr 2024 14:53:20 +0100 Subject: [PATCH 2/2] [LLDB][ELF] Address review feedback, add test. Fixed a couple of nits from review, and fixed up formatting. Also added a test. rdar://124467787 --- .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 86 +- .../ELF/Inputs/two-text-sections.elf | Bin 0 -> 4976 bytes .../ObjectFile/ELF/two-text-sections.test | 8 ++ 3 files changed, 49 insertions(+), 45 deletions(-) create mode 100644 lldb/test/Shell/ObjectFile/ELF/Inputs/two-text-sections.elf create mode 100644 lldb/test/Shell/ObjectFile/ELF/two-text-sections.test diff --git a/ll
[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)
labath wrote: > > Can we add a test for this with obj2yaml? > > Not sure what you're thinking here. We can't use `yaml2obj` to generate an > object with this problem because that tool assumes symbols are in a uniquely > named section [this](https://github.com/llvm/llvm-project/blob/main/llvm/test/tools/yaml2obj/ELF/duplicate-section-names.yaml) test seems to indicate that's possible (the trick appears to me in `(n)` name tag suffixes). Can you give that a shot? https://github.com/llvm/llvm-project/pull/90099 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)
@@ -1854,6 +1854,49 @@ class VMAddressProvider { }; } +namespace { + // We have to do this because ELF doesn't have section IDs, and also + // doesn't require section names to be unique. (We use the section index + // for section IDs, but that isn't guaranteed to be the same in separate + // debug images.) + SectionSP FindMatchingSection(const SectionList §ion_list, +SectionSP section) { +SectionSP sect_sp; + +addr_t vm_addr = section->GetFileAddress(); +ConstString name = section->GetName(); +offset_t file_size = section->GetFileSize(); +offset_t byte_size = section->GetByteSize(); +SectionType type = section->GetType(); +bool thread_specific = section->IsThreadSpecific(); +uint32_t permissions = section->GetPermissions(); +uint32_t alignment = section->GetLog2Align(); + +for (auto sect_iter = section_list.begin(); + sect_iter != section_list.end(); + ++sect_iter) { + if ((*sect_iter)->GetName() == name + && (*sect_iter)->GetType() == type + && (*sect_iter)->IsThreadSpecific() == thread_specific + && (*sect_iter)->GetPermissions() == permissions + && (*sect_iter)->GetFileSize() == file_size + && (*sect_iter)->GetByteSize() == byte_size + && (*sect_iter)->GetFileAddress() == vm_addr + && (*sect_iter)->GetLog2Align() == alignment) { labath wrote: Am I correct in understanding that this code is used when unifying the sections of a separate debug file with a stripped file? If so, then I believe this comparison is too strict. An object file produced by `objcopy --only-keep-debug` will only have placeholder sections instead of the sections that contained actual code. That means (at least) their file size and file offset will be different from that in the original file. I think it would be sufficient to use the file address (called virtual address in ELF), possibly confirmed by section name, as the unification key. https://github.com/llvm/llvm-project/pull/90099 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Fix test_exit_status_message_sigterm test. (PR #90223)
https://github.com/mbucko created https://github.com/llvm/llvm-project/pull/90223 Summary: 'test_exit_status_message_sigterm' is failing due to 'psutil' dependency introduced in PR #89405. This fix removes 'deque' dependency and checks if 'psutil' can be imported before running the test. If 'psutil' cannot be imported, it emits a warning and skips the test. Test Plan: ./bin/llvm-lit -sv /path-to-llvm-project/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py --filter=tools/lldb-dap/console/TestDAP_console.py Reviewers: @jeffreytan81,@clayborg,@kusmour, @JDevlieghere,@walter-erquinigo Subscribers: Tasks: lldb-dap Tags: >From 0860d377eaa0fefafcbc22072e6801fe57c53789 Mon Sep 17 00:00:00 2001 From: Miro Bucko Date: Fri, 26 Apr 2024 08:17:26 -0700 Subject: [PATCH] [lldb-dap] Fix test_exit_status_message_sigterm test. Summary: 'test_exit_status_message_sigterm' is failing due to 'psutil' dependency introduced in PR #89405. This fix removes 'deque' dependency and checks if 'psutil' can be imported before running the test. If psutil cannot be imported, it emits a warning and skips the test. Test Plan: ./bin/llvm-lit -sv /path-to-llvm-project/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py --filter=tools/lldb-dap/console/TestDAP_console.py Reviewers: Subscribers: Tasks: Tags: --- .../tools/lldb-dap/console/TestDAP_console.py | 20 +-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py index 8f456aaf890c7f..6fc044c02244b0 100644 --- a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py +++ b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py @@ -4,17 +4,15 @@ import dap_server import lldbdap_testcase -import psutil -from collections import deque from lldbsuite.test import lldbutil from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * -def get_subprocess(process_name): -queue = deque([psutil.Process(os.getpid())]) +def get_subprocess(root_process, process_name): +queue = [root_process] while queue: -process = queue.popleft() +process = queue.pop() if process.name() == process_name: return process queue.extend(process.children()) @@ -131,7 +129,17 @@ def test_exit_status_message_sigterm(self): process_name = ( "debugserver" if platform.system() in ["Darwin"] else "lldb-server" ) -process = get_subprocess(process_name) + +try: +import psutil +except ImportError: +print( +"psutil not installed, please install using 'pip install psutil'. " +"Skipping test_exit_status_message_sigterm test.", +file=sys.stderr +) +return +process = get_subprocess(psutil.Process(os.getpid()), process_name) process.terminate() process.wait() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Fix test_exit_status_message_sigterm test. (PR #90223)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Miro Bucko (mbucko) Changes Summary: 'test_exit_status_message_sigterm' is failing due to 'psutil' dependency introduced in PR #89405. This fix removes 'deque' dependency and checks if 'psutil' can be imported before running the test. If 'psutil' cannot be imported, it emits a warning and skips the test. Test Plan: ./bin/llvm-lit -sv /path-to-llvm-project/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py --filter=tools/lldb-dap/console/TestDAP_console.py Reviewers: @jeffreytan81,@clayborg,@kusmour, @JDevlieghere,@walter-erquinigo Subscribers: Tasks: lldb-dap Tags: --- Full diff: https://github.com/llvm/llvm-project/pull/90223.diff 1 Files Affected: - (modified) lldb/test/API/tools/lldb-dap/console/TestDAP_console.py (+14-6) ``diff diff --git a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py index 8f456aaf890c7f..6fc044c02244b0 100644 --- a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py +++ b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py @@ -4,17 +4,15 @@ import dap_server import lldbdap_testcase -import psutil -from collections import deque from lldbsuite.test import lldbutil from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * -def get_subprocess(process_name): -queue = deque([psutil.Process(os.getpid())]) +def get_subprocess(root_process, process_name): +queue = [root_process] while queue: -process = queue.popleft() +process = queue.pop() if process.name() == process_name: return process queue.extend(process.children()) @@ -131,7 +129,17 @@ def test_exit_status_message_sigterm(self): process_name = ( "debugserver" if platform.system() in ["Darwin"] else "lldb-server" ) -process = get_subprocess(process_name) + +try: +import psutil +except ImportError: +print( +"psutil not installed, please install using 'pip install psutil'. " +"Skipping test_exit_status_message_sigterm test.", +file=sys.stderr +) +return +process = get_subprocess(psutil.Process(os.getpid()), process_name) process.terminate() process.wait() `` https://github.com/llvm/llvm-project/pull/90223 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Fix test_exit_status_message_sigterm test. (PR #90223)
github-actions[bot] wrote: :warning: Python code formatter, darker found issues in your code. :warning: You can test this locally with the following command: ``bash darker --check --diff -r 904b1a850536d273b0e11bd17a7ea642ba3b5bc4...0860d377eaa0fefafcbc22072e6801fe57c53789 lldb/test/API/tools/lldb-dap/console/TestDAP_console.py `` View the diff from darker here. ``diff --- TestDAP_console.py 2024-04-26 15:17:26.00 + +++ TestDAP_console.py 2024-04-26 15:33:44.260736 + @@ -134,11 +134,11 @@ import psutil except ImportError: print( "psutil not installed, please install using 'pip install psutil'. " "Skipping test_exit_status_message_sigterm test.", -file=sys.stderr +file=sys.stderr, ) return process = get_subprocess(psutil.Process(os.getpid()), process_name) process.terminate() process.wait() `` https://github.com/llvm/llvm-project/pull/90223 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Fix test_exit_status_message_sigterm test. (PR #90223)
https://github.com/mbucko updated https://github.com/llvm/llvm-project/pull/90223 >From 6e1ef0f3fd733e75a3453e8e83994e0c921c09a0 Mon Sep 17 00:00:00 2001 From: Miro Bucko Date: Fri, 26 Apr 2024 08:17:26 -0700 Subject: [PATCH] [lldb-dap] Fix test_exit_status_message_sigterm test. Summary: 'test_exit_status_message_sigterm' is failing due to 'psutil' dependency introduced in PR #89405. This fix removes 'deque' dependency and checks if 'psutil' can be imported before running the test. If 'psutil' cannot be imported, it emits a warning and skips the test. Test Plan: ./bin/llvm-lit -sv /path-to-llvm-project/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py --filter=tools/lldb-dap/console/TestDAP_console.py Reviewers: @jeffreytan81,@clayborg,@kusmour, @JDevlieghere,@walter-erquinigo Subscribers: Tasks: lldb-dap Tags: --- .../tools/lldb-dap/console/TestDAP_console.py | 20 +-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py index 8f456aaf890c7f..8769f39633e62f 100644 --- a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py +++ b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py @@ -4,17 +4,15 @@ import dap_server import lldbdap_testcase -import psutil -from collections import deque from lldbsuite.test import lldbutil from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * -def get_subprocess(process_name): -queue = deque([psutil.Process(os.getpid())]) +def get_subprocess(root_process, process_name): +queue = [root_process] while queue: -process = queue.popleft() +process = queue.pop() if process.name() == process_name: return process queue.extend(process.children()) @@ -131,7 +129,17 @@ def test_exit_status_message_sigterm(self): process_name = ( "debugserver" if platform.system() in ["Darwin"] else "lldb-server" ) -process = get_subprocess(process_name) + +try: +import psutil +except ImportError: +print( +"psutil not installed, please install using 'pip install psutil'. " +"Skipping test_exit_status_message_sigterm test.", +file=sys.stderr, +) +return +process = get_subprocess(psutil.Process(os.getpid()), process_name) process.terminate() process.wait() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)
@@ -1854,6 +1854,49 @@ class VMAddressProvider { }; } +namespace { + // We have to do this because ELF doesn't have section IDs, and also + // doesn't require section names to be unique. (We use the section index + // for section IDs, but that isn't guaranteed to be the same in separate + // debug images.) + SectionSP FindMatchingSection(const SectionList §ion_list, +SectionSP section) { +SectionSP sect_sp; + +addr_t vm_addr = section->GetFileAddress(); +ConstString name = section->GetName(); +offset_t file_size = section->GetFileSize(); +offset_t byte_size = section->GetByteSize(); +SectionType type = section->GetType(); +bool thread_specific = section->IsThreadSpecific(); +uint32_t permissions = section->GetPermissions(); +uint32_t alignment = section->GetLog2Align(); + +for (auto sect_iter = section_list.begin(); + sect_iter != section_list.end(); + ++sect_iter) { + if ((*sect_iter)->GetName() == name + && (*sect_iter)->GetType() == type + && (*sect_iter)->IsThreadSpecific() == thread_specific + && (*sect_iter)->GetPermissions() == permissions + && (*sect_iter)->GetFileSize() == file_size + && (*sect_iter)->GetByteSize() == byte_size + && (*sect_iter)->GetFileAddress() == vm_addr + && (*sect_iter)->GetLog2Align() == alignment) { al45tair wrote: I did wonder about exactly how strict we want to be (and exactly which things to compare). This isn't testing file offset, but you're right that it does check file size and maybe it shouldn't. https://github.com/llvm/llvm-project/pull/90099 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Fix test_exit_status_message_sigterm test. (PR #90223)
walter-erquinigo wrote: What about trying to use a python builtin like https://docs.python.org/3/library/multiprocessing.html#multiprocessing.active_children? https://github.com/llvm/llvm-project/pull/90223 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)
@@ -1854,6 +1854,49 @@ class VMAddressProvider { }; } +namespace { + // We have to do this because ELF doesn't have section IDs, and also + // doesn't require section names to be unique. (We use the section index + // for section IDs, but that isn't guaranteed to be the same in separate + // debug images.) + SectionSP FindMatchingSection(const SectionList §ion_list, +SectionSP section) { +SectionSP sect_sp; + +addr_t vm_addr = section->GetFileAddress(); +ConstString name = section->GetName(); +offset_t file_size = section->GetFileSize(); +offset_t byte_size = section->GetByteSize(); +SectionType type = section->GetType(); +bool thread_specific = section->IsThreadSpecific(); +uint32_t permissions = section->GetPermissions(); +uint32_t alignment = section->GetLog2Align(); + +for (auto sect_iter = section_list.begin(); + sect_iter != section_list.end(); + ++sect_iter) { + if ((*sect_iter)->GetName() == name + && (*sect_iter)->GetType() == type + && (*sect_iter)->IsThreadSpecific() == thread_specific + && (*sect_iter)->GetPermissions() == permissions + && (*sect_iter)->GetFileSize() == file_size + && (*sect_iter)->GetByteSize() == byte_size + && (*sect_iter)->GetFileAddress() == vm_addr + && (*sect_iter)->GetLog2Align() == alignment) { al45tair wrote: @labath Let's get rid of the sizes; the other things should all be the same, correct? https://github.com/llvm/llvm-project/pull/90099 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)
al45tair wrote: > [this](https://github.com/llvm/llvm-project/blob/main/llvm/test/tools/yaml2obj/ELF/duplicate-section-names.yaml) > test seems to indicate that's possible (the trick appears to me in `(n)` > name tag suffixes). Can you give that a shot? I've actually just included a binary file that exhibits the problem. https://github.com/llvm/llvm-project/pull/90099 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)
https://github.com/al45tair updated https://github.com/llvm/llvm-project/pull/90099 >From ce54a7fb339a00029da266c9f518e344aac5d19e Mon Sep 17 00:00:00 2001 From: Alastair Houghton Date: Thu, 25 Apr 2024 11:35:55 +0100 Subject: [PATCH 1/3] [LLDB][ELF] Fix section unification to not just use names. Section unification cannot just use names, because it's valid for ELF binaries to have multiple sections with the same name. We should check other section properties too. rdar://124467787 --- .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 64 +++ 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 0d95a1c12bde35..60fc68c96bcc1c 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1854,6 +1854,49 @@ class VMAddressProvider { }; } +namespace { + // We have to do this because ELF doesn't have section IDs, and also + // doesn't require section names to be unique. (We use the section index + // for section IDs, but that isn't guaranteed to be the same in separate + // debug images.) + SectionSP FindMatchingSection(const SectionList §ion_list, +SectionSP section) { +SectionSP sect_sp; + +addr_t vm_addr = section->GetFileAddress(); +ConstString name = section->GetName(); +offset_t file_size = section->GetFileSize(); +offset_t byte_size = section->GetByteSize(); +SectionType type = section->GetType(); +bool thread_specific = section->IsThreadSpecific(); +uint32_t permissions = section->GetPermissions(); +uint32_t alignment = section->GetLog2Align(); + +for (auto sect_iter = section_list.begin(); + sect_iter != section_list.end(); + ++sect_iter) { + if ((*sect_iter)->GetName() == name + && (*sect_iter)->GetType() == type + && (*sect_iter)->IsThreadSpecific() == thread_specific + && (*sect_iter)->GetPermissions() == permissions + && (*sect_iter)->GetFileSize() == file_size + && (*sect_iter)->GetByteSize() == byte_size + && (*sect_iter)->GetFileAddress() == vm_addr + && (*sect_iter)->GetLog2Align() == alignment) { +sect_sp = *sect_iter; +break; + } else { +sect_sp = FindMatchingSection((*sect_iter)->GetChildren(), + section); +if (sect_sp) + break; + } +} + +return sect_sp; + } +} + void ObjectFileELF::CreateSections(SectionList &unified_section_list) { if (m_sections_up) return; @@ -2067,10 +2110,8 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id, SectionList *module_section_list = module_sp ? module_sp->GetSectionList() : nullptr; - // Local cache to avoid doing a FindSectionByName for each symbol. The "const - // char*" key must came from a ConstString object so they can be compared by - // pointer - std::unordered_map section_name_to_section; + // Cache the section mapping + std::unordered_map section_map; unsigned i; for (i = 0; i < num_symbols; ++i) { @@ -2275,14 +2316,15 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id, if (symbol_section_sp && module_section_list && module_section_list != section_list) { - ConstString sect_name = symbol_section_sp->GetName(); - auto section_it = section_name_to_section.find(sect_name.GetCString()); - if (section_it == section_name_to_section.end()) + auto section_it = section_map.find(symbol_section_sp); + if (section_it == section_map.end()) { section_it = -section_name_to_section -.emplace(sect_name.GetCString(), - module_section_list->FindSectionByName(sect_name)) -.first; + section_map + .emplace(symbol_section_sp, + FindMatchingSection(*module_section_list, + symbol_section_sp)) + .first; + } if (section_it->second) symbol_section_sp = section_it->second; } >From 9653351729b4ef2d98faba936b8fa6fb51a9a47c Mon Sep 17 00:00:00 2001 From: Alastair Houghton Date: Fri, 26 Apr 2024 14:53:20 +0100 Subject: [PATCH 2/3] [LLDB][ELF] Address review feedback, add test. Fixed a couple of nits from review, and fixed up formatting. Also added a test. rdar://124467787 --- .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 86 +- .../ELF/Inputs/two-text-sections.elf | Bin 0 -> 4976 bytes .../ObjectFile/ELF/two-text-sections.test | 8 ++ 3 files changed, 49 insertions(+), 45 deletions(-) create mode 100644 lldb/test/Shell/ObjectFile/ELF/Inputs/two-text-sections.elf create mode 100644 lldb/test/Shell/ObjectFile/ELF/two-text-sections.test diff --git a/ll
[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [flang] [lld] [lldb] [llvm] [mlir] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)
https://github.com/ldrumm edited https://github.com/llvm/llvm-project/pull/86318 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` (PR #89868)
@@ -321,8 +321,15 @@ class LLDB_API SBDebugger { void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton); - void SetDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback, - void *baton); + lldb::SBDebuggerDestroyCallbackToken + AddDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback, + void *baton); + + lldb::SBDebuggerDestroyCallbackToken + SetDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback, jimingham wrote: Formally, returning the token from SetDestroyCallback is a reasonable addition, but it changes the signature of an extant SB API, which we don't allow - we are strict about maintaining backwards compatibility of the SB API's. Since we're deprecating this API anyway, I don't think we need to make Set play well with the Add/Remove model. Just leave it returning void. 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] [lldb-dap] Fix test_exit_status_message_sigterm test. (PR #90223)
mbucko wrote: > What about trying to use a python builtin like > https://docs.python.org/3/library/multiprocessing.html#multiprocessing.active_children? Nice, I will look into it https://github.com/llvm/llvm-project/pull/90223 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)
https://github.com/al45tair edited https://github.com/llvm/llvm-project/pull/90099 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb[Docs] Reduce title noise in packets doc (PR #90183)
https://github.com/JDevlieghere approved this pull request. Nice! https://github.com/llvm/llvm-project/pull/90183 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Fix test_exit_status_message_sigterm test. (PR #90223)
mbucko wrote: > What about trying to use a python builtin like > https://docs.python.org/3/library/multiprocessing.html#multiprocessing.active_children? It seems that multiprocessing doesn't provide a way to iteratively list the subprocesses and there is no other built in python library afaik. Do you know if it's possible to add 'psutil' as a dependency so that it's installed before the tests are run? https://github.com/llvm/llvm-project/pull/90223 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Fix test_exit_status_message_sigterm test. (PR #90223)
walter-erquinigo wrote: @JDevlieghere , do you know if it's possible to add python dependencies somewhere for lldb tests? https://github.com/llvm/llvm-project/pull/90223 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 01d7dcf - [lldb] Switch to llvm::DWARFUnitHeader (#89808)
Author: Alex Langford Date: 2024-04-26T11:32:12-07:00 New Revision: 01d7dcfe5e3b261f587c05e33ffeecae7a11da80 URL: https://github.com/llvm/llvm-project/commit/01d7dcfe5e3b261f587c05e33ffeecae7a11da80 DIFF: https://github.com/llvm/llvm-project/commit/01d7dcfe5e3b261f587c05e33ffeecae7a11da80.diff LOG: [lldb] Switch to llvm::DWARFUnitHeader (#89808) These are now close enough that they can be swapped out. Added: Modified: lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h lldb/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h Removed: diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h index dd130977d4b1fb..b8344f548ac3dc 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h @@ -32,7 +32,7 @@ class DWARFCompileUnit : public DWARFUnit { private: DWARFCompileUnit(SymbolFileDWARF &dwarf, lldb::user_id_t uid, - const DWARFUnitHeader &header, + const llvm::DWARFUnitHeader &header, const llvm::DWARFAbbreviationDeclarationSet &abbrevs, DIERef::Section section, bool is_dwo) : DWARFUnit(dwarf, uid, header, abbrevs, section, is_dwo) {} diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h index 7b58c632c6c5be..8c1f932d8c7fa4 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h @@ -24,15 +24,15 @@ class DWARFTypeUnit : public DWARFUnit { void Dump(Stream *s) const override; - uint64_t GetTypeHash() { return m_header.GetTypeHash(); } + uint64_t GetTypeHash() { return m_header.getTypeHash(); } - dw_offset_t GetTypeOffset() { return GetOffset() + m_header.GetTypeOffset(); } + dw_offset_t GetTypeOffset() { return GetOffset() + m_header.getTypeOffset(); } static bool classof(const DWARFUnit *unit) { return unit->IsTypeUnit(); } private: DWARFTypeUnit(SymbolFileDWARF &dwarf, lldb::user_id_t uid, -const DWARFUnitHeader &header, +const llvm::DWARFUnitHeader &header, const llvm::DWARFAbbreviationDeclarationSet &abbrevs, DIERef::Section section, bool is_dwo) : DWARFUnit(dwarf, uid, header, abbrevs, section, is_dwo) {} diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp index e28036d34b34a6..dabc595427dfa1 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -33,12 +33,12 @@ using namespace lldb_private::plugin::dwarf; extern int g_verbose; DWARFUnit::DWARFUnit(SymbolFileDWARF &dwarf, lldb::user_id_t uid, - const DWARFUnitHeader &header, + const llvm::DWARFUnitHeader &header, const llvm::DWARFAbbreviationDeclarationSet &abbrevs, DIERef::Section section, bool is_dwo) : UserID(uid), m_dwarf(dwarf), m_header(header), m_abbrevs(&abbrevs), m_cancel_scopes(false), m_section(section), m_is_dwo(is_dwo), - m_has_parsed_non_skeleton_unit(false), m_dwo_id(header.GetDWOId()) {} + m_has_parsed_non_skeleton_unit(false), m_dwo_id(header.getDWOId()) {} DWARFUnit::~DWARFUnit() = default; @@ -345,7 +345,7 @@ void DWARFUnit::ExtractDIEsRWLocked() { void DWARFUnit::SetDwoStrOffsetsBase() { lldb::offset_t baseOffset = 0; - if (const llvm::DWARFUnitIndex::Entry *entry = m_header.GetIndexEntry()) { + if (const llvm::DWARFUnitIndex::Entry *entry = m_header.getIndexEntry()) { if (const auto *contribution = entry->getContribution(llvm::DW_SECT_STR_OFFSETS)) baseOffset = contribution->getOffset(); @@ -489,7 +489,7 @@ ParseListTableHeader(const llvm::DWARFDataExtractor &data, uint64_t offset, void DWARFUnit::SetLoclistsBase(dw_addr_t loclists_base) { uint64_t offset = 0; - if (const llvm::DWARFUnitIndex::Entry *entry = m_header.GetIndexEntry()) { + if (const llvm::DWARFUnitIndex::Entry *entry = m_header.getIndexEntry()) { const auto *contribution = entry->getContribution(llvm::DW_SECT_LOCLISTS); if (!contribution) { GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError( @@ -533,7 +533,7 @@ DWARFDataExtractor DWARFUnit::GetLocationData() const { DWARFContext &Ctx = GetSymbolFileDWARF().GetDWARFContext(); const DWARFDataExtractor &data = GetVersion() >= 5 ? Ctx.getOrLoadLocListsData() : Ctx.getOrLoadLocData(); - if (const llvm::DWARFUnitIndex::Entry *entry = m_header.GetIndexEntry()) { + if (const llvm::DWARFUnitIndex::Entry *entry = m_
[Lldb-commits] [lldb] [lldb] Switch to llvm::DWARFUnitHeader (PR #89808)
https://github.com/bulbazord closed https://github.com/llvm/llvm-project/pull/89808 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)
labath wrote: > > [this](https://github.com/llvm/llvm-project/blob/main/llvm/test/tools/yaml2obj/ELF/duplicate-section-names.yaml) > > test seems to indicate that's possible (the trick appears to me in `(n)` > > name tag suffixes). Can you give that a shot? > > I've actually just included a binary file that exhibits the problem. I saw that, but a textual test is definitely preferable, particularly after the linux xz fiasco. This wouldn't be the first test binary in our repo, but in this case, I think it actually adds a lot of value, since yaml2obj operates on the same level as what you are testing (so you can see the input of the test eyeball-verify that the expected output makes sense). https://github.com/llvm/llvm-project/pull/90099 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 266a927 - [lldb] Fix typo in CumulativeSystemTimeIsValid check (#89680)
Author: Marc Auberer Date: 2024-04-26T20:57:04+02:00 New Revision: 266a9274dd14d06d559ca8a37e2d1b5f985a5398 URL: https://github.com/llvm/llvm-project/commit/266a9274dd14d06d559ca8a37e2d1b5f985a5398 DIFF: https://github.com/llvm/llvm-project/commit/266a9274dd14d06d559ca8a37e2d1b5f985a5398.diff LOG: [lldb] Fix typo in CumulativeSystemTimeIsValid check (#89680) Resolves #89674 Added: Modified: lldb/include/lldb/Utility/ProcessInfo.h lldb/unittests/Host/HostTest.cpp Removed: diff --git a/lldb/include/lldb/Utility/ProcessInfo.h b/lldb/include/lldb/Utility/ProcessInfo.h index e9fe71e1b851d1..54ac000dc7fc28 100644 --- a/lldb/include/lldb/Utility/ProcessInfo.h +++ b/lldb/include/lldb/Utility/ProcessInfo.h @@ -234,7 +234,7 @@ class ProcessInstanceInfo : public ProcessInfo { bool CumulativeSystemTimeIsValid() const { return m_cumulative_system_time.tv_sec > 0 || - m_cumulative_system_time.tv_sec > 0; + m_cumulative_system_time.tv_usec > 0; } void Dump(Stream &s, UserIDResolver &resolver) const; diff --git a/lldb/unittests/Host/HostTest.cpp b/lldb/unittests/Host/HostTest.cpp index 5e01a6835c03dc..a1d8a3b7f485a3 100644 --- a/lldb/unittests/Host/HostTest.cpp +++ b/lldb/unittests/Host/HostTest.cpp @@ -7,6 +7,7 @@ //===--===// #include "lldb/Host/Host.h" +#include "lldb/Utility/ProcessInfo.h" #include "gtest/gtest.h" using namespace lldb_private; @@ -25,3 +26,23 @@ TEST(Host, GetEnvironment) { ASSERT_EQ("Host::GetEnvironment", Host::GetEnvironment().lookup("LLDB_TEST_ENVIRONMENT_VAR")); } + +TEST(Host, ProcessInstanceInfoCumulativeUserTimeIsValid) { + ProcessInstanceInfo info; + info.SetCumulativeUserTime(ProcessInstanceInfo::timespec{0, 0}); + EXPECT_FALSE(info.CumulativeUserTimeIsValid()); + info.SetCumulativeUserTime(ProcessInstanceInfo::timespec{0, 1}); + EXPECT_TRUE(info.CumulativeUserTimeIsValid()); + info.SetCumulativeUserTime(ProcessInstanceInfo::timespec{1, 0}); + EXPECT_TRUE(info.CumulativeUserTimeIsValid()); +} + +TEST(Host, ProcessInstanceInfoCumulativeSystemTimeIsValid) { + ProcessInstanceInfo info; + info.SetCumulativeSystemTime(ProcessInstanceInfo::timespec{0, 0}); + EXPECT_FALSE(info.CumulativeSystemTimeIsValid()); + info.SetCumulativeSystemTime(ProcessInstanceInfo::timespec{0, 1}); + EXPECT_TRUE(info.CumulativeSystemTimeIsValid()); + info.SetCumulativeSystemTime(ProcessInstanceInfo::timespec{1, 0}); + EXPECT_TRUE(info.CumulativeSystemTimeIsValid()); +} \ No newline at end of file ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix typo in CumulativeSystemTimeIsValid check (PR #89680)
https://github.com/marcauberer closed https://github.com/llvm/llvm-project/pull/89680 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)
https://github.com/adrian-prantl updated https://github.com/llvm/llvm-project/pull/89981 >From aba61b23b402f350161139adfffc3799a3135c8a Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Wed, 24 Apr 2024 12:50:43 -0700 Subject: [PATCH] Add a new SBExpressionOptions::SetLanguage() API (NFCI) that separates out language and version. To avoid reinventing the wheel and introducing subtle incompatibilities, this API uses the table of languages and versiond defined by the upcoming DWARF 6 standard (https://dwarfstd.org/languages-v6.html). While the DWARF 6 spec is not finialized, the list of languages is broadly considered stable. The primary motivation for this is to allow the Swift language plugin to switch between language dialects between, e.g., Swift 5.9 and 6.0 with out introducing a ton of new language codes. On the main branch this change is considered NFC. --- lldb/include/lldb/API/SBExpressionOptions.h | 13 ++ lldb/include/lldb/Expression/Expression.h | 7 +--- .../lldb/Expression/LLVMUserExpression.h | 2 +- lldb/include/lldb/Expression/UserExpression.h | 33 --- lldb/include/lldb/Symbol/TypeSystem.h | 10 ++--- lldb/include/lldb/Target/StackFrame.h | 11 +++-- lldb/include/lldb/Target/Target.h | 19 ++--- lldb/include/lldb/lldb-private-types.h| 19 + .../Python/lldbsuite/test/configuration.py| 1 + lldb/packages/Python/lldbsuite/test/dotest.py | 3 ++ .../Python/lldbsuite/test/dotest_args.py | 6 +++ .../Python/lldbsuite/test/lldbtest.py | 6 ++- lldb/source/API/CMakeLists.txt| 7 lldb/source/API/SBExpressionOptions.cpp | 7 lldb/source/API/SBFrame.cpp | 30 -- lldb/source/Breakpoint/Watchpoint.cpp | 5 +-- .../Commands/CommandObjectDWIMPrint.cpp | 2 +- lldb/source/Commands/CommandObjectType.cpp| 2 +- lldb/source/Expression/LLVMUserExpression.cpp | 2 +- lldb/source/Expression/UserExpression.cpp | 14 --- lldb/source/Expression/UtilityFunction.cpp| 4 +- .../Clang/ClangExpressionParser.cpp | 12 +++--- .../Clang/ClangUserExpression.cpp | 19 - .../Clang/ClangUserExpression.h | 6 +-- .../TypeSystem/Clang/TypeSystemClang.cpp | 2 +- .../TypeSystem/Clang/TypeSystemClang.h| 12 +++--- lldb/source/Target/Language.cpp | 34 lldb/source/Target/StackFrame.cpp | 23 +-- lldb/source/Target/Target.cpp | 21 +- .../api/multithreaded/TestMultithreaded.py| 1 + lldb/test/API/lit.cfg.py | 3 ++ lldb/test/API/lit.site.cfg.py.in | 1 + lldb/utils/TableGen/CMakeLists.txt| 1 + lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp| 40 +++ lldb/utils/TableGen/LLDBTableGen.cpp | 9 - lldb/utils/TableGen/LLDBTableGenBackends.h| 1 + 36 files changed, 272 insertions(+), 116 deletions(-) create mode 100644 lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp diff --git a/lldb/include/lldb/API/SBExpressionOptions.h b/lldb/include/lldb/API/SBExpressionOptions.h index e0ddfda5ba37a2..0742b975ed5ed0 100644 --- a/lldb/include/lldb/API/SBExpressionOptions.h +++ b/lldb/include/lldb/API/SBExpressionOptions.h @@ -15,6 +15,15 @@ namespace lldb { +/// Programming language type. +/// +/// These enumerations use the same language enumerations as the DWARF +/// specification for ease of use and consistency. +enum SBSourceLanguageName : uint16_t { +#define HANDLE_DW_LNAME(ID, NAME, DESC, LOWER_BOUND) eLanguageName##NAME = ID, +#include "lldb/API/Languages.h" +}; + class LLDB_API SBExpressionOptions { public: SBExpressionOptions(); @@ -67,6 +76,10 @@ class LLDB_API SBExpressionOptions { void SetTrapExceptions(bool trap_exceptions = true); void SetLanguage(lldb::LanguageType language); + /// Set the language using a pair of language code and version as + /// defined by the DWARF 6 specification. + /// WARNING: These codes may change until DWARF 6 is finalized. + void SetLanguage(uint16_t dwarf_lname_code, uint32_t dwarf_lversion); #ifndef SWIG void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton); diff --git a/lldb/include/lldb/Expression/Expression.h b/lldb/include/lldb/Expression/Expression.h index 3e61d78828bbbf..356fe4b82ae43a 100644 --- a/lldb/include/lldb/Expression/Expression.h +++ b/lldb/include/lldb/Expression/Expression.h @@ -47,11 +47,8 @@ class Expression { /// expression. Text() should contain the definition of this function. virtual const char *FunctionName() = 0; - /// Return the language that should be used when parsing. To use the - /// default, return eLanguageTypeUnknown. - virtual lldb::LanguageType Language() const { -return lldb::eLanguageTypeUnknown; - } + /// Return the language that should be used when parsing. + virtual SourceLangua
[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)
github-actions[bot] wrote: :warning: Python code formatter, darker found issues in your code. :warning: You can test this locally with the following command: ``bash darker --check --diff -r 300340f656d762afa8bde5fc398757d2951560bf...aba61b23b402f350161139adfffc3799a3135c8a lldb/packages/Python/lldbsuite/test/configuration.py lldb/packages/Python/lldbsuite/test/dotest.py lldb/packages/Python/lldbsuite/test/dotest_args.py lldb/packages/Python/lldbsuite/test/lldbtest.py lldb/test/API/api/multithreaded/TestMultithreaded.py lldb/test/API/lit.cfg.py `` View the diff from darker here. ``diff --- test/API/api/multithreaded/TestMultithreaded.py 2024-04-26 19:25:57.00 + +++ test/API/api/multithreaded/TestMultithreaded.py 2024-04-26 19:28:58.154176 + @@ -105,11 +105,13 @@ self.inferior = "inferior_program" self.buildProgram("inferior.cpp", self.inferior) self.addTearDownHook(lambda: os.remove(self.getBuildArtifact(self.inferior))) -import pdb;pdb.set_trace() +import pdb + +pdb.set_trace() self.buildDriver(sources, test_name) self.addTearDownHook(lambda: os.remove(self.getBuildArtifact(test_name))) test_exe = self.getBuildArtifact(test_name) exe = [test_exe, self.getBuildArtifact(self.inferior)] `` https://github.com/llvm/llvm-project/pull/89981 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)
https://github.com/adrian-prantl updated https://github.com/llvm/llvm-project/pull/89981 >From 762029753f7c21352f653e1719cb6c75107f6a50 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Wed, 24 Apr 2024 12:50:43 -0700 Subject: [PATCH] Add a new SBExpressionOptions::SetLanguage() API (NFCI) that separates out language and version. To avoid reinventing the wheel and introducing subtle incompatibilities, this API uses the table of languages and versiond defined by the upcoming DWARF 6 standard (https://dwarfstd.org/languages-v6.html). While the DWARF 6 spec is not finialized, the list of languages is broadly considered stable. The primary motivation for this is to allow the Swift language plugin to switch between language dialects between, e.g., Swift 5.9 and 6.0 with out introducing a ton of new language codes. On the main branch this change is considered NFC. --- lldb/include/lldb/API/SBExpressionOptions.h | 13 ++ lldb/include/lldb/Expression/Expression.h | 7 +-- .../lldb/Expression/LLVMUserExpression.h | 2 +- lldb/include/lldb/Expression/UserExpression.h | 33 +++--- lldb/include/lldb/Symbol/TypeSystem.h | 10 ++--- lldb/include/lldb/Target/StackFrame.h | 11 +++-- lldb/include/lldb/Target/Target.h | 19 +--- lldb/include/lldb/lldb-private-types.h| 25 +++ .../Python/lldbsuite/test/configuration.py| 1 + lldb/packages/Python/lldbsuite/test/dotest.py | 3 ++ .../Python/lldbsuite/test/dotest_args.py | 6 +++ .../Python/lldbsuite/test/lldbtest.py | 6 ++- lldb/source/API/CMakeLists.txt| 7 +++ lldb/source/API/SBExpressionOptions.cpp | 7 +++ lldb/source/API/SBFrame.cpp | 30 +++-- lldb/source/Breakpoint/Watchpoint.cpp | 5 +-- .../Commands/CommandObjectDWIMPrint.cpp | 2 +- lldb/source/Commands/CommandObjectType.cpp| 2 +- lldb/source/Expression/LLVMUserExpression.cpp | 2 +- lldb/source/Expression/UserExpression.cpp | 14 +++--- lldb/source/Expression/UtilityFunction.cpp| 4 +- .../Clang/ClangExpressionParser.cpp | 12 ++--- .../Clang/ClangUserExpression.cpp | 19 .../Clang/ClangUserExpression.h | 6 +-- .../TypeSystem/Clang/TypeSystemClang.cpp | 2 +- .../TypeSystem/Clang/TypeSystemClang.h| 12 ++--- lldb/source/Target/Language.cpp | 34 ++ lldb/source/Target/StackFrame.cpp | 23 +- lldb/source/Target/Target.cpp | 21 - .../api/multithreaded/TestMultithreaded.py| 1 + lldb/test/API/lit.cfg.py | 3 ++ lldb/test/API/lit.site.cfg.py.in | 1 + lldb/utils/TableGen/CMakeLists.txt| 1 + lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp| 45 +++ lldb/utils/TableGen/LLDBTableGen.cpp | 9 +++- lldb/utils/TableGen/LLDBTableGenBackends.h| 1 + 36 files changed, 283 insertions(+), 116 deletions(-) create mode 100644 lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp diff --git a/lldb/include/lldb/API/SBExpressionOptions.h b/lldb/include/lldb/API/SBExpressionOptions.h index e0ddfda5ba37a2..10acbdb9683a67 100644 --- a/lldb/include/lldb/API/SBExpressionOptions.h +++ b/lldb/include/lldb/API/SBExpressionOptions.h @@ -15,6 +15,15 @@ namespace lldb { +/// Programming language type. +/// +/// These enumerations use the same language enumerations as the DWARF +/// specification for ease of use and consistency. +enum SBSourceLanguageName : uint16_t { +#define HANDLE_DW_LNAME(ID, NAME, DESC, LOWER_BOUND) eLanguageName##NAME = ID, +#include "lldb/API/Languages.h" +}; + class LLDB_API SBExpressionOptions { public: SBExpressionOptions(); @@ -67,6 +76,10 @@ class LLDB_API SBExpressionOptions { void SetTrapExceptions(bool trap_exceptions = true); void SetLanguage(lldb::LanguageType language); + /// Set the language using a pair of language code and version as + /// defined by the DWARF 6 specification. + /// WARNING: These codes may change until DWARF 6 is finalized. + void SetLanguage(SBSourceLanguageName name, uint32_t version); #ifndef SWIG void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton); diff --git a/lldb/include/lldb/Expression/Expression.h b/lldb/include/lldb/Expression/Expression.h index 3e61d78828bbbf..356fe4b82ae43a 100644 --- a/lldb/include/lldb/Expression/Expression.h +++ b/lldb/include/lldb/Expression/Expression.h @@ -47,11 +47,8 @@ class Expression { /// expression. Text() should contain the definition of this function. virtual const char *FunctionName() = 0; - /// Return the language that should be used when parsing. To use the - /// default, return eLanguageTypeUnknown. - virtual lldb::LanguageType Language() const { -return lldb::eLanguageTypeUnknown; - } + /// Return the language that should be used when parsing. + virtual SourceLanguage Language() const {
[Lldb-commits] [lldb] [lldb][sbapi] Fix API break in SBDebugger broadcast bits (PR #90261)
https://github.com/chelcassanova created https://github.com/llvm/llvm-project/pull/90261 https://github.com/llvm/llvm-project/pull/87409 removed the broadcast bits from SBDebugger and placed them in `lldb-enumerations.h`. This is API-breaking so this commits places the enum back into `SBDebugger.h` and references the bits from `lldb-enumerations.h`. >From b0a7237da0517f59f04791d8ecef102acc84408a Mon Sep 17 00:00:00 2001 From: Chelsea Cassanova Date: Fri, 26 Apr 2024 12:52:19 -0700 Subject: [PATCH] [lldb][sbapi] Fix API break in SBDebugger broadcast bits https://github.com/llvm/llvm-project/pull/87409 removed the broadcast bits from SBDebugger and placed them in `lldb-enumerations.h`. This is API-breaking so this commits places the enum back into `SBDebugger.h` and references the bits from `lldb-enumerations.h`. --- lldb/include/lldb/API/SBDebugger.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index cf5409a12a056a..7333cd57ad3129 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -42,6 +42,13 @@ class LLDB_API SBInputReader { class LLDB_API SBDebugger { public: + FLAGS_ANONYMOUS_ENUM(){ + eBroadcastBitProgress = lldb::DebuggerBroadcastBit::eBroadcastBitProgress, + eBroadcastBitWarning = lldb::DebuggerBroadcastBit::eBroadcastBitWarning, + eBroadcastBitError = lldb::DebuggerBroadcastBit::eBroadcastBitError, + eBroadcastBitProgressCategory = + lldb::DebuggerBroadcastBit::eBroadcastBitProgressCategory, + }; SBDebugger(); SBDebugger(const lldb::SBDebugger &rhs); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][sbapi] Fix API break in SBDebugger broadcast bits (PR #90261)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Chelsea Cassanova (chelcassanova) Changes https://github.com/llvm/llvm-project/pull/87409 removed the broadcast bits from SBDebugger and placed them in `lldb-enumerations.h`. This is API-breaking so this commits places the enum back into `SBDebugger.h` and references the bits from `lldb-enumerations.h`. --- Full diff: https://github.com/llvm/llvm-project/pull/90261.diff 1 Files Affected: - (modified) lldb/include/lldb/API/SBDebugger.h (+7) ``diff diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index cf5409a12a056a..7333cd57ad3129 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -42,6 +42,13 @@ class LLDB_API SBInputReader { class LLDB_API SBDebugger { public: + FLAGS_ANONYMOUS_ENUM(){ + eBroadcastBitProgress = lldb::DebuggerBroadcastBit::eBroadcastBitProgress, + eBroadcastBitWarning = lldb::DebuggerBroadcastBit::eBroadcastBitWarning, + eBroadcastBitError = lldb::DebuggerBroadcastBit::eBroadcastBitError, + eBroadcastBitProgressCategory = + lldb::DebuggerBroadcastBit::eBroadcastBitProgressCategory, + }; SBDebugger(); SBDebugger(const lldb::SBDebugger &rhs); `` https://github.com/llvm/llvm-project/pull/90261 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)
https://github.com/adrian-prantl updated https://github.com/llvm/llvm-project/pull/89981 >From 280caa3e26227338071409213646625d05f6eba5 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Wed, 24 Apr 2024 12:50:43 -0700 Subject: [PATCH] Add a new SBExpressionOptions::SetLanguage() API (NFCI) that separates out language and version. To avoid reinventing the wheel and introducing subtle incompatibilities, this API uses the table of languages and versiond defined by the upcoming DWARF 6 standard (https://dwarfstd.org/languages-v6.html). While the DWARF 6 spec is not finialized, the list of languages is broadly considered stable. The primary motivation for this is to allow the Swift language plugin to switch between language dialects between, e.g., Swift 5.9 and 6.0 with out introducing a ton of new language codes. On the main branch this change is considered NFC. --- lldb/include/lldb/API/SBExpressionOptions.h | 13 ++ lldb/include/lldb/Expression/Expression.h | 7 +-- .../lldb/Expression/LLVMUserExpression.h | 2 +- lldb/include/lldb/Expression/UserExpression.h | 33 +++--- lldb/include/lldb/Symbol/TypeSystem.h | 10 ++--- lldb/include/lldb/Target/StackFrame.h | 11 +++-- lldb/include/lldb/Target/Target.h | 19 +--- lldb/include/lldb/lldb-private-types.h| 25 +++ .../Python/lldbsuite/test/configuration.py| 1 + lldb/packages/Python/lldbsuite/test/dotest.py | 3 ++ .../Python/lldbsuite/test/dotest_args.py | 6 +++ .../Python/lldbsuite/test/lldbtest.py | 19 +--- lldb/source/API/CMakeLists.txt| 7 +++ lldb/source/API/SBExpressionOptions.cpp | 7 +++ lldb/source/API/SBFrame.cpp | 30 +++-- lldb/source/Breakpoint/Watchpoint.cpp | 5 +-- .../Commands/CommandObjectDWIMPrint.cpp | 2 +- lldb/source/Commands/CommandObjectType.cpp| 2 +- lldb/source/Expression/LLVMUserExpression.cpp | 2 +- lldb/source/Expression/UserExpression.cpp | 14 +++--- lldb/source/Expression/UtilityFunction.cpp| 4 +- .../Clang/ClangExpressionParser.cpp | 12 ++--- .../Clang/ClangUserExpression.cpp | 19 .../Clang/ClangUserExpression.h | 6 +-- .../TypeSystem/Clang/TypeSystemClang.cpp | 2 +- .../TypeSystem/Clang/TypeSystemClang.h| 12 ++--- lldb/source/Target/Language.cpp | 34 ++ lldb/source/Target/StackFrame.cpp | 23 +- lldb/source/Target/Target.cpp | 21 - lldb/test/API/lit.cfg.py | 3 ++ lldb/test/API/lit.site.cfg.py.in | 1 + lldb/utils/TableGen/CMakeLists.txt| 1 + lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp| 45 +++ lldb/utils/TableGen/LLDBTableGen.cpp | 9 +++- lldb/utils/TableGen/LLDBTableGenBackends.h| 1 + 35 files changed, 290 insertions(+), 121 deletions(-) create mode 100644 lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp diff --git a/lldb/include/lldb/API/SBExpressionOptions.h b/lldb/include/lldb/API/SBExpressionOptions.h index e0ddfda5ba37a2..10acbdb9683a67 100644 --- a/lldb/include/lldb/API/SBExpressionOptions.h +++ b/lldb/include/lldb/API/SBExpressionOptions.h @@ -15,6 +15,15 @@ namespace lldb { +/// Programming language type. +/// +/// These enumerations use the same language enumerations as the DWARF +/// specification for ease of use and consistency. +enum SBSourceLanguageName : uint16_t { +#define HANDLE_DW_LNAME(ID, NAME, DESC, LOWER_BOUND) eLanguageName##NAME = ID, +#include "lldb/API/Languages.h" +}; + class LLDB_API SBExpressionOptions { public: SBExpressionOptions(); @@ -67,6 +76,10 @@ class LLDB_API SBExpressionOptions { void SetTrapExceptions(bool trap_exceptions = true); void SetLanguage(lldb::LanguageType language); + /// Set the language using a pair of language code and version as + /// defined by the DWARF 6 specification. + /// WARNING: These codes may change until DWARF 6 is finalized. + void SetLanguage(SBSourceLanguageName name, uint32_t version); #ifndef SWIG void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton); diff --git a/lldb/include/lldb/Expression/Expression.h b/lldb/include/lldb/Expression/Expression.h index 3e61d78828bbbf..356fe4b82ae43a 100644 --- a/lldb/include/lldb/Expression/Expression.h +++ b/lldb/include/lldb/Expression/Expression.h @@ -47,11 +47,8 @@ class Expression { /// expression. Text() should contain the definition of this function. virtual const char *FunctionName() = 0; - /// Return the language that should be used when parsing. To use the - /// default, return eLanguageTypeUnknown. - virtual lldb::LanguageType Language() const { -return lldb::eLanguageTypeUnknown; - } + /// Return the language that should be used when parsing. + virtual SourceLanguage Language() const { return {}; } /// Return the Materializer tha
[Lldb-commits] [lldb] [lldb][sbapi] Fix API break in SBDebugger broadcast bits (PR #90261)
https://github.com/chelcassanova updated https://github.com/llvm/llvm-project/pull/90261 >From 697ab926dd1139810ec7d126258f6386552cdf96 Mon Sep 17 00:00:00 2001 From: Chelsea Cassanova Date: Fri, 26 Apr 2024 12:52:19 -0700 Subject: [PATCH] [lldb][sbapi] Fix API break in SBDebugger broadcast bits https://github.com/llvm/llvm-project/pull/87409 removed the broadcast bits from SBDebugger and placed them in `lldb-enumerations.h`. This is API-breaking so this commits places the enum back into `SBDebugger.h` and references the bits from `lldb-enumerations.h`. --- lldb/include/lldb/API/SBDebugger.h | 7 +++ .../diagnostic_reporting/TestDiagnosticReporting.py| 2 +- .../progress_reporting/TestProgressReporting.py| 2 +- .../clang_modules/TestClangModuleBuildProgress.py | 2 +- lldb/test/API/macosx/rosetta/TestRosetta.py| 2 +- lldb/tools/lldb-dap/lldb-dap.cpp | 4 ++-- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index cf5409a12a056a..7333cd57ad3129 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -42,6 +42,13 @@ class LLDB_API SBInputReader { class LLDB_API SBDebugger { public: + FLAGS_ANONYMOUS_ENUM(){ + eBroadcastBitProgress = lldb::DebuggerBroadcastBit::eBroadcastBitProgress, + eBroadcastBitWarning = lldb::DebuggerBroadcastBit::eBroadcastBitWarning, + eBroadcastBitError = lldb::DebuggerBroadcastBit::eBroadcastBitError, + eBroadcastBitProgressCategory = + lldb::DebuggerBroadcastBit::eBroadcastBitProgressCategory, + }; SBDebugger(); SBDebugger(const lldb::SBDebugger &rhs); diff --git a/lldb/test/API/functionalities/diagnostic_reporting/TestDiagnosticReporting.py b/lldb/test/API/functionalities/diagnostic_reporting/TestDiagnosticReporting.py index 6353e3e8cbedbd..36a3be695628f5 100644 --- a/lldb/test/API/functionalities/diagnostic_reporting/TestDiagnosticReporting.py +++ b/lldb/test/API/functionalities/diagnostic_reporting/TestDiagnosticReporting.py @@ -15,7 +15,7 @@ def setUp(self): self.broadcaster = self.dbg.GetBroadcaster() self.listener = lldbutil.start_listening_from( self.broadcaster, -lldb.eBroadcastBitWarning | lldb.eBroadcastBitError, +lldb.SBDebugger.eBroadcastBitWarning | lldb.SBDebugger.eBroadcastBitError, ) def test_dwarf_symbol_loading_diagnostic_report(self): diff --git a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py index 98988d7624da3c..9af53845ca1b77 100644 --- a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py +++ b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py @@ -13,7 +13,7 @@ def setUp(self): TestBase.setUp(self) self.broadcaster = self.dbg.GetBroadcaster() self.listener = lldbutil.start_listening_from( -self.broadcaster, lldb.eBroadcastBitProgress +self.broadcaster, lldb.SBDebugger.eBroadcastBitProgress ) def test_dwarf_symbol_loading_progress_report(self): diff --git a/lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py b/lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py index 33c7c269c081e4..228f676aedf6ac 100644 --- a/lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py +++ b/lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py @@ -34,7 +34,7 @@ def test_clang_module_build_progress_report(self): # other unrelated progress events. broadcaster = self.dbg.GetBroadcaster() listener = lldbutil.start_listening_from( -broadcaster, lldb.eBroadcastBitProgress +broadcaster, lldb.SBDebugger.eBroadcastBitProgress ) # Trigger module builds. diff --git a/lldb/test/API/macosx/rosetta/TestRosetta.py b/lldb/test/API/macosx/rosetta/TestRosetta.py index 669db95a1624c6..ce40de475ef16c 100644 --- a/lldb/test/API/macosx/rosetta/TestRosetta.py +++ b/lldb/test/API/macosx/rosetta/TestRosetta.py @@ -49,7 +49,7 @@ def test_rosetta(self): if rosetta_debugserver_installed(): broadcaster = self.dbg.GetBroadcaster() listener = lldbutil.start_listening_from( -broadcaster, lldb.eBroadcastBitWarning +broadcaster, lldb.SBDebugger.eBroadcastBitWarning ) target, process, thread, bkpt = lldbutil.run_to_source_breakpoint( diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp index 16c50ed5791b0a..97a6df3508f4f1 100644 --- a/lldb/tools/lldb-dap/lldb-dap.cpp +++ b/lldb/tools/lldb-dap/lldb
[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)
@@ -67,6 +67,10 @@ class LLDB_API SBExpressionOptions { void SetTrapExceptions(bool trap_exceptions = true); void SetLanguage(lldb::LanguageType language); + /// Set the language using a pair of language code and version as + /// defined by the DWARF 6 specification. + /// WARNING: These codes may change until DWARF 6 is finalized. + void SetLanguage(uint16_t dwarf_lname_code, uint32_t dwarf_lversion); adrian-prantl wrote: @JDevlieghere Can you take another look? This version generates a header file in the API directory from LLVM's Dwarf.def and (at least locally) passes the testsuite and installs into the include/API directory. https://github.com/llvm/llvm-project/pull/89981 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][sbapi] Fix API break in SBDebugger broadcast bits (PR #90261)
https://github.com/JDevlieghere approved this pull request. https://github.com/llvm/llvm-project/pull/90261 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] a4c21d1 - [lldb][sbapi] Fix API break in SBDebugger broadcast bits (#90261)
Author: Chelsea Cassanova Date: 2024-04-26T13:18:45-07:00 New Revision: a4c21d17fe187feb9e666ae8290b6d318014e9c8 URL: https://github.com/llvm/llvm-project/commit/a4c21d17fe187feb9e666ae8290b6d318014e9c8 DIFF: https://github.com/llvm/llvm-project/commit/a4c21d17fe187feb9e666ae8290b6d318014e9c8.diff LOG: [lldb][sbapi] Fix API break in SBDebugger broadcast bits (#90261) https://github.com/llvm/llvm-project/pull/87409 removed the broadcast bits from SBDebugger and placed them in `lldb-enumerations.h`. This is API-breaking so this commits places the enum back into `SBDebugger.h` and references the bits from `lldb-enumerations.h`. rdar://127128536 Added: Modified: lldb/include/lldb/API/SBDebugger.h lldb/test/API/functionalities/diagnostic_reporting/TestDiagnosticReporting.py lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py lldb/test/API/macosx/rosetta/TestRosetta.py lldb/tools/lldb-dap/lldb-dap.cpp Removed: diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index cf5409a12a056a..7333cd57ad3129 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -42,6 +42,13 @@ class LLDB_API SBInputReader { class LLDB_API SBDebugger { public: + FLAGS_ANONYMOUS_ENUM(){ + eBroadcastBitProgress = lldb::DebuggerBroadcastBit::eBroadcastBitProgress, + eBroadcastBitWarning = lldb::DebuggerBroadcastBit::eBroadcastBitWarning, + eBroadcastBitError = lldb::DebuggerBroadcastBit::eBroadcastBitError, + eBroadcastBitProgressCategory = + lldb::DebuggerBroadcastBit::eBroadcastBitProgressCategory, + }; SBDebugger(); SBDebugger(const lldb::SBDebugger &rhs); diff --git a/lldb/test/API/functionalities/diagnostic_reporting/TestDiagnosticReporting.py b/lldb/test/API/functionalities/diagnostic_reporting/TestDiagnosticReporting.py index 6353e3e8cbedbd..36a3be695628f5 100644 --- a/lldb/test/API/functionalities/diagnostic_reporting/TestDiagnosticReporting.py +++ b/lldb/test/API/functionalities/diagnostic_reporting/TestDiagnosticReporting.py @@ -15,7 +15,7 @@ def setUp(self): self.broadcaster = self.dbg.GetBroadcaster() self.listener = lldbutil.start_listening_from( self.broadcaster, -lldb.eBroadcastBitWarning | lldb.eBroadcastBitError, +lldb.SBDebugger.eBroadcastBitWarning | lldb.SBDebugger.eBroadcastBitError, ) def test_dwarf_symbol_loading_diagnostic_report(self): diff --git a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py index 98988d7624da3c..9af53845ca1b77 100644 --- a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py +++ b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py @@ -13,7 +13,7 @@ def setUp(self): TestBase.setUp(self) self.broadcaster = self.dbg.GetBroadcaster() self.listener = lldbutil.start_listening_from( -self.broadcaster, lldb.eBroadcastBitProgress +self.broadcaster, lldb.SBDebugger.eBroadcastBitProgress ) def test_dwarf_symbol_loading_progress_report(self): diff --git a/lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py b/lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py index 33c7c269c081e4..228f676aedf6ac 100644 --- a/lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py +++ b/lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py @@ -34,7 +34,7 @@ def test_clang_module_build_progress_report(self): # other unrelated progress events. broadcaster = self.dbg.GetBroadcaster() listener = lldbutil.start_listening_from( -broadcaster, lldb.eBroadcastBitProgress +broadcaster, lldb.SBDebugger.eBroadcastBitProgress ) # Trigger module builds. diff --git a/lldb/test/API/macosx/rosetta/TestRosetta.py b/lldb/test/API/macosx/rosetta/TestRosetta.py index 669db95a1624c6..ce40de475ef16c 100644 --- a/lldb/test/API/macosx/rosetta/TestRosetta.py +++ b/lldb/test/API/macosx/rosetta/TestRosetta.py @@ -49,7 +49,7 @@ def test_rosetta(self): if rosetta_debugserver_installed(): broadcaster = self.dbg.GetBroadcaster() listener = lldbutil.start_listening_from( -broadcaster, lldb.eBroadcastBitWarning +broadcaster, lldb.SBDebugger.eBroadcastBitWarning ) target, process, thread, bkpt = lldbutil.run_to_source_breakpoint( diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp
[Lldb-commits] [lldb] [lldb][sbapi] Fix API break in SBDebugger broadcast bits (PR #90261)
https://github.com/chelcassanova closed https://github.com/llvm/llvm-project/pull/90261 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)
@@ -0,0 +1,45 @@ +//===- LLDBPropertyDefEmitter.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: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// Produce the list of source languages header file fragment for the SBAPI. +// +//===--===// + +#include +#include +namespace lldb_private { +int EmitSBAPIDWARFEnum(int argc, char **argv) { + std::string InputFilename; + std::string OutputFilename; + std::string DepFilename; + // This command line option parser is as robust as the worst shell script. JDevlieghere wrote: 😂 https://github.com/llvm/llvm-project/pull/89981 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)
@@ -0,0 +1,45 @@ +//===- LLDBPropertyDefEmitter.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: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// Produce the list of source languages header file fragment for the SBAPI. +// +//===--===// + +#include +#include +namespace lldb_private { +int EmitSBAPIDWARFEnum(int argc, char **argv) { + std::string InputFilename; + std::string OutputFilename; + std::string DepFilename; + // This command line option parser is as robust as the worst shell script. + for (int i = 0; i < argc; ++i) { +if (llvm::StringRef(argv[i]).ends_with("Dwarf.def")) + InputFilename = std::string(argv[i]); +if (llvm::StringRef(argv[i]) == "-o" && i + 1 < argc) + OutputFilename = std::string(argv[i + 1]); +if (llvm::StringRef(argv[i]) == "-d" && i + 1 < argc) + DepFilename = std::string(argv[i + 1]); + } + std::ifstream input(InputFilename); + std::ofstream output(OutputFilename); + output << "// Do not include this file directly.\n"; + output << "#ifndef HANDLE_DW_LNAME\n"; + output << "#error \"Missing macro definition\"\n"; + output << "#endif\n"; + std::string line; + while (std::getline(input, line)) { +if (llvm::StringRef(line).starts_with("HANDLE_DW_LNAME")) + output << line << '\n'; + } + output << "#undef HANDLE_DW_LNAME\n"; JDevlieghere wrote: Why not generate `SBSourceLanguageName` directly? It seems tedious that you would have to run the preprocessor on the LLDB headers. Does that even work for SWIG? https://github.com/llvm/llvm-project/pull/89981 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)
@@ -10,6 +10,7 @@ config.llvm_build_mode = lit_config.substitute("@LLVM_BUILD_MODE@") config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" config.lldb_obj_root = "@LLDB_BINARY_DIR@" config.lldb_src_root = "@LLDB_SOURCE_DIR@" +config.lldb_built_include_dir = lit_config.substitute("@LLDB_BINARY_DIR@/include") JDevlieghere wrote: If this is always `@LLDB_BINARY_DIR@/include`, why not use ``` config.lldb_built_include_dir = os.path.join(config.lldb_obj_root. 'include') ``` or even better: don't create a new variable at all and have dotest derive it from `config.lldb_obj_root`? https://github.com/llvm/llvm-project/pull/89981 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` (PR #89868)
https://github.com/royitaqi updated https://github.com/llvm/llvm-project/pull/89868 >From 079a550481d4cdcb69ad01c376b5e1f0632a07d6 Mon Sep 17 00:00:00 2001 From: Roy Shi Date: Tue, 23 Apr 2024 18:10:21 -0700 Subject: [PATCH 01/10] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` --- lldb/include/lldb/Core/Debugger.h | 4 ++-- lldb/source/Core/Debugger.cpp | 10 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index 418c2403d020f4..20884f954ec7db 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -731,8 +731,8 @@ 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 = nullptr; + std::vector> + m_destroy_callback_and_baton; uint32_t m_interrupt_requested = 0; ///< Tracks interrupt requests std::mutex m_interrupt_mutex; diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 19b3cf3bbf46b1..0ebdf2b0a0f970 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -743,10 +743,11 @@ 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; + const lldb::user_id_t user_id = GetID(); + for (const auto &callback_and_baton : m_destroy_callback_and_baton) { +callback_and_baton.first(user_id, callback_and_baton.second); } + m_destroy_callback_and_baton.clear(); } void Debugger::Destroy(DebuggerSP &debugger_sp) { @@ -1427,8 +1428,7 @@ 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 = baton; + m_destroy_callback_and_baton.emplace_back(destroy_callback, baton); } static void PrivateReportProgress(Debugger &debugger, uint64_t progress_id, >From 771b52723be8d0ffecaf8f0818105cfdb82ba332 Mon Sep 17 00:00:00 2001 From: Roy Shi Date: Tue, 23 Apr 2024 21:05:58 -0700 Subject: [PATCH 02/10] Fix code format --- lldb/include/lldb/Core/Debugger.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index 20884f954ec7db..af025219b0bc12 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -732,7 +732,7 @@ class Debugger : public std::enable_shared_from_this, Diagnostics::CallbackID m_diagnostics_callback_id; std::vector> - m_destroy_callback_and_baton; + m_destroy_callback_and_baton; uint32_t m_interrupt_requested = 0; ///< Tracks interrupt requests std::mutex m_interrupt_mutex; >From d1f13cad8a3789a994572459893b32a225ba3e1b Mon Sep 17 00:00:00 2001 From: Roy Shi Date: Wed, 24 Apr 2024 11:55:16 -0700 Subject: [PATCH 03/10] Add `AddDestroyCallback()` and `ClearDestroyCallback()` --- lldb/include/lldb/Core/Debugger.h | 11 +++ lldb/source/Core/Debugger.cpp | 12 +++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index af025219b0bc12..5b3e433f09c68e 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -568,10 +568,21 @@ class Debugger : public std::enable_shared_from_this, static void ReportSymbolChange(const ModuleSpec &module_spec); + /// Add a callback for when the debugger is destroyed. A list is maintained + /// internally. + void + AddDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback, + void *baton); + + /// Clear the list of callbacks, then add the callback. void SetDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback, void *baton); + /// Clear the list of callbacks. + void + ClearDestroyCallback(); + /// Manually start the global event handler thread. It is useful to plugins /// that directly use the \a lldb_private namespace and want to use the /// debugger's default event handler thread instead of defining their own. diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 0ebdf2b0a0f970..159913642f253e 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -1426,11 +1426,21 @@ void Debugger::SetLoggingCallback(lldb::LogOutputCallback log_callback, std::make_shared(log_callback, baton); } -void Debugger::SetDestroyCallback( +void Debugger::AddDestroyCallback( lldb_private::DebuggerDestroyCallback destroy_callbac
[Lldb-commits] [lldb] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` (PR #89868)
@@ -743,10 +743,11 @@ 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; + const lldb::user_id_t user_id = GetID(); royitaqi wrote: Added double while-loop in `HandleDestroyCallback` to handle callbacks which can be added/removed during destroy. Added test `test_HandleDestroyCallback` to validate a simple example case. 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] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` (PR #89868)
@@ -121,6 +121,7 @@ typedef struct type256 { uint64_t x[4]; } type256; using ValueObjectProviderTy = std::function; +typedef int DebuggerDestroyCallbackToken; royitaqi wrote: Added `lldb::destroy_callback_token_t`. 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] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` (PR #89868)
@@ -568,10 +569,22 @@ class Debugger : public std::enable_shared_from_this, static void ReportSymbolChange(const ModuleSpec &module_spec); - void + /// DEPRECATED. Use AddDestroyCallback and RemoveDestroyCallback instead. + /// Clear all previously added callbacks and only add the given one. royitaqi wrote: Added into comment 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] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` (PR #89868)
@@ -1686,13 +1686,33 @@ void SBDebugger::SetLoggingCallback(lldb::LogOutputCallback log_callback, } } -void SBDebugger::SetDestroyCallback( -lldb::SBDebuggerDestroyCallback destroy_callback, void *baton) { +lldb::SBDebuggerDestroyCallbackToken +SBDebugger::AddDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback, void *baton) { + LLDB_INSTRUMENT_VA(this, destroy_callback, baton); + if (m_opaque_sp) { +return m_opaque_sp->AddDestroyCallback( +destroy_callback, baton); + } + return -1; royitaqi wrote: Added `LLDB_INVALID_DESTROY_CALLBACK_TOKEN`. 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] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` (PR #89868)
https://github.com/royitaqi updated https://github.com/llvm/llvm-project/pull/89868 >From 079a550481d4cdcb69ad01c376b5e1f0632a07d6 Mon Sep 17 00:00:00 2001 From: Roy Shi Date: Tue, 23 Apr 2024 18:10:21 -0700 Subject: [PATCH 01/11] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` --- lldb/include/lldb/Core/Debugger.h | 4 ++-- lldb/source/Core/Debugger.cpp | 10 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index 418c2403d020f4..20884f954ec7db 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -731,8 +731,8 @@ 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 = nullptr; + std::vector> + m_destroy_callback_and_baton; uint32_t m_interrupt_requested = 0; ///< Tracks interrupt requests std::mutex m_interrupt_mutex; diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 19b3cf3bbf46b1..0ebdf2b0a0f970 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -743,10 +743,11 @@ 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; + const lldb::user_id_t user_id = GetID(); + for (const auto &callback_and_baton : m_destroy_callback_and_baton) { +callback_and_baton.first(user_id, callback_and_baton.second); } + m_destroy_callback_and_baton.clear(); } void Debugger::Destroy(DebuggerSP &debugger_sp) { @@ -1427,8 +1428,7 @@ 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 = baton; + m_destroy_callback_and_baton.emplace_back(destroy_callback, baton); } static void PrivateReportProgress(Debugger &debugger, uint64_t progress_id, >From 771b52723be8d0ffecaf8f0818105cfdb82ba332 Mon Sep 17 00:00:00 2001 From: Roy Shi Date: Tue, 23 Apr 2024 21:05:58 -0700 Subject: [PATCH 02/11] Fix code format --- lldb/include/lldb/Core/Debugger.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index 20884f954ec7db..af025219b0bc12 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -732,7 +732,7 @@ class Debugger : public std::enable_shared_from_this, Diagnostics::CallbackID m_diagnostics_callback_id; std::vector> - m_destroy_callback_and_baton; + m_destroy_callback_and_baton; uint32_t m_interrupt_requested = 0; ///< Tracks interrupt requests std::mutex m_interrupt_mutex; >From d1f13cad8a3789a994572459893b32a225ba3e1b Mon Sep 17 00:00:00 2001 From: Roy Shi Date: Wed, 24 Apr 2024 11:55:16 -0700 Subject: [PATCH 03/11] Add `AddDestroyCallback()` and `ClearDestroyCallback()` --- lldb/include/lldb/Core/Debugger.h | 11 +++ lldb/source/Core/Debugger.cpp | 12 +++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index af025219b0bc12..5b3e433f09c68e 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -568,10 +568,21 @@ class Debugger : public std::enable_shared_from_this, static void ReportSymbolChange(const ModuleSpec &module_spec); + /// Add a callback for when the debugger is destroyed. A list is maintained + /// internally. + void + AddDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback, + void *baton); + + /// Clear the list of callbacks, then add the callback. void SetDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback, void *baton); + /// Clear the list of callbacks. + void + ClearDestroyCallback(); + /// Manually start the global event handler thread. It is useful to plugins /// that directly use the \a lldb_private namespace and want to use the /// debugger's default event handler thread instead of defining their own. diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 0ebdf2b0a0f970..159913642f253e 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -1426,11 +1426,21 @@ void Debugger::SetLoggingCallback(lldb::LogOutputCallback log_callback, std::make_shared(log_callback, baton); } -void Debugger::SetDestroyCallback( +void Debugger::AddDestroyCallback( lldb_private::DebuggerDestroyCallback destroy_callbac
[Lldb-commits] [lldb] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` (PR #89868)
@@ -321,8 +321,15 @@ class LLDB_API SBDebugger { void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton); - void SetDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback, - void *baton); + lldb::SBDebuggerDestroyCallbackToken + AddDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback, + void *baton); + + lldb::SBDebuggerDestroyCallbackToken + SetDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback, royitaqi wrote: Yeah. Thanks for catching this. Reverted the API changes (both in SBDebugger and in Debugger). 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] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` (PR #89868)
@@ -321,13 +321,22 @@ class LLDB_API SBDebugger { void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton); + /// DEPRECATED: We used to only support one Destroy callback. Now that we + /// support Add and Remove, you should only remove Destroy callbacks that + /// you Add-ed. Use Add and Remove instead. + /// + /// Clear all previously added callbacks and only add the given one. void SetDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback, bulbazord wrote: There are some macros you can use in addition to the documentation: `LLDB_DEPRECATED_FIXME`. This will give compiler warnings to anyone using `SetDestroyCallback` so they can update their code. 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] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` (PR #89868)
@@ -743,9 +743,19 @@ 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; + std::lock_guard guard(m_destroy_callback_mutex); + const lldb::user_id_t user_id = GetID(); + // In case one destroy callback adds or removes other destroy callbacks + // which aren't taken care of in the same inner loop. + while (m_destroy_callback_and_baton.size()) { +auto iter = m_destroy_callback_and_baton.begin(); +while (iter != m_destroy_callback_and_baton.end()) { + // Invoke the callback and remove the entry from the map + const auto &callback = iter->second.first; + const auto &baton = iter->second.second; + callback(user_id, baton); + iter = m_destroy_callback_and_baton.erase(iter); +} royitaqi wrote: Readability discussion (ignore if you think this particular one is too small a topic): I thought about writing the inner loop as `for (begin; end; ) { callback(); iter = map.erase(); }`. However, I felt it's basically the same as the above. So I just left it as is. LMK if you think the `for` loop will look better. FWIW, if we do use the `for` loop, I didn't like the idea of moving the `iter = map.erase()` part into the 3rd clause of the `for` line. LMK if you think differently 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] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` (PR #89868)
https://github.com/royitaqi edited 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] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` (PR #89868)
https://github.com/royitaqi edited 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] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` (PR #89868)
https://github.com/royitaqi edited 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] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` (PR #89868)
@@ -321,13 +321,22 @@ class LLDB_API SBDebugger { void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton); + /// DEPRECATED: We used to only support one Destroy callback. Now that we + /// support Add and Remove, you should only remove Destroy callbacks that + /// you Add-ed. Use Add and Remove instead. + /// + /// Clear all previously added callbacks and only add the given one. void SetDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback, royitaqi wrote: Thanks for the tip! Will find an example and use it. 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] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` (PR #89868)
https://github.com/royitaqi updated https://github.com/llvm/llvm-project/pull/89868 >From 079a550481d4cdcb69ad01c376b5e1f0632a07d6 Mon Sep 17 00:00:00 2001 From: Roy Shi Date: Tue, 23 Apr 2024 18:10:21 -0700 Subject: [PATCH 01/12] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` --- lldb/include/lldb/Core/Debugger.h | 4 ++-- lldb/source/Core/Debugger.cpp | 10 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index 418c2403d020f4..20884f954ec7db 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -731,8 +731,8 @@ 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 = nullptr; + std::vector> + m_destroy_callback_and_baton; uint32_t m_interrupt_requested = 0; ///< Tracks interrupt requests std::mutex m_interrupt_mutex; diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 19b3cf3bbf46b1..0ebdf2b0a0f970 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -743,10 +743,11 @@ 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; + const lldb::user_id_t user_id = GetID(); + for (const auto &callback_and_baton : m_destroy_callback_and_baton) { +callback_and_baton.first(user_id, callback_and_baton.second); } + m_destroy_callback_and_baton.clear(); } void Debugger::Destroy(DebuggerSP &debugger_sp) { @@ -1427,8 +1428,7 @@ 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 = baton; + m_destroy_callback_and_baton.emplace_back(destroy_callback, baton); } static void PrivateReportProgress(Debugger &debugger, uint64_t progress_id, >From 771b52723be8d0ffecaf8f0818105cfdb82ba332 Mon Sep 17 00:00:00 2001 From: Roy Shi Date: Tue, 23 Apr 2024 21:05:58 -0700 Subject: [PATCH 02/12] Fix code format --- lldb/include/lldb/Core/Debugger.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index 20884f954ec7db..af025219b0bc12 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -732,7 +732,7 @@ class Debugger : public std::enable_shared_from_this, Diagnostics::CallbackID m_diagnostics_callback_id; std::vector> - m_destroy_callback_and_baton; + m_destroy_callback_and_baton; uint32_t m_interrupt_requested = 0; ///< Tracks interrupt requests std::mutex m_interrupt_mutex; >From d1f13cad8a3789a994572459893b32a225ba3e1b Mon Sep 17 00:00:00 2001 From: Roy Shi Date: Wed, 24 Apr 2024 11:55:16 -0700 Subject: [PATCH 03/12] Add `AddDestroyCallback()` and `ClearDestroyCallback()` --- lldb/include/lldb/Core/Debugger.h | 11 +++ lldb/source/Core/Debugger.cpp | 12 +++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index af025219b0bc12..5b3e433f09c68e 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -568,10 +568,21 @@ class Debugger : public std::enable_shared_from_this, static void ReportSymbolChange(const ModuleSpec &module_spec); + /// Add a callback for when the debugger is destroyed. A list is maintained + /// internally. + void + AddDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback, + void *baton); + + /// Clear the list of callbacks, then add the callback. void SetDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback, void *baton); + /// Clear the list of callbacks. + void + ClearDestroyCallback(); + /// Manually start the global event handler thread. It is useful to plugins /// that directly use the \a lldb_private namespace and want to use the /// debugger's default event handler thread instead of defining their own. diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 0ebdf2b0a0f970..159913642f253e 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -1426,11 +1426,21 @@ void Debugger::SetLoggingCallback(lldb::LogOutputCallback log_callback, std::make_shared(log_callback, baton); } -void Debugger::SetDestroyCallback( +void Debugger::AddDestroyCallback( lldb_private::DebuggerDestroyCallback destroy_callbac
[Lldb-commits] [lldb] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` (PR #89868)
@@ -321,13 +321,22 @@ class LLDB_API SBDebugger { void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton); + /// DEPRECATED: We used to only support one Destroy callback. Now that we + /// support Add and Remove, you should only remove Destroy callbacks that + /// you Add-ed. Use Add and Remove instead. + /// + /// Clear all previously added callbacks and only add the given one. void SetDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback, royitaqi wrote: Added. I assume I only need to add it to SBDebugger.h, not Debugger.h. Hope the message/fix I wrote is also good. 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] [PAC][lldb][Dwarf] Support `__ptrauth`-qualified types in user expressions (PR #84387)
https://github.com/kovdan01 updated https://github.com/llvm/llvm-project/pull/84387 >From 728f5644aebfafd2114e7e47a9b83ef057423997 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 20 Feb 2024 10:57:54 -0800 Subject: [PATCH 1/6] Upstream ptrauth changes to DWARFASTParserClang --- .../SymbolFile/DWARF/DWARFASTParserClang.cpp | 57 +++ 1 file changed, 57 insertions(+) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index 54d06b1115a229..67fe830e1aa70d 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -495,6 +495,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, case DW_TAG_const_type: case DW_TAG_restrict_type: case DW_TAG_volatile_type: + case DW_TAG_LLVM_ptrauth_type: case DW_TAG_atomic_type: case DW_TAG_unspecified_type: { type_sp = ParseTypeModifier(sc, die, attrs); @@ -676,6 +677,62 @@ DWARFASTParserClang::ParseTypeModifier(const SymbolContext &sc, case DW_TAG_volatile_type: encoding_data_type = Type::eEncodingIsVolatileUID; break; + case DW_TAG_LLVM_ptrauth_type: { +DWARFDIE ptr_die = die.GetReferencedDIE(DW_AT_type); +// FIXME: Fully resolving the type here may affect performance. +Type *res_type = dwarf->ResolveType(ptr_die); +if (!res_type) + break; +attrs.type.Clear(); +encoding_data_type = Type::eEncodingIsUID; +resolve_state = Type::ResolveState::Full; + +// Apply the ptrauth qualifier to the resolved type. +auto *ptr_type = +(clang::Type *)res_type->GetForwardCompilerType().GetOpaqueQualType(); +auto getAttr = [&](llvm::dwarf::Attribute Attr, unsigned defaultValue = 0) { + return die.GetAttributeValueAsUnsigned(Attr, defaultValue); +}; +const unsigned key = getAttr(DW_AT_LLVM_ptrauth_key); +const bool addr_disc = getAttr(DW_AT_LLVM_ptrauth_address_discriminated); +const unsigned extra = getAttr(DW_AT_LLVM_ptrauth_extra_discriminator); +const bool isapointer = getAttr(DW_AT_LLVM_ptrauth_isa_pointer); +const bool authenticates_null_values = +getAttr(DW_AT_LLVM_ptrauth_authenticates_null_values, 0); +const bool is_restricted_integral = !ptr_type->isPointerType(); +const unsigned authentication_mode_int = getAttr( +DW_AT_LLVM_ptrauth_authentication_mode, +static_cast(clang::PointerAuthenticationMode::SignAndAuth)); +clang::PointerAuthenticationMode authentication_mode = +clang::PointerAuthenticationMode::SignAndAuth; +if (authentication_mode_int >= +static_cast(clang::PointerAuthenticationMode::None) && +authentication_mode_int <= +static_cast( +clang::PointerAuthenticationMode::SignAndAuth)) { + authentication_mode = static_cast( + authentication_mode_int); +} else { + dwarf->GetObjectFile()->GetModule()->ReportError( + "[{0:x16}]: invalid pointer authentication mode method {1:x4}", + die.GetOffset(), authentication_mode_int); +} + +// FIXME: Use these variables when PointerAuthQualifier is more complete +// upstream. +(void)is_restricted_integral; + +clang::Qualifiers qualifiers; +auto ptr_auth = clang::PointerAuthQualifier::Create( +key, addr_disc, extra, authentication_mode, isapointer, +authenticates_null_values); +qualifiers.setPointerAuth(ptr_auth); +auto &ctx = m_ast.getASTContext(); +auto qual_type = ctx.getQualifiedType(ptr_type, qualifiers); +clang_type = +CompilerType(m_ast.weak_from_this(), qual_type.getAsOpaquePtr()); +break; + } case DW_TAG_atomic_type: encoding_data_type = Type::eEncodingIsAtomicUID; break; >From 8aa1ba0b05362b8960faac1945bb25c68ecb4b98 Mon Sep 17 00:00:00 2001 From: Daniil Kovalev Date: Thu, 7 Mar 2024 16:34:09 +0300 Subject: [PATCH 2/6] [PAC][lldb] Use `eEncodingIsLLVMPtrAuthUID` for `__ptrauth`-qualified types --- lldb/include/lldb/Symbol/Type.h | 4 +++- .../Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 2 +- lldb/source/Symbol/Type.cpp | 8 +++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h index acd1a769f13cd6..d55280b58bc4f7 100644 --- a/lldb/include/lldb/Symbol/Type.h +++ b/lldb/include/lldb/Symbol/Type.h @@ -401,7 +401,9 @@ class Type : public std::enable_shared_from_this, public UserID { /// This type is the type whose UID is m_encoding_uid as an atomic type. eEncodingIsAtomicUID, /// This type is the synthetic type whose UID is m_encoding_uid. -eEncodingIsSyntheticUID +eEncodingIsSyntheticUID, +/// This type is a signed pointer. +eEncodingIsLLVMPtrAuthUID }; enum class ResolveState : unsi
[Lldb-commits] [lldb] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` (PR #89868)
royitaqi wrote: Hi @jimingham and @bulbazord , I *think* I have addressed all your comments (thanks for those!). I have also eye-balled through my PR again. But it's possible that I missed something. Will be great to have you taking a look when you have the time. Thanks, Roy 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] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` (PR #89868)
royitaqi wrote: Hi @JDevlieghere , The PR has changed quite a bit. If you have the time, maybe it's a good time to take another look. Below is a TL;DR of some of the changes: * Aadded Add/Remove * Leave Set unchanged (but marked as deprecated) * Added token in Add/Remove * Handle concurrency * Handle Add/Remove invocations from existing destroy callbacks during the destroy event 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 a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)
https://github.com/adrian-prantl updated https://github.com/llvm/llvm-project/pull/89981 >From e561968f8290b0fbe679950e5743f1f60144d716 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Wed, 24 Apr 2024 12:50:43 -0700 Subject: [PATCH] Add a new SBExpressionOptions::SetLanguage() API (NFCI) that separates out language and version. To avoid reinventing the wheel and introducing subtle incompatibilities, this API uses the table of languages and versiond defined by the upcoming DWARF 6 standard (https://dwarfstd.org/languages-v6.html). While the DWARF 6 spec is not finialized, the list of languages is broadly considered stable. The primary motivation for this is to allow the Swift language plugin to switch between language dialects between, e.g., Swift 5.9 and 6.0 with out introducing a ton of new language codes. On the main branch this change is considered NFC. --- lldb/include/lldb/API/SBExpressionOptions.h | 5 ++ lldb/include/lldb/Expression/Expression.h | 7 +- .../lldb/Expression/LLVMUserExpression.h | 2 +- lldb/include/lldb/Expression/UserExpression.h | 33 - lldb/include/lldb/Symbol/TypeSystem.h | 10 ++- lldb/include/lldb/Target/StackFrame.h | 11 ++- lldb/include/lldb/Target/Target.h | 19 -- lldb/include/lldb/lldb-private-types.h| 19 ++ .../Python/lldbsuite/test/configuration.py| 1 + lldb/packages/Python/lldbsuite/test/dotest.py | 3 + .../Python/lldbsuite/test/dotest_args.py | 6 ++ .../Python/lldbsuite/test/lldbtest.py | 19 -- lldb/source/API/CMakeLists.txt| 7 ++ lldb/source/API/SBExpressionOptions.cpp | 7 ++ lldb/source/API/SBFrame.cpp | 30 + lldb/source/Breakpoint/Watchpoint.cpp | 5 +- .../Commands/CommandObjectDWIMPrint.cpp | 2 +- lldb/source/Commands/CommandObjectType.cpp| 2 +- lldb/source/Expression/LLVMUserExpression.cpp | 2 +- lldb/source/Expression/UserExpression.cpp | 14 ++-- lldb/source/Expression/UtilityFunction.cpp| 4 +- .../Clang/ClangExpressionParser.cpp | 12 ++-- .../Clang/ClangUserExpression.cpp | 19 +++--- .../Clang/ClangUserExpression.h | 6 +- .../TypeSystem/Clang/TypeSystemClang.cpp | 2 +- .../TypeSystem/Clang/TypeSystemClang.h| 12 ++-- lldb/source/Target/Language.cpp | 34 ++ lldb/source/Target/StackFrame.cpp | 23 +++ lldb/source/Target/Target.cpp | 21 +++--- lldb/test/API/lit.cfg.py | 3 + lldb/test/API/lit.site.cfg.py.in | 1 + lldb/utils/TableGen/CMakeLists.txt| 1 + lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp| 67 +++ lldb/utils/TableGen/LLDBTableGen.cpp | 9 ++- lldb/utils/TableGen/LLDBTableGenBackends.h| 1 + 35 files changed, 298 insertions(+), 121 deletions(-) create mode 100644 lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp diff --git a/lldb/include/lldb/API/SBExpressionOptions.h b/lldb/include/lldb/API/SBExpressionOptions.h index e0ddfda5ba37a2..19c416d0f3bcbc 100644 --- a/lldb/include/lldb/API/SBExpressionOptions.h +++ b/lldb/include/lldb/API/SBExpressionOptions.h @@ -10,6 +10,7 @@ #define LLDB_API_SBEXPRESSIONOPTIONS_H #include "lldb/API/SBDefines.h" +#include "lldb/API/SBLanguages.h" #include @@ -67,6 +68,10 @@ class LLDB_API SBExpressionOptions { void SetTrapExceptions(bool trap_exceptions = true); void SetLanguage(lldb::LanguageType language); + /// Set the language using a pair of language code and version as + /// defined by the DWARF 6 specification. + /// WARNING: These codes may change until DWARF 6 is finalized. + void SetLanguage(SBSourceLanguageName name, uint32_t version); #ifndef SWIG void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton); diff --git a/lldb/include/lldb/Expression/Expression.h b/lldb/include/lldb/Expression/Expression.h index 3e61d78828bbbf..356fe4b82ae43a 100644 --- a/lldb/include/lldb/Expression/Expression.h +++ b/lldb/include/lldb/Expression/Expression.h @@ -47,11 +47,8 @@ class Expression { /// expression. Text() should contain the definition of this function. virtual const char *FunctionName() = 0; - /// Return the language that should be used when parsing. To use the - /// default, return eLanguageTypeUnknown. - virtual lldb::LanguageType Language() const { -return lldb::eLanguageTypeUnknown; - } + /// Return the language that should be used when parsing. + virtual SourceLanguage Language() const { return {}; } /// Return the Materializer that the parser should use when registering /// external values. diff --git a/lldb/include/lldb/Expression/LLVMUserExpression.h b/lldb/include/lldb/Expression/LLVMUserExpression.h index 7d32d17dbf544c..40b463933c07e8 100644 --- a/lldb/include/lldb/Expression/LLVMUserExpression.h +++ b/lldb/include/lldb/Expression/LLVMUserExpression.h @@ -5
[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)
@@ -0,0 +1,45 @@ +//===- LLDBPropertyDefEmitter.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: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// Produce the list of source languages header file fragment for the SBAPI. +// +//===--===// + +#include +#include +namespace lldb_private { +int EmitSBAPIDWARFEnum(int argc, char **argv) { + std::string InputFilename; + std::string OutputFilename; + std::string DepFilename; + // This command line option parser is as robust as the worst shell script. + for (int i = 0; i < argc; ++i) { +if (llvm::StringRef(argv[i]).ends_with("Dwarf.def")) + InputFilename = std::string(argv[i]); +if (llvm::StringRef(argv[i]) == "-o" && i + 1 < argc) + OutputFilename = std::string(argv[i + 1]); +if (llvm::StringRef(argv[i]) == "-d" && i + 1 < argc) + DepFilename = std::string(argv[i + 1]); + } + std::ifstream input(InputFilename); + std::ofstream output(OutputFilename); + output << "// Do not include this file directly.\n"; + output << "#ifndef HANDLE_DW_LNAME\n"; + output << "#error \"Missing macro definition\"\n"; + output << "#endif\n"; + std::string line; + while (std::getline(input, line)) { +if (llvm::StringRef(line).starts_with("HANDLE_DW_LNAME")) + output << line << '\n'; + } + output << "#undef HANDLE_DW_LNAME\n"; adrian-prantl wrote: @JDevlieghere Can you take another look? Now we're even generating Doxygen comments! https://github.com/llvm/llvm-project/pull/89981 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)
https://github.com/adrian-prantl updated https://github.com/llvm/llvm-project/pull/89981 >From e9b2e98cfe0383b53d2d875f070a63c2ccffe3d3 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Wed, 24 Apr 2024 12:50:43 -0700 Subject: [PATCH] Add a new SBExpressionOptions::SetLanguage() API (NFCI) that separates out language and version. To avoid reinventing the wheel and introducing subtle incompatibilities, this API uses the table of languages and versiond defined by the upcoming DWARF 6 standard (https://dwarfstd.org/languages-v6.html). While the DWARF 6 spec is not finialized, the list of languages is broadly considered stable. The primary motivation for this is to allow the Swift language plugin to switch between language dialects between, e.g., Swift 5.9 and 6.0 with out introducing a ton of new language codes. On the main branch this change is considered NFC. --- lldb/include/lldb/API/SBExpressionOptions.h | 5 ++ lldb/include/lldb/Expression/Expression.h | 7 +- .../lldb/Expression/LLVMUserExpression.h | 2 +- lldb/include/lldb/Expression/UserExpression.h | 33 - lldb/include/lldb/Symbol/TypeSystem.h | 10 ++- lldb/include/lldb/Target/StackFrame.h | 11 ++- lldb/include/lldb/Target/Target.h | 19 -- lldb/include/lldb/lldb-private-types.h| 19 ++ .../Python/lldbsuite/test/configuration.py| 1 + lldb/packages/Python/lldbsuite/test/dotest.py | 3 + .../Python/lldbsuite/test/dotest_args.py | 6 ++ .../Python/lldbsuite/test/lldbtest.py | 19 -- lldb/source/API/CMakeLists.txt| 7 ++ lldb/source/API/SBExpressionOptions.cpp | 7 ++ lldb/source/API/SBFrame.cpp | 30 + lldb/source/Breakpoint/Watchpoint.cpp | 5 +- .../Commands/CommandObjectDWIMPrint.cpp | 2 +- lldb/source/Commands/CommandObjectType.cpp| 2 +- lldb/source/Expression/LLVMUserExpression.cpp | 2 +- lldb/source/Expression/UserExpression.cpp | 14 ++-- lldb/source/Expression/UtilityFunction.cpp| 4 +- .../Clang/ClangExpressionParser.cpp | 12 ++-- .../Clang/ClangUserExpression.cpp | 19 +++--- .../Clang/ClangUserExpression.h | 6 +- .../TypeSystem/Clang/TypeSystemClang.cpp | 2 +- .../TypeSystem/Clang/TypeSystemClang.h| 12 ++-- lldb/source/Target/Language.cpp | 34 ++ lldb/source/Target/StackFrame.cpp | 23 +++ lldb/source/Target/Target.cpp | 21 +++--- lldb/test/API/lit.cfg.py | 3 + lldb/test/API/lit.site.cfg.py.in | 1 + lldb/utils/TableGen/CMakeLists.txt| 1 + lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp| 67 +++ lldb/utils/TableGen/LLDBTableGen.cpp | 9 ++- lldb/utils/TableGen/LLDBTableGenBackends.h| 1 + 35 files changed, 298 insertions(+), 121 deletions(-) create mode 100644 lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp diff --git a/lldb/include/lldb/API/SBExpressionOptions.h b/lldb/include/lldb/API/SBExpressionOptions.h index e0ddfda5ba37a2..19c416d0f3bcbc 100644 --- a/lldb/include/lldb/API/SBExpressionOptions.h +++ b/lldb/include/lldb/API/SBExpressionOptions.h @@ -10,6 +10,7 @@ #define LLDB_API_SBEXPRESSIONOPTIONS_H #include "lldb/API/SBDefines.h" +#include "lldb/API/SBLanguages.h" #include @@ -67,6 +68,10 @@ class LLDB_API SBExpressionOptions { void SetTrapExceptions(bool trap_exceptions = true); void SetLanguage(lldb::LanguageType language); + /// Set the language using a pair of language code and version as + /// defined by the DWARF 6 specification. + /// WARNING: These codes may change until DWARF 6 is finalized. + void SetLanguage(SBSourceLanguageName name, uint32_t version); #ifndef SWIG void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton); diff --git a/lldb/include/lldb/Expression/Expression.h b/lldb/include/lldb/Expression/Expression.h index 3e61d78828bbbf..356fe4b82ae43a 100644 --- a/lldb/include/lldb/Expression/Expression.h +++ b/lldb/include/lldb/Expression/Expression.h @@ -47,11 +47,8 @@ class Expression { /// expression. Text() should contain the definition of this function. virtual const char *FunctionName() = 0; - /// Return the language that should be used when parsing. To use the - /// default, return eLanguageTypeUnknown. - virtual lldb::LanguageType Language() const { -return lldb::eLanguageTypeUnknown; - } + /// Return the language that should be used when parsing. + virtual SourceLanguage Language() const { return {}; } /// Return the Materializer that the parser should use when registering /// external values. diff --git a/lldb/include/lldb/Expression/LLVMUserExpression.h b/lldb/include/lldb/Expression/LLVMUserExpression.h index 7d32d17dbf544c..40b463933c07e8 100644 --- a/lldb/include/lldb/Expression/LLVMUserExpression.h +++ b/lldb/include/lldb/Expression/LLVMUserExpression.h @@ -5
[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)
@@ -239,6 +239,9 @@ def delete_module_cache(path): if is_configured("server"): dotest_cmd += ["--server", config.server] +if is_configured("lldb_built_include_dir"): +dotest_cmd += ["--lldb-built-include-dir", config.lldb_built_include_dir] JDevlieghere wrote: If you do: ``` is_configured("config.lldb_obj_root"): dotest_cmd += ["--lldb-built-include-dir", os.path.join(config.lldb_obj_root, 'include')] ``` you can get rid of `config.lldb_built_include_dir`. https://github.com/llvm/llvm-project/pull/89981 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Consult Language plugin in GetDisplayDemangledName (PR #90294)
https://github.com/kastiglione created https://github.com/llvm/llvm-project/pull/90294 None >From a5e72126d3b0144e5fc0f5b04925f4bf394551e4 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Fri, 26 Apr 2024 16:14:09 -0700 Subject: [PATCH] [lldb] Consult Language plugin in GetDisplayDemangledName --- lldb/include/lldb/Target/Language.h | 4 lldb/source/Core/Mangled.cpp| 2 ++ 2 files changed, 6 insertions(+) diff --git a/lldb/include/lldb/Target/Language.h b/lldb/include/lldb/Target/Language.h index 67714e6fdf942e..ff7c60bf68bfc9 100644 --- a/lldb/include/lldb/Target/Language.h +++ b/lldb/include/lldb/Target/Language.h @@ -281,6 +281,10 @@ class Language : public PluginInterface { return mangled.GetMangledName(); } + virtual ConstString GetDisplayDemangledName(Mangled mangled) const { +return mangled.GetDemangledName(); + } + virtual void GetExceptionResolverDescription(bool catch_on, bool throw_on, Stream &s); diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp index b167c51fdce247..8efc4c639cca5f 100644 --- a/lldb/source/Core/Mangled.cpp +++ b/lldb/source/Core/Mangled.cpp @@ -310,6 +310,8 @@ ConstString Mangled::GetDemangledName() const { } ConstString Mangled::GetDisplayDemangledName() const { + if (Language *lang = Language::FindPlugin(GuessLanguage())) +return lang->GetDisplayDemangledName(*this); return GetDemangledName(); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Consult Language plugin in GetDisplayDemangledName (PR #90294)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Dave Lee (kastiglione) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/90294.diff 2 Files Affected: - (modified) lldb/include/lldb/Target/Language.h (+4) - (modified) lldb/source/Core/Mangled.cpp (+2) ``diff diff --git a/lldb/include/lldb/Target/Language.h b/lldb/include/lldb/Target/Language.h index 67714e6fdf942e..ff7c60bf68bfc9 100644 --- a/lldb/include/lldb/Target/Language.h +++ b/lldb/include/lldb/Target/Language.h @@ -281,6 +281,10 @@ class Language : public PluginInterface { return mangled.GetMangledName(); } + virtual ConstString GetDisplayDemangledName(Mangled mangled) const { +return mangled.GetDemangledName(); + } + virtual void GetExceptionResolverDescription(bool catch_on, bool throw_on, Stream &s); diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp index b167c51fdce247..8efc4c639cca5f 100644 --- a/lldb/source/Core/Mangled.cpp +++ b/lldb/source/Core/Mangled.cpp @@ -310,6 +310,8 @@ ConstString Mangled::GetDemangledName() const { } ConstString Mangled::GetDisplayDemangledName() const { + if (Language *lang = Language::FindPlugin(GuessLanguage())) +return lang->GetDisplayDemangledName(*this); return GetDemangledName(); } `` https://github.com/llvm/llvm-project/pull/90294 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Consult Language plugin in GetDisplayDemangledName (PR #90294)
https://github.com/kastiglione edited https://github.com/llvm/llvm-project/pull/90294 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Display breakpoint locations using display name (PR #90297)
https://github.com/kastiglione created https://github.com/llvm/llvm-project/pull/90297 Adds a `show_function_display_name` parameter to `SymbolContext::DumpStopContext`. This parameter defaults to true, but `BreakpointLocation::GetDescription` sets it to true. >From 03e91b20df97103aed15e6640a7063459f0b9ae6 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Fri, 26 Apr 2024 16:14:09 -0700 Subject: [PATCH] [lldb] Display breakpoint locations using display name Adds a `show_function_display_name` parameter to `SymbolContext::DumpStopContext`. This parameter defaults to true, but `BreakpointLocation::GetDescription` sets it to true. --- lldb/include/lldb/Symbol/SymbolContext.h | 1 + lldb/include/lldb/Target/Language.h | 4 lldb/source/Breakpoint/BreakpointLocation.cpp | 2 +- lldb/source/Core/Address.cpp | 5 +++-- lldb/source/Core/Mangled.cpp | 2 ++ lldb/source/Symbol/SymbolContext.cpp | 13 +++-- 6 files changed, 22 insertions(+), 5 deletions(-) diff --git a/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h index bd33a71b46cac0..0bc707070f8504 100644 --- a/lldb/include/lldb/Symbol/SymbolContext.h +++ b/lldb/include/lldb/Symbol/SymbolContext.h @@ -158,6 +158,7 @@ class SymbolContext { Stream *s, ExecutionContextScope *exe_scope, const Address &so_addr, bool show_fullpaths, bool show_module, bool show_inlined_frames, bool show_function_arguments, bool show_function_name, + bool show_function_display_name = false, std::optional settings = std::nullopt) const; /// Get the address range contained within a symbol context. diff --git a/lldb/include/lldb/Target/Language.h b/lldb/include/lldb/Target/Language.h index 67714e6fdf942e..ff7c60bf68bfc9 100644 --- a/lldb/include/lldb/Target/Language.h +++ b/lldb/include/lldb/Target/Language.h @@ -281,6 +281,10 @@ class Language : public PluginInterface { return mangled.GetMangledName(); } + virtual ConstString GetDisplayDemangledName(Mangled mangled) const { +return mangled.GetDemangledName(); + } + virtual void GetExceptionResolverDescription(bool catch_on, bool throw_on, Stream &s); diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp index b48ec1398d63e8..41911fad41c648 100644 --- a/lldb/source/Breakpoint/BreakpointLocation.cpp +++ b/lldb/source/Breakpoint/BreakpointLocation.cpp @@ -507,7 +507,7 @@ void BreakpointLocation::GetDescription(Stream *s, else s->PutCString("where = "); sc.DumpStopContext(s, m_owner.GetTarget().GetProcessSP().get(), m_address, - false, true, false, true, true); + false, true, false, true, true, true); } else { if (sc.module_sp) { s->EOL(); diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp index b23398883fa553..5a4751bd5256eb 100644 --- a/lldb/source/Core/Address.cpp +++ b/lldb/source/Core/Address.cpp @@ -645,7 +645,8 @@ bool Address::Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, pointer_sc.symbol != nullptr) { s->PutCString(": "); pointer_sc.DumpStopContext(s, exe_scope, so_addr, true, false, - false, true, true, settings); + false, true, true, false, + settings); } } } @@ -685,7 +686,7 @@ bool Address::Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, sc.DumpStopContext(s, exe_scope, *this, show_fullpaths, show_module, show_inlined_frames, show_function_arguments, show_function_name, - settings); + false, settings); } else { // We found a symbol but it was in a different section so it // isn't the symbol we should be showing, just show the section diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp index b167c51fdce247..8efc4c639cca5f 100644 --- a/lldb/source/Core/Mangled.cpp +++ b/lldb/source/Core/Mangled.cpp @@ -310,6 +310,8 @@ ConstString Mangled::GetDemangledName() const { } ConstString Mangled::GetDisplayDemangledName() const { + if (Language *lang = Language::FindPlugin(GuessLanguage())) +return lang->GetDisplayDemangledName(*this); return GetDemangledName(); } diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp index f368896fbad490..8f26e41d192044 100644 --- a/lldb/source/Symbol/SymbolContext.cpp +++ b/lldb/source/Symbol/SymbolContext.cpp @@ -73,6 +73,7 @@ bool SymbolContext::DumpStopContext( Stream *s, Execu
[Lldb-commits] [lldb] [lldb] Display breakpoint locations using display name (PR #90297)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Dave Lee (kastiglione) Changes Adds a `show_function_display_name` parameter to `SymbolContext::DumpStopContext`. This parameter defaults to true, but `BreakpointLocation::GetDescription` sets it to true. --- Full diff: https://github.com/llvm/llvm-project/pull/90297.diff 6 Files Affected: - (modified) lldb/include/lldb/Symbol/SymbolContext.h (+1) - (modified) lldb/include/lldb/Target/Language.h (+4) - (modified) lldb/source/Breakpoint/BreakpointLocation.cpp (+1-1) - (modified) lldb/source/Core/Address.cpp (+3-2) - (modified) lldb/source/Core/Mangled.cpp (+2) - (modified) lldb/source/Symbol/SymbolContext.cpp (+11-2) ``diff diff --git a/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h index bd33a71b46cac0..0bc707070f8504 100644 --- a/lldb/include/lldb/Symbol/SymbolContext.h +++ b/lldb/include/lldb/Symbol/SymbolContext.h @@ -158,6 +158,7 @@ class SymbolContext { Stream *s, ExecutionContextScope *exe_scope, const Address &so_addr, bool show_fullpaths, bool show_module, bool show_inlined_frames, bool show_function_arguments, bool show_function_name, + bool show_function_display_name = false, std::optional settings = std::nullopt) const; /// Get the address range contained within a symbol context. diff --git a/lldb/include/lldb/Target/Language.h b/lldb/include/lldb/Target/Language.h index 67714e6fdf942e..ff7c60bf68bfc9 100644 --- a/lldb/include/lldb/Target/Language.h +++ b/lldb/include/lldb/Target/Language.h @@ -281,6 +281,10 @@ class Language : public PluginInterface { return mangled.GetMangledName(); } + virtual ConstString GetDisplayDemangledName(Mangled mangled) const { +return mangled.GetDemangledName(); + } + virtual void GetExceptionResolverDescription(bool catch_on, bool throw_on, Stream &s); diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp index b48ec1398d63e8..41911fad41c648 100644 --- a/lldb/source/Breakpoint/BreakpointLocation.cpp +++ b/lldb/source/Breakpoint/BreakpointLocation.cpp @@ -507,7 +507,7 @@ void BreakpointLocation::GetDescription(Stream *s, else s->PutCString("where = "); sc.DumpStopContext(s, m_owner.GetTarget().GetProcessSP().get(), m_address, - false, true, false, true, true); + false, true, false, true, true, true); } else { if (sc.module_sp) { s->EOL(); diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp index b23398883fa553..5a4751bd5256eb 100644 --- a/lldb/source/Core/Address.cpp +++ b/lldb/source/Core/Address.cpp @@ -645,7 +645,8 @@ bool Address::Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, pointer_sc.symbol != nullptr) { s->PutCString(": "); pointer_sc.DumpStopContext(s, exe_scope, so_addr, true, false, - false, true, true, settings); + false, true, true, false, + settings); } } } @@ -685,7 +686,7 @@ bool Address::Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, sc.DumpStopContext(s, exe_scope, *this, show_fullpaths, show_module, show_inlined_frames, show_function_arguments, show_function_name, - settings); + false, settings); } else { // We found a symbol but it was in a different section so it // isn't the symbol we should be showing, just show the section diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp index b167c51fdce247..8efc4c639cca5f 100644 --- a/lldb/source/Core/Mangled.cpp +++ b/lldb/source/Core/Mangled.cpp @@ -310,6 +310,8 @@ ConstString Mangled::GetDemangledName() const { } ConstString Mangled::GetDisplayDemangledName() const { + if (Language *lang = Language::FindPlugin(GuessLanguage())) +return lang->GetDisplayDemangledName(*this); return GetDemangledName(); } diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp index f368896fbad490..8f26e41d192044 100644 --- a/lldb/source/Symbol/SymbolContext.cpp +++ b/lldb/source/Symbol/SymbolContext.cpp @@ -73,6 +73,7 @@ bool SymbolContext::DumpStopContext( Stream *s, ExecutionContextScope *exe_scope, const Address &addr, bool show_fullpaths, bool show_module, bool show_inlined_frames, bool show_function_arguments, bool show_function_name, +bool show_function_display_name, std::optional settings) const { bool dumped_something = false; if (show_module && module_sp) { @@ -93,6
[Lldb-commits] [lldb] [lldb] Display breakpoint locations using display name (PR #90297)
kastiglione wrote: At the time of creation, this PR includes the changes in https://github.com/llvm/llvm-project/pull/90294. https://github.com/llvm/llvm-project/pull/90297 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Display breakpoint locations using display name (PR #90297)
https://github.com/kastiglione edited https://github.com/llvm/llvm-project/pull/90297 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Consult Language plugin in GetDisplayDemangledName (PR #90294)
https://github.com/medismailben approved this pull request. https://github.com/llvm/llvm-project/pull/90294 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Display breakpoint locations using display name (PR #90297)
https://github.com/jimingham approved this pull request. LGTM - at some point we're going to have to make a SymbolContextDisplayOptions class to gather up all those "show_" bools; DumpStopContext is starting to look like a Fortran function. But you only added one... https://github.com/llvm/llvm-project/pull/90297 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Display breakpoint locations using display name (PR #90297)
https://github.com/medismailben approved this pull request. Nice! LGTM! https://github.com/llvm/llvm-project/pull/90297 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Display breakpoint locations using display name (PR #90297)
jimingham wrote: This is just a suggestion, but would it make sense to interpret "GetDisplayName" to mean "get the name the user wants me to display", which is usually the language's display name (if it has one) but if there's no language display name or the caller has set the "get the full name" setting return GetName. The advantage of that interpretation is that anywhere you wanted to show the user a demangled name, you could JUST call GetDisplayName, rather than having to do "if (GetDisplayName) else GetName" in client code. https://github.com/llvm/llvm-project/pull/90297 ___ 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)
https://github.com/royitaqi edited 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