[Lldb-commits] [lldb] [lldb] Consistently use "null-terminated" across LLDB (NFC) (PR #224801)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Sat Sep 19 15:53:21 PDT 2026
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/224801
>From bb10832969728d1ff0e1ac20665582342abdc770 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Fri, 18 Sep 2026 21:37:18 -0700
Subject: [PATCH 1/2] [lldb] Consistently use "null-terminated" across LLDB
(NFC)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
It appears that both spellings are correct, but "null terminator" is far
more common, while "NUL terminator" is technically precise regarding the
ASCII character name. Most common in LLDB was "NULL terminated" which is
the worst of both worlds. This rallies around "null-terminated".
- Adjective → null-terminated
- Verb → null-terminate
- Nouns left unhyphenated but lowercased: null terminator, null termination
---
lldb/bindings/interface/SBProcessDocstrings.i | 2 +-
lldb/bindings/interface/SBProcessExtensions.i | 2 +-
lldb/examples/darwin/heap_find/heap.py | 2 +-
.../examples/darwin/heap_find/heap/heap_find.cpp | 2 +-
lldb/examples/python/file_extract.py | 2 +-
lldb/examples/synthetic/libcxx.py | 2 +-
lldb/include/lldb/API/SBError.h | 2 +-
.../lldb/Host/common/NativeProcessProtocol.h | 2 +-
lldb/include/lldb/Target/Process.h | 4 ++--
lldb/include/lldb/Target/Target.h | 2 +-
lldb/include/lldb/Utility/Args.h | 10 +++++-----
lldb/include/lldb/Utility/Broadcaster.h | 2 +-
lldb/include/lldb/Utility/ConstString.h | 16 ++++++++--------
lldb/include/lldb/Utility/DataEncoder.h | 6 +++---
lldb/include/lldb/Utility/DataExtractor.h | 12 ++++++------
lldb/include/lldb/Utility/FileSpec.h | 2 +-
lldb/include/lldb/Utility/RegularExpression.h | 2 +-
lldb/include/lldb/Utility/State.h | 2 +-
lldb/include/lldb/Utility/Status.h | 4 ++--
lldb/include/lldb/Utility/Stream.h | 8 ++++----
lldb/include/lldb/Utility/StreamBuffer.h | 2 +-
lldb/include/lldb/lldb-enumerations.h | 2 +-
lldb/source/Commands/CommandObjectMemory.cpp | 2 +-
lldb/source/Core/Address.cpp | 2 +-
lldb/source/Core/FormatEntity.cpp | 2 +-
lldb/source/Core/Mangled.cpp | 2 +-
lldb/source/DataFormatters/StringPrinter.cpp | 2 +-
.../source/Host/common/NativeProcessProtocol.cpp | 2 +-
lldb/source/Host/windows/Host.cpp | 2 +-
lldb/source/Interpreter/OptionGroupFormat.cpp | 2 +-
.../MacOSX-DYLD/DynamicLoaderDarwin.h | 2 +-
.../Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 6 +++---
.../Plugins/ObjectFile/JSON/ObjectFileJSON.cpp | 2 +-
.../ObjectFile/Mach-O/ObjectFileMachO.cpp | 8 ++++----
.../Plugins/Platform/POSIX/PlatformPOSIX.cpp | 4 ++--
.../Plugins/Process/elf-core/RegisterUtilities.h | 2 +-
.../gdb-remote/GDBRemoteCommunicationClient.h | 2 +-
.../SymbolFile/DWARF/DWARFDebugInfoEntry.h | 2 +-
.../Plugins/SymbolFile/DWARF/DWARFFormValue.cpp | 2 +-
.../Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 2 +-
lldb/source/Utility/Args.cpp | 4 ++--
lldb/source/Utility/DataExtractor.cpp | 8 ++++----
lldb/source/Utility/Stream.cpp | 10 +++++-----
lldb/source/ValueObject/ValueObject.cpp | 2 +-
.../API/commands/memory/read/TestMemoryRead.py | 2 +-
.../generic/string/TestDataFormatterStdString.py | 2 +-
.../json/object-file/TestObjectFileJSON.py | 2 +-
.../lc-note/additional-registers/add-lcnote.cpp | 2 +-
lldb/test/API/tools/lldb-server/main.cpp | 2 +-
lldb/tools/debugserver/source/DNB.cpp | 2 +-
.../debugserver/source/MacOSX/MachProcess.mm | 2 +-
lldb/tools/debugserver/source/PseudoTerminal.cpp | 2 +-
lldb/tools/debugserver/source/RNBServices.cpp | 2 +-
lldb/tools/debugserver/source/debugserver.cpp | 4 ++--
lldb/tools/lldb-dap/SourceBreakpoint.cpp | 2 +-
lldb/unittests/Utility/DataEncoderTest.cpp | 6 +++---
lldb/unittests/Utility/DataExtractorTest.cpp | 2 +-
57 files changed, 97 insertions(+), 97 deletions(-)
diff --git a/lldb/bindings/interface/SBProcessDocstrings.i b/lldb/bindings/interface/SBProcessDocstrings.i
index 2438a6bfc124c3..9e3ffccd3f2293 100644
--- a/lldb/bindings/interface/SBProcessDocstrings.i
+++ b/lldb/bindings/interface/SBProcessDocstrings.i
@@ -117,7 +117,7 @@ SBProcess supports thread iteration. For example (from test/lldbutil.py), ::
) lldb::SBProcess::WriteMemory;
%feature("docstring", "
- Reads a NUL terminated C string from the current process's address space.
+ Reads a null-terminated C string from the current process's address space.
It returns a python string of the exact length, or truncates the string if
the maximum character limit is reached. Example: ::
diff --git a/lldb/bindings/interface/SBProcessExtensions.i b/lldb/bindings/interface/SBProcessExtensions.i
index 64e1e9a4a4146a..46effc81ce30d1 100644
--- a/lldb/bindings/interface/SBProcessExtensions.i
+++ b/lldb/bindings/interface/SBProcessExtensions.i
@@ -5,7 +5,7 @@ STRING_EXTENSION_OUTSIDE(SBProcess)
def WriteMemoryAsCString(self, addr, str, error):
'''
WriteMemoryAsCString(self, addr, str, error):
- This functions the same as `WriteMemory` except a null-terminator is appended
+ This functions the same as `WriteMemory` except a null terminator is appended
to the end of the buffer if it is not there already.
'''
if not str or len(str) == 0:
diff --git a/lldb/examples/darwin/heap_find/heap.py b/lldb/examples/darwin/heap_find/heap.py
index 6cca61636df5ec..0838f68382139d 100644
--- a/lldb/examples/darwin/heap_find/heap.py
+++ b/lldb/examples/darwin/heap_find/heap.py
@@ -1208,7 +1208,7 @@ def malloc_info_impl(exe_ctx, result, options, args):
typedef struct callback_baton_t {
range_callback_t callback;
unsigned num_matches;
- $malloc_match matches[2]; // Two items so they can be NULL terminated
+ $malloc_match matches[2]; // Two items so they can be null-terminated
void *ptr;
} callback_baton_t;
range_callback_t range_callback = [](task_t task, void *baton, unsigned type, uintptr_t ptr_addr, uintptr_t ptr_size) -> void {
diff --git a/lldb/examples/darwin/heap_find/heap/heap_find.cpp b/lldb/examples/darwin/heap_find/heap/heap_find.cpp
index b7122156041dfd..38fa14daaa1a8f 100644
--- a/lldb/examples/darwin/heap_find/heap/heap_find.cpp
+++ b/lldb/examples/darwin/heap_find/heap/heap_find.cpp
@@ -22,7 +22,7 @@
//
// This will grep everything in all active allocation blocks and print and
// malloc blocks that contain the C string "hello" (as a substring, no
-// NULL termination included):
+// null termination included):
//
// (lldb) expression find_cstring_in_heap ("hello")
//
diff --git a/lldb/examples/python/file_extract.py b/lldb/examples/python/file_extract.py
index 4862ddec2d9855..621c17a634adbb 100755
--- a/lldb/examples/python/file_extract.py
+++ b/lldb/examples/python/file_extract.py
@@ -151,7 +151,7 @@ def get_fixed_length_c_string(
return fail_value
def get_c_string(self):
- """Extract a single NULL terminated C string from the binary file at the current file position, returns a single C string"""
+ """Extract a single null-terminated C string from the binary file at the current file position, returns a single C string"""
cstr = ""
byte = self.get_uint8()
while byte != 0:
diff --git a/lldb/examples/synthetic/libcxx.py b/lldb/examples/synthetic/libcxx.py
index 549255e280c1dd..e99e69f25fa639 100644
--- a/lldb/examples/synthetic/libcxx.py
+++ b/lldb/examples/synthetic/libcxx.py
@@ -61,7 +61,7 @@ def stdstring_SummaryProvider(valobj, dict):
else:
data_ptr = l.GetChildAtIndex(2)
size_vo = l.GetChildAtIndex(1)
- # the NULL terminator must be accounted for
+ # the null terminator must be accounted for
size = size_vo.GetValueAsUnsigned(0) + 1
if size <= 1 or size is None: # should never be the case
return '""'
diff --git a/lldb/include/lldb/API/SBError.h b/lldb/include/lldb/API/SBError.h
index 5f2717120006a6..7363842b67771f 100644
--- a/lldb/include/lldb/API/SBError.h
+++ b/lldb/include/lldb/API/SBError.h
@@ -32,7 +32,7 @@ class LLDB_API SBError {
const SBError &operator=(const lldb::SBError &rhs);
- /// Get the error string as a NULL terminated UTF8 c-string.
+ /// Get the error string as a null-terminated UTF8 c-string.
///
/// This SBError object owns the returned string and this object must be kept
/// around long enough to use the returned string.
diff --git a/lldb/include/lldb/Host/common/NativeProcessProtocol.h b/lldb/include/lldb/Host/common/NativeProcessProtocol.h
index 58c91bcd84a3b0..209cb068aba215 100644
--- a/lldb/include/lldb/Host/common/NativeProcessProtocol.h
+++ b/lldb/include/lldb/Host/common/NativeProcessProtocol.h
@@ -114,7 +114,7 @@ class NativeProcessProtocol {
virtual Status WriteMemoryTags(int32_t type, lldb::addr_t addr, size_t len,
const std::vector<uint8_t> &tags);
- /// Reads a null terminated string from memory.
+ /// Reads a null-terminated string from memory.
///
/// Reads up to \p max_size bytes of memory until it finds a '\0'.
/// If a '\0' is not found then it reads max_size-1 bytes as a string and a
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index c530204e770441..e7d832da8d2402 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -1690,12 +1690,12 @@ class Process : public std::enable_shared_from_this<Process>,
size_t ReadMemoryFromInferior(lldb::addr_t vm_addr, void *buf, size_t size,
Status &error);
- /// Read a NULL terminated C string from memory
+ /// Read a null-terminated C string from memory
///
/// This function will read a cache page at a time until the NULL
/// C string terminator is found. It will stop reading if the NULL
/// termination byte isn't found before reading \a cstr_max_len bytes, and
- /// the results are always guaranteed to be NULL terminated (at most
+ /// the results are always guaranteed to be null-terminated (at most
/// cstr_max_len - 1 bytes will be read).
size_t ReadCStringFromMemory(lldb::addr_t vm_addr, char *cstr,
size_t cstr_max_len, Status &error);
diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h
index 0b4290ad4a33d5..7df591e028f192 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -1381,7 +1381,7 @@ class Target : public std::enable_shared_from_this<Target>,
size_t dst_max_len, Status &result_error,
bool force_live_memory = false);
- /// Read a NULL terminated string from memory
+ /// Read a null-terminated string from memory
///
/// This function will read a cache page at a time until a NULL string
/// terminator is found. It will stop reading if an aligned sequence of NULL
diff --git a/lldb/include/lldb/Utility/Args.h b/lldb/include/lldb/Utility/Args.h
index 094bb290691198..0337bade381309 100644
--- a/lldb/include/lldb/Utility/Args.h
+++ b/lldb/include/lldb/Utility/Args.h
@@ -60,7 +60,7 @@ class Args {
/// Construct with an option command string.
///
/// \param[in] command
- /// A NULL terminated command that will be copied and split up
+ /// A null-terminated command that will be copied and split up
/// into arguments.
///
/// \see Args::SetCommandString(llvm::StringRef)
@@ -121,11 +121,11 @@ class Args {
bool empty() const { return GetArgumentCount() == 0; }
- /// Gets the NULL terminated C string argument pointer for the argument at
+ /// Gets the null-terminated C string argument pointer for the argument at
/// index \a idx.
///
/// \return
- /// The NULL terminated C string argument pointer if \a idx is a
+ /// The null-terminated C string argument pointer if \a idx is a
/// valid argument index, NULL otherwise.
const char *GetArgumentAtIndex(size_t idx) const;
@@ -149,7 +149,7 @@ class Args {
/// \endcode
///
/// \return
- /// An array of NULL terminated C string argument pointers that
+ /// An array of null-terminated C string argument pointers that
/// also has a terminating NULL C string pointer
char **GetArgumentVector();
@@ -163,7 +163,7 @@ class Args {
/// \endcode
///
/// \return
- /// An array of NULL terminate C string argument pointers that
+ /// An array of null-terminated C string argument pointers that
/// also has a terminating NULL C string pointer
const char **GetConstArgumentVector() const;
diff --git a/lldb/include/lldb/Utility/Broadcaster.h b/lldb/include/lldb/Utility/Broadcaster.h
index 95fbb403f466e8..1c4fa56af78494 100644
--- a/lldb/include/lldb/Utility/Broadcaster.h
+++ b/lldb/include/lldb/Utility/Broadcaster.h
@@ -228,7 +228,7 @@ class Broadcaster {
/// A bit mask that indicates which events to get names for.
///
/// \return
- /// The NULL terminated C string name of this Broadcaster.
+ /// The null-terminated C string name of this Broadcaster.
bool GetEventNames(Stream &s, const uint32_t event_mask,
bool prefix_with_broadcaster_name) const {
return m_broadcaster_sp->GetEventNames(s, event_mask,
diff --git a/lldb/include/lldb/Utility/ConstString.h b/lldb/include/lldb/Utility/ConstString.h
index 1bfefec9638a54..f5a9da52a5483c 100644
--- a/lldb/include/lldb/Utility/ConstString.h
+++ b/lldb/include/lldb/Utility/ConstString.h
@@ -53,7 +53,7 @@ class ConstString {
/// exist, it is added to the string pool.
///
/// \param[in] cstr
- /// A NULL terminated C string to add to the string pool.
+ /// A null-terminated C string to add to the string pool.
explicit ConstString(const char *cstr);
/// Construct with C String value with max length
@@ -61,11 +61,11 @@ class ConstString {
/// Constructs this object with a C string with a length. If \a max_cstr_len
/// is greater than the actual length of the string, the string length will
/// be truncated. This allows substrings to be created without the need to
- /// NULL terminate the string as it is passed into this function.
+ /// null-terminate the string as it is passed into this function.
///
/// \param[in] cstr
/// A pointer to the first character in the C string. The C
- /// string can be NULL terminated in a buffer that contains
+ /// string can be null-terminated in a buffer that contains
/// more characters than the length of the string, or the
/// string can be part of another string and a new substring
/// can be created.
@@ -200,7 +200,7 @@ class ConstString {
/// Get the string value as a C string.
///
- /// Get the value of the contained string as a NULL terminated C string
+ /// Get the value of the contained string as a null-terminated C string
/// value. Similar to the ConstString::AsCString() function, yet this
/// function will always return nullptr if the string is not valid. So this
/// function is a direct accessor to the string pointer value.
@@ -217,7 +217,7 @@ class ConstString {
///
/// \return
/// Returns the number of bytes that this string occupies in
- /// memory, not including the NULL termination byte.
+ /// memory, not including the null termination byte.
size_t GetLength() const;
/// Clear this object's state.
@@ -315,7 +315,7 @@ class ConstString {
/// added to the string pool.
///
/// \param[in] cstr
- /// A NULL terminated C string to add to the string pool.
+ /// A null-terminated C string to add to the string pool.
void SetCString(const char *cstr);
void SetString(llvm::StringRef s);
@@ -369,7 +369,7 @@ class ConstString {
/// added to the string pool.
///
/// \param[in] cstr
- /// A NULL terminated C string to add to the string pool.
+ /// A null-terminated C string to add to the string pool.
///
/// \param[in] cstr_len
/// The maximum length of the C string.
@@ -378,7 +378,7 @@ class ConstString {
/// Set the C string value with the minimum length between \a fixed_cstr_len
/// and the actual length of the C string. This can be used for data
/// structures that have a fixed length to store a C string where the string
- /// might not be NULL terminated if the string takes the entire buffer.
+ /// might not be null-terminated if the string takes the entire buffer.
void SetTrimmedCStringWithLength(const char *cstr, size_t fixed_cstr_len);
/// Get the memory cost of this object.
diff --git a/lldb/include/lldb/Utility/DataEncoder.h b/lldb/include/lldb/Utility/DataEncoder.h
index fe5502c781bdcb..0f0a2dc378d5a1 100644
--- a/lldb/include/lldb/Utility/DataEncoder.h
+++ b/lldb/include/lldb/Utility/DataEncoder.h
@@ -149,7 +149,7 @@ class DataEncoder {
/// Append bytes to the end of the owned data.
///
/// Append the bytes contained in the string reference. This function will
- /// not append a NULL termination character for a C string. Use the
+ /// not append a null termination character for a C string. Use the
/// AppendCString function for this purpose.
///
/// \param data
@@ -167,7 +167,7 @@ class DataEncoder {
/// Append a C string to the end of the owned data.
///
/// Append the bytes contained in the string reference along with an extra
- /// NULL termination character if the StringRef bytes doesn't include one as
+ /// null termination character if the StringRef bytes doesn't include one as
/// the last byte.
///
/// \param data
@@ -214,7 +214,7 @@ class DataEncoder {
///
/// Encodes a C string into the existing data including the terminating. If
/// there is not enough room in the buffer to fit the entire C string and the
- /// NULL terminator in the existing buffer bounds, then this function will
+ /// null terminator in the existing buffer bounds, then this function will
/// fail.
///
/// \param[in] offset
diff --git a/lldb/include/lldb/Utility/DataExtractor.h b/lldb/include/lldb/Utility/DataExtractor.h
index b71d301692d5bb..6fd317b7210031 100644
--- a/lldb/include/lldb/Utility/DataExtractor.h
+++ b/lldb/include/lldb/Utility/DataExtractor.h
@@ -281,9 +281,9 @@ class DataExtractor {
/// Extract a C string from \a *offset_ptr.
///
/// Returns a pointer to a C String from the data at the offset pointed to
- /// by \a offset_ptr. A variable length NULL terminated C string will be
+ /// by \a offset_ptr. A variable length null-terminated C string will be
/// extracted and the \a offset_ptr will be updated with the offset of the
- /// byte that follows the NULL terminator byte.
+ /// byte that follows the null terminator byte.
///
/// \param[in,out] offset_ptr
/// A pointer to an offset within the data that will be advanced
@@ -303,7 +303,7 @@ class DataExtractor {
///
/// Returns a pointer to a C String from the data at the offset pointed to
/// by \a offset_ptr, with a field length of \a len.
- /// A NULL terminated C string will be extracted and the \a offset_ptr
+ /// A null-terminated C string will be extracted and the \a offset_ptr
/// will be updated with the offset of the byte that follows the fixed
/// length field.
///
@@ -318,7 +318,7 @@ class DataExtractor {
/// A pointer to the C string value in the data. If the offset
/// pointed to by \a offset_ptr is out of bounds, or if the
/// offset plus the length of the field is out of bounds, or if
- /// the field does not contain a NULL terminator byte, nullptr will
+ /// the field does not contain a null terminator byte, nullptr will
/// be returned.
const char *GetCStr(lldb::offset_t *offset_ptr, lldb::offset_t len) const;
@@ -338,7 +338,7 @@ class DataExtractor {
///
/// \param[in] length
/// The optional length of a string to extract. If the value is
- /// zero, a NULL terminated C string will be extracted.
+ /// zero, a null-terminated C string will be extracted.
///
/// \return
/// A pointer to the bytes in this object's data if the offset
@@ -857,7 +857,7 @@ class DataExtractor {
bool HasData() { return m_start && m_end && m_end - m_start > 0; }
- /// Peek at a NUL terminated C string at \a offset.
+ /// Peek at a null-terminated C string at \a offset.
///
/// The terminator must lie within the bounds of this object's data, so the
/// returned string never extends past the end of the data. Its data() is a
diff --git a/lldb/include/lldb/Utility/FileSpec.h b/lldb/include/lldb/Utility/FileSpec.h
index c5e5151590f0bc..e3a01de72fbaea 100644
--- a/lldb/include/lldb/Utility/FileSpec.h
+++ b/lldb/include/lldb/Utility/FileSpec.h
@@ -302,7 +302,7 @@ class FileSpec {
/// number is less than \a max_path_length, then the path is
/// properly copied and terminated. If the return value is
/// >= \a max_path_length, then the path was truncated (but is
- /// still NULL terminated).
+ /// still null-terminated).
size_t GetPath(char *path, size_t max_path_length,
bool denormalize = true) const;
diff --git a/lldb/include/lldb/Utility/RegularExpression.h b/lldb/include/lldb/Utility/RegularExpression.h
index e8bd47bb53c29a..cf9523ad48acc6 100644
--- a/lldb/include/lldb/Utility/RegularExpression.h
+++ b/lldb/include/lldb/Utility/RegularExpression.h
@@ -66,7 +66,7 @@ class RegularExpression {
/// Access the regular expression text.
///
/// \return
- /// The NULL terminated C string that was used to compile the
+ /// The null-terminated C string that was used to compile the
/// current regular expression
llvm::StringRef GetText() const;
diff --git a/lldb/include/lldb/Utility/State.h b/lldb/include/lldb/Utility/State.h
index 9ff755f14f6356..668359719f528b 100644
--- a/lldb/include/lldb/Utility/State.h
+++ b/lldb/include/lldb/Utility/State.h
@@ -23,7 +23,7 @@ namespace lldb_private {
/// The StateType object to convert.
///
/// \return
-/// A NULL terminated C string that describes \a state. The
+/// A null-terminated C string that describes \a state. The
/// returned string comes from constant string buffers and does
/// not need to be freed.
const char *StateAsCString(lldb::StateType state);
diff --git a/lldb/include/lldb/Utility/Status.h b/lldb/include/lldb/Utility/Status.h
index 212282cca1f3ed..e8d16cfbf8464f 100644
--- a/lldb/include/lldb/Utility/Status.h
+++ b/lldb/include/lldb/Utility/Status.h
@@ -175,13 +175,13 @@ class Status {
/// Get the error string associated with the current error.
//
- /// Gets the error value as a NULL terminated C string. The error string
+ /// Gets the error value as a null-terminated C string. The error string
/// will be fetched and cached on demand. The error string will be retrieved
/// from a callback that is appropriate for the type of the error and will
/// be cached until the error value is changed or cleared.
///
/// \return
- /// The error as a NULL terminated C string value if the error
+ /// The error as a null-terminated C string value if the error
/// is valid and is able to be converted to a string value,
/// NULL otherwise.
const char *AsCString(const char *default_error_str = "unknown error") const;
diff --git a/lldb/include/lldb/Utility/Stream.h b/lldb/include/lldb/Utility/Stream.h
index 5b872f14d0134f..15ba5e9c8c3534 100644
--- a/lldb/include/lldb/Utility/Stream.h
+++ b/lldb/include/lldb/Utility/Stream.h
@@ -192,10 +192,10 @@ class Stream {
size_t PutStringAsRawHex8(llvm::StringRef s);
- /// Output a NULL terminated C string \a cstr to the stream \a s.
+ /// Output a null-terminated C string \a cstr to the stream \a s.
///
/// \param[in] cstr
- /// A NULL terminated C string.
+ /// A null-terminated C string.
///
/// \return
/// A reference to this class so multiple things can be streamed
@@ -373,11 +373,11 @@ class Stream {
/// Output a quoted C string value to the stream.
///
- /// Print a double quoted NULL terminated C string to the stream using the
+ /// Print a double quoted null-terminated C string to the stream using the
/// printf format in \a format.
///
/// \param[in] cstr
- /// A NULL terminated C string value.
+ /// A null-terminated C string value.
///
/// \param[in] format
/// The optional C string format that can be overridden.
diff --git a/lldb/include/lldb/Utility/StreamBuffer.h b/lldb/include/lldb/Utility/StreamBuffer.h
index b5dcd4242dda3a..13682b08e5d031 100644
--- a/lldb/include/lldb/Utility/StreamBuffer.h
+++ b/lldb/include/lldb/Utility/StreamBuffer.h
@@ -31,7 +31,7 @@ template <unsigned N> class StreamBuffer : public Stream {
void Clear() { m_packet.clear(); }
- // Beware, this might not be NULL terminated as you can expect from
+ // Beware, this might not be null-terminated as you can expect from
// StringString as there may be random bits in the llvm::SmallVector. If you
// are using this class to create a C string, be sure the call PutChar ('\0')
// after you have created your string, or use StreamString.
diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h
index b79e4ff9a56fba..f86ea5fa13c8f9 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -198,7 +198,7 @@ enum Format {
/// Floating point complex type
eFormatComplex,
eFormatComplexFloat = eFormatComplex,
- /// NULL terminated C strings
+ /// Null-terminated C strings
eFormatCString,
eFormatDecimal,
eFormatEnum,
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index 112c47f0d7ff40..b1d67adae4512f 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -712,7 +712,7 @@ class CommandObjectMemoryRead : public CommandObjectParsed {
if (item_byte_size == read) {
result.AppendWarningWithFormatv(
- "unable to find a NULL terminated string at {0:x}"
+ "unable to find a null-terminated string at {0:x}"
". Consider increasing the maximum read length",
data_addr);
--read;
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp
index 86e1964fc72497..67417d5fa7a6a4 100644
--- a/lldb/source/Core/Address.cpp
+++ b/lldb/source/Core/Address.cpp
@@ -196,7 +196,7 @@ static size_t ReadCStringFromMemory(ExecutionContextScope *exe_scope,
return 0;
const size_t k_buf_len = 256;
char buf[k_buf_len + 1];
- buf[k_buf_len] = '\0'; // NULL terminate
+ buf[k_buf_len] = '\0'; // null-terminate
// Byte order and address size don't matter for C string dumping..
DataExtractor data(buf, sizeof(buf), endian::InlHostByteOrder(), 4);
diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp
index e886453a45908d..ebe2b00ff88bce 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -2337,7 +2337,7 @@ static Status ParseInternal(llvm::StringRef &format, Entry &parent_entry,
// hex number in the format
if (isxdigit(format[0])) {
// Make a string that can hold onto two hex chars plus a
- // NULL terminator
+ // null terminator
char hex_str[3] = {0, 0, 0};
hex_str[0] = format[0];
diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp
index f58c8e63600c4e..3f278bfa40335f 100644
--- a/lldb/source/Core/Mangled.cpp
+++ b/lldb/source/Core/Mangled.cpp
@@ -496,7 +496,7 @@ bool Mangled::Decode(const DataExtractor &data, lldb::offset_t *offset_ptr,
/// char str1[]; (only if DemangledOnly, MangledOnly)
/// char str2[]; (only if MangledAndDemangled)
///
-/// The strings are stored as NULL terminated UTF8 strings and str1 and str2
+/// The strings are stored as null-terminated UTF8 strings and str1 and str2
/// are only saved if we need them based on the encoding.
///
/// Some mangled names have a mangled name that can be demangled by the built
diff --git a/lldb/source/DataFormatters/StringPrinter.cpp b/lldb/source/DataFormatters/StringPrinter.cpp
index 05dfaca8bc1d9a..aecd1f95a1d83a 100644
--- a/lldb/source/DataFormatters/StringPrinter.cpp
+++ b/lldb/source/DataFormatters/StringPrinter.cpp
@@ -340,7 +340,7 @@ static bool DumpEncodedBufferToStream(
GetDefaultEscapingHelper(style, dump_options.GetEscapeStyle());
// since we tend to accept partial data (and even partially malformed data)
- // we might end up with no NULL terminator before the end_ptr hence we need
+ // we might end up with no null terminator before the end_ptr hence we need
// to take a slower route and ensure we stay within boundaries
for (; utf8_data_ptr < utf8_data_end_ptr;) {
if (zero_is_terminator && !*utf8_data_ptr)
diff --git a/lldb/source/Host/common/NativeProcessProtocol.cpp b/lldb/source/Host/common/NativeProcessProtocol.cpp
index a29972e1b67e00..c94825828435ad 100644
--- a/lldb/source/Host/common/NativeProcessProtocol.cpp
+++ b/lldb/source/Host/common/NativeProcessProtocol.cpp
@@ -801,7 +801,7 @@ NativeProcessProtocol::ReadCStringFromMemory(lldb::addr_t addr, char *buffer,
string_size = total_bytes_read - 1;
- // Make sure we return a null terminated string.
+ // Make sure we return a null-terminated string.
if (bytes_left == 0 && max_size > 0 && buffer[max_size - 1] != '\0') {
buffer[max_size - 1] = '\0';
total_bytes_read--;
diff --git a/lldb/source/Host/windows/Host.cpp b/lldb/source/Host/windows/Host.cpp
index 997aa31b31c94d..eb297df90b9286 100644
--- a/lldb/source/Host/windows/Host.cpp
+++ b/lldb/source/Host/windows/Host.cpp
@@ -301,7 +301,7 @@ Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info,
Environment Host::GetEnvironment() {
Environment env;
- // The environment block on Windows is a contiguous buffer of NULL terminated
+ // The environment block on Windows is a contiguous buffer of null-terminated
// strings, where the end of the environment block is indicated by two
// consecutive NULLs.
LPWCH environment_block = ::GetEnvironmentStringsW();
diff --git a/lldb/source/Interpreter/OptionGroupFormat.cpp b/lldb/source/Interpreter/OptionGroupFormat.cpp
index d9eab13e0bc231..ed419ca4a75720 100644
--- a/lldb/source/Interpreter/OptionGroupFormat.cpp
+++ b/lldb/source/Interpreter/OptionGroupFormat.cpp
@@ -116,7 +116,7 @@ Status OptionGroupFormat::SetOptionValue(uint32_t option_idx,
}
// We the first character of the "gdb_format_str" is not the
- // NULL terminator, we didn't consume the entire string and
+ // null terminator, we didn't consume the entire string and
// something is wrong. Also, if none of the format, size or count was
// specified correctly, then abort.
if (!gdb_format_str.empty() ||
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h
index 6416076291098c..37130d9326ab92 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h
@@ -80,7 +80,7 @@ class DynamicLoaderDarwin : public lldb_private::DynamicLoader {
Segment() : name() {}
// Segment name is 16 characters long. An extra byte is added to guarantee
- // nul termination in case all 16 bytes are used.
+ // null termination in case all 16 bytes are used.
char name[17];
lldb::addr_t vmaddr = LLDB_INVALID_ADDRESS;
lldb::addr_t vmsize = 0;
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 49cdbe4ecdc88e..defa80fe18f1da 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -251,10 +251,10 @@ bool ELFNote::Parse(const DataExtractor &data, lldb::offset_t *offset) {
if (data.GetU32(offset, &n_namesz, 3) == nullptr)
return false;
- // The name field is required to be nul-terminated, and n_namesz includes the
+ // The name field is required to be null-terminated, and n_namesz includes the
// terminating nul in observed implementations (contrary to the ELF-64 spec).
// A special case is needed for cores generated by some older Linux versions,
- // which write a note named "CORE" without a nul terminator and n_namesz = 4.
+ // which write a note named "CORE" without a null terminator and n_namesz = 4.
if (n_namesz == 4) {
char buf[4];
if (data.ExtractBytes(*offset, 4, data.GetByteOrder(), buf) != 4)
@@ -269,7 +269,7 @@ bool ELFNote::Parse(const DataExtractor &data, lldb::offset_t *offset) {
const char *cstr = data.GetCStr(offset, llvm::alignTo(n_namesz, 4));
if (cstr == nullptr) {
Log *log = GetLog(LLDBLog::Symbols);
- LLDB_LOGF(log, "Failed to parse note name lacking nul terminator");
+ LLDB_LOGF(log, "Failed to parse note name lacking null terminator");
return false;
}
diff --git a/lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.cpp b/lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.cpp
index a1fd4af85a51c3..9804b36ba86045 100644
--- a/lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.cpp
+++ b/lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.cpp
@@ -27,7 +27,7 @@ LLDB_PLUGIN_DEFINE(ObjectFileJSON)
char ObjectFileJSON::ID;
-/// Returns the JSON text in the buffer, which is not NULL terminated and may
+/// Returns the JSON text in the buffer, which is not null-terminated and may
/// be zero padded past the end of the file.
static StringRef GetText(const lldb_private::DataExtractor &data) {
StringRef text = toStringRef(data.GetData());
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 217c3c43d6f019..4570df57c42cb3 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -6112,9 +6112,9 @@ CreateAllImageInfosPayload(const lldb::ProcessSP &process_sp,
llvm::StringRef name = section->GetName();
segment_vmaddr seg_vmaddr;
// This is the uncommon case where strncpy is exactly
- // the right one, doesn't need to be nul terminated.
+ // the right one, doesn't need to be null-terminated.
// The segment name in a Mach-O LC_SEGMENT/LC_SEGMENT_64 is char[16] and
- // is not guaranteed to be nul-terminated if all 16 characters are
+ // is not guaranteed to be null-terminated if all 16 characters are
// used.
// coverity[buffer_size_warning]
strncpy(seg_vmaddr.segname, name.data(),
@@ -6466,9 +6466,9 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
char namebuf[16];
memset(namebuf, 0, sizeof(namebuf));
// This is the uncommon case where strncpy is exactly
- // the right one, doesn't need to be nul terminated.
+ // the right one, doesn't need to be null-terminated.
// LC_NOTE name field is char[16] and is not guaranteed to be
- // nul-terminated.
+ // null-terminated.
// coverity[buffer_size_warning]
strncpy(namebuf, lcnote->name.c_str(), sizeof(namebuf));
buffer.PutRawBytes(namebuf, sizeof(namebuf));
diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
index 68460496a144f1..2a5a3d55ec98c8 100644
--- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -790,8 +790,8 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process *process,
// Set the values into our args and write them to the target:
if (paths != nullptr) {
- // First insert the paths into the target. This is expected to be a
- // continuous buffer with the strings laid out null terminated and
+ // First insert the paths into the target. This is expected to be a
+ // continuous buffer with the strings laid out null-terminated and
// end to end with an empty string terminating the buffer.
// We also compute the buffer's required size as we go.
size_t buffer_size = 0;
diff --git a/lldb/source/Plugins/Process/elf-core/RegisterUtilities.h b/lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
index 5511ee79a836e8..66e257a6163f3c 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
+++ b/lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
@@ -89,7 +89,7 @@ enum {
//
// namesz
//
- // Length of the note name (including NUL terminator). For
+ // Length of the note name (including null terminator). For
// 'NT_CSREGMAP'the note name is the usual core dump note name (e.g.
// "CORE" for OS-generated core files).
//
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
index dd612177ad45ac..e0654e13432b16 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
@@ -104,7 +104,7 @@ class GDBRemoteCommunicationClient : public GDBRemoteClientBase {
/// environment that the inferior should be launched with.
///
/// \param[in] name_equal_value
- /// A NULL terminated C string that contains a single environment
+ /// A null-terminated C string that contains a single environment
/// in the format "NAME=VALUE".
///
/// \return
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
index 72aeb2743b1e20..d67388996f1c57 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
@@ -188,7 +188,7 @@ class DWARFDebugInfoEntry {
// How many to add to "this" to get the sibling.
// If it is zero, then the DIE doesn't have children,
// or the DWARF claimed it had children but the DIE
- // only contained a single NULL terminating child.
+ // only contained a single null-terminating child.
uint32_t m_sibling_idx : 31, m_has_children : 1;
uint16_t m_abbr_idx = 0;
/// A copy of the DW_TAG value so we don't have to go through the compile
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
index d3a9fc28110acc..c599da27f47017 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
@@ -234,7 +234,7 @@ bool DWARFFormValue::SkipValue(dw_form_t form,
}
return true;
- // Inlined NULL terminated C-strings
+ // Inlined null-terminated C-strings
case DW_FORM_string:
debug_info_data.GetCStr(offset_ptr);
return true;
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 5255ec835c0a44..2d8211d64ecaca 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -8739,7 +8739,7 @@ bool TypeSystemClang::DumpTypeValue(
case eFormatBoolean:
case eFormatBinary:
case eFormatComplex:
- case eFormatCString: // NULL terminated C strings
+ case eFormatCString: // null-terminated C strings
case eFormatDecimal:
case eFormatEnum:
case eFormatHex:
diff --git a/lldb/source/Utility/Args.cpp b/lldb/source/Utility/Args.cpp
index f538fa4618ee60..32508029df5db0 100644
--- a/lldb/source/Utility/Args.cpp
+++ b/lldb/source/Utility/Args.cpp
@@ -293,7 +293,7 @@ const char **Args::GetConstArgumentVector() const {
}
void Args::Shift() {
- // Don't pop the last NULL terminator from the argv array
+ // Don't pop the last null terminator from the argv array
if (m_entries.empty())
return;
m_argv.erase(m_argv.begin());
@@ -533,7 +533,7 @@ void Args::EncodeEscapeSequences(const char *src, std::string &dst) {
++p; // Skip the 'x'
// Make a string that can hold onto two hex chars plus a
- // NULL terminator
+ // null terminator
char hex_str[3] = {*p, '\0', '\0'};
if (isxdigit(p[1])) {
++p; // Skip the first of the two hex chars
diff --git a/lldb/source/Utility/DataExtractor.cpp b/lldb/source/Utility/DataExtractor.cpp
index 213e21ecd76e46..0d707f6f76d538 100644
--- a/lldb/source/Utility/DataExtractor.cpp
+++ b/lldb/source/Utility/DataExtractor.cpp
@@ -694,9 +694,9 @@ DataExtractor::CopyByteOrderedData(offset_t src_offset, offset_t src_len,
return 0;
}
-// Extracts a variable length NULL terminated C string from the data at the
+// Extracts a variable length null-terminated C string from the data at the
// offset pointed to by "offset_ptr". The "offset_ptr" will be updated with
-// the offset of the byte that follows the NULL terminator byte.
+// the offset of the byte that follows the null terminator byte.
//
// If the offset pointed to by "offset_ptr" is out of bounds, or if "length" is
// non-zero and there aren't enough available bytes, nullptr will be returned
@@ -711,13 +711,13 @@ const char *DataExtractor::GetCStr(offset_t *offset_ptr) const {
return str->data();
}
-// Extracts a NULL terminated C string from the fixed length field of length
+// Extracts a null-terminated C string from the fixed length field of length
// "len" at the offset pointed to by "offset_ptr". The "offset_ptr" will be
// updated with the offset of the byte that follows the fixed length field.
//
// If the offset pointed to by "offset_ptr" is out of bounds, or if the offset
// plus the length of the field is out of bounds, or if the field does not
-// contain a NULL terminator byte, nullptr will be returned and "offset_ptr"
+// contain a null terminator byte, nullptr will be returned and "offset_ptr"
// will not be updated.
const char *DataExtractor::GetCStr(offset_t *offset_ptr, offset_t len) const {
const char *cstr = reinterpret_cast<const char *>(PeekData(*offset_ptr, len));
diff --git a/lldb/source/Utility/Stream.cpp b/lldb/source/Utility/Stream.cpp
index ad3eb416f9888a..5209df574e80ca 100644
--- a/lldb/source/Utility/Stream.cpp
+++ b/lldb/source/Utility/Stream.cpp
@@ -59,12 +59,12 @@ size_t Stream::PutULEB128(uint64_t uval) {
return Printf("0x%" PRIx64, uval);
}
-// Print a raw NULL terminated C string to the stream.
+// Print a raw null-terminated C string to the stream.
size_t Stream::PutCString(llvm::StringRef str) {
size_t bytes_written = 0;
bytes_written = Write(str.data(), str.size());
- // when in binary mode, emit the NULL terminator
+ // when in binary mode, emit the null terminator
if (m_flags.Test(eBinary))
bytes_written += PutChar('\0');
return bytes_written;
@@ -97,7 +97,7 @@ void Stream::PutCStringColorHighlighted(
PutCString(remaining);
}
-// Print a double quoted NULL terminated C string to the stream using the
+// Print a double quoted null-terminated C string to the stream using the
// printf format in "format".
void Stream::QuotedCString(const char *cstr, const char *format) {
Printf(format, cstr);
@@ -144,7 +144,7 @@ size_t Stream::PrintfVarArg(const char *format, va_list args) {
llvm::SmallString<1024> buf;
VASprintf(buf, format, args);
- // Include the NULL termination byte for binary output
+ // Include the null termination byte for binary output
size_t length = buf.size();
if (m_flags.Test(eBinary))
++length;
@@ -166,7 +166,7 @@ Stream &Stream::operator<<(char ch) {
return *this;
}
-// Stream the NULL terminated C string out to this stream.
+// Stream the null-terminated C string out to this stream.
Stream &Stream::operator<<(const char *s) {
Printf("%s", s);
return *this;
diff --git a/lldb/source/ValueObject/ValueObject.cpp b/lldb/source/ValueObject/ValueObject.cpp
index e7d3b7ce5be6a7..989ad64a9a65c0 100644
--- a/lldb/source/ValueObject/ValueObject.cpp
+++ b/lldb/source/ValueObject/ValueObject.cpp
@@ -966,7 +966,7 @@ ValueObject::ReadPointedString(lldb::WritableDataBufferSP &buffer_sp,
if (cstr_address.address == 0 ||
cstr_address.address == LLDB_INVALID_ADDRESS) {
if (cstr_address.type == eAddressTypeHost && is_array) {
- // The array is not required to be NUL terminated, so ask for the
+ // The array is not required to be null-terminated, so ask for the
// bytes rather than for a C string. Its data can also be shorter than
// the array type, as for a DW_AT_const_value string, so clamp the
// length to what is really there.
diff --git a/lldb/test/API/commands/memory/read/TestMemoryRead.py b/lldb/test/API/commands/memory/read/TestMemoryRead.py
index 57ca7069c5ce32..1167076cf54d46 100644
--- a/lldb/test/API/commands/memory/read/TestMemoryRead.py
+++ b/lldb/test/API/commands/memory/read/TestMemoryRead.py
@@ -37,7 +37,7 @@ def test_memory_read_c_string(self):
self.expect(cmd.format(3), substrs=['"ab"'])
self.assertRegex(
self.res.GetError(),
- "unable to find a NULL terminated string at 0x[0-9A-Fa-f]+"
+ "unable to find a null-terminated string at 0x[0-9A-Fa-f]+"
". Consider increasing the maximum read length",
)
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
index 34989aea9de6ea..fbc8e59413e6c5 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
@@ -274,7 +274,7 @@ def test_overwritten_libcxx(self):
self.do_test_overwritten()
@expectedFailureAll(
- bugnumber="libstdc++ format for non-null terminated std::string currently diverges from MSVC and libc++ formatter."
+ bugnumber="libstdc++ format for non-null-terminated std::string currently diverges from MSVC and libc++ formatter."
)
@add_test_categories(["libstdcxx"])
def test_overwritten_libstdcxx(self):
diff --git a/lldb/test/API/functionalities/json/object-file/TestObjectFileJSON.py b/lldb/test/API/functionalities/json/object-file/TestObjectFileJSON.py
index 8699bfec03f0d4..dce2db55d01a2f 100644
--- a/lldb/test/API/functionalities/json/object-file/TestObjectFileJSON.py
+++ b/lldb/test/API/functionalities/json/object-file/TestObjectFileJSON.py
@@ -46,7 +46,7 @@ def test_target(self):
@no_debug_info_test
def test_page_multiple(self):
"""A file whose size is a multiple of the page size is mmapped without
- a NULL terminator."""
+ a null terminator."""
triple = "arm64-apple-macosx13.0.0"
data = {
"triple": triple,
diff --git a/lldb/test/API/macosx/lc-note/additional-registers/add-lcnote.cpp b/lldb/test/API/macosx/lc-note/additional-registers/add-lcnote.cpp
index c5ab732c0c7cc6..8427245b7ca20d 100644
--- a/lldb/test/API/macosx/lc-note/additional-registers/add-lcnote.cpp
+++ b/lldb/test/API/macosx/lc-note/additional-registers/add-lcnote.cpp
@@ -307,7 +307,7 @@ void copy_and_add_note(FILE *in, FILE *out, std::string lc_note_name,
note.cmd = LC_NOTE;
note.cmdsize = sizeof(struct note_command);
memset(¬e.data_owner, 0, 16);
- // data_owner may not be nul terminated if all 16 characters
+ // data_owner may not be null-terminated if all 16 characters
// are used, intentionally using strncpy here.
strncpy(note.data_owner, lc_note_name.c_str(), 16);
note.offset = infile_size + slide;
diff --git a/lldb/test/API/tools/lldb-server/main.cpp b/lldb/test/API/tools/lldb-server/main.cpp
index eabe2bc886b856..7f3785a156db1b 100644
--- a/lldb/test/API/tools/lldb-server/main.cpp
+++ b/lldb/test/API/tools/lldb-server/main.cpp
@@ -292,7 +292,7 @@ int main(int argc, char **argv) {
// expectations.
strncpy(g_message, arg.c_str(), sizeof(g_message));
- // Ensure we're null terminated.
+ // Ensure we're null-terminated.
g_message[sizeof(g_message) - 1] = '\0';
} else if (consume_front(arg, "print-message:")) {
diff --git a/lldb/tools/debugserver/source/DNB.cpp b/lldb/tools/debugserver/source/DNB.cpp
index 1f13e70a12546f..4a974ed87fbf2c 100644
--- a/lldb/tools/debugserver/source/DNB.cpp
+++ b/lldb/tools/debugserver/source/DNB.cpp
@@ -1465,7 +1465,7 @@ nub_bool_t DNBThreadGetStopReason(nub_process_t pid, nub_thread_t tid,
// Return string description for the specified thread.
//
-// RETURNS: NULL if the thread isn't valid, else a NULL terminated C
+// RETURNS: NULL if the thread isn't valid, else a null-terminated C
// string from a static buffer that must be copied prior to subsequent
// calls.
const char *DNBThreadGetInfo(nub_process_t pid, nub_thread_t tid) {
diff --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
index 3374267f7bde8c..6ca1945c7e595d 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
+++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
@@ -2813,7 +2813,7 @@ static uint64_t bits(uint64_t value, uint32_t msbit, uint32_t lsbit) {
} else if (num_set_fds == 0) {
} else {
char s[1024];
- s[sizeof(s) - 1] = '\0'; // Ensure we have NULL termination
+ s[sizeof(s) - 1] = '\0'; // Ensure we have null termination
ssize_t bytes_read = 0;
if (stdout_fd >= 0 && FD_ISSET(stdout_fd, &read_fds)) {
do {
diff --git a/lldb/tools/debugserver/source/PseudoTerminal.cpp b/lldb/tools/debugserver/source/PseudoTerminal.cpp
index 059b5627668724..2cd1c2e33caa22 100644
--- a/lldb/tools/debugserver/source/PseudoTerminal.cpp
+++ b/lldb/tools/debugserver/source/PseudoTerminal.cpp
@@ -107,7 +107,7 @@ PseudoTerminal::Status PseudoTerminal::OpenSecondary(int oflag) {
//
// RETURNS:
// NULL if no valid primary pseudo terminal or if ptsname() fails.
-// The name of the secondary pseudo terminal as a NULL terminated C string
+// The name of the secondary pseudo terminal as a null-terminated C string
// that comes from static memory, so a copy of the string should be
// made as subsequent calls can change this value.
const char *PseudoTerminal::SecondaryName() const {
diff --git a/lldb/tools/debugserver/source/RNBServices.cpp b/lldb/tools/debugserver/source/RNBServices.cpp
index bb57fb5ea027eb..b36fa3437e24a7 100644
--- a/lldb/tools/debugserver/source/RNBServices.cpp
+++ b/lldb/tools/debugserver/source/RNBServices.cpp
@@ -88,7 +88,7 @@ int GetProcesses(CFMutableArrayRef plistMutableArray, bool all_users) {
// Okay, now search backwards from that to see if there is a
// slash in the name. Note, even though we got all the args we don't
// care
- // because the list data is just a bunch of concatenated null terminated
+ // because the list data is just a bunch of concatenated null-terminated
// strings
// so strrchr will start from the end of argv0.
diff --git a/lldb/tools/debugserver/source/debugserver.cpp b/lldb/tools/debugserver/source/debugserver.cpp
index 2c32fe98cf1ba0..2b8aaea191e80e 100644
--- a/lldb/tools/debugserver/source/debugserver.cpp
+++ b/lldb/tools/debugserver/source/debugserver.cpp
@@ -715,7 +715,7 @@ static void PortWasBoundCallbackNamedPipe(const void *baton, uint16_t port) {
char port_str[64];
const ssize_t port_str_len =
::snprintf(port_str, sizeof(port_str), "%u", port);
- // Write the port number as a C string with the NULL terminator
+ // Write the port number as a C string with the null terminator
::write(fd, port_str, port_str_len + 1);
close(fd);
}
@@ -1027,7 +1027,7 @@ int main(int argc, char *argv[]) {
}
}
}
- // NULL terminate the short option string.
+ // Null-terminate the short option string.
short_options[short_options_idx++] = '\0';
#if __GLIBC__
diff --git a/lldb/tools/lldb-dap/SourceBreakpoint.cpp b/lldb/tools/lldb-dap/SourceBreakpoint.cpp
index 82a07f1f995527..b7541986a77cbc 100644
--- a/lldb/tools/lldb-dap/SourceBreakpoint.cpp
+++ b/lldb/tools/lldb-dap/SourceBreakpoint.cpp
@@ -236,7 +236,7 @@ lldb::SBError SourceBreakpoint::FormatLogText(llvm::StringRef text,
// hex number in the text
if (std::isxdigit(text[0])) {
// Make a string that can hold onto two hex chars plus a
- // NULL terminator
+ // null terminator
char hex_str[3] = {0, 0, 0};
hex_str[0] = text[0];
diff --git a/lldb/unittests/Utility/DataEncoderTest.cpp b/lldb/unittests/Utility/DataEncoderTest.cpp
index 8d502f0f80b576..8b169c33949ae0 100644
--- a/lldb/unittests/Utility/DataEncoderTest.cpp
+++ b/lldb/unittests/Utility/DataEncoderTest.cpp
@@ -144,12 +144,12 @@ TEST(DataEncoderTest, AppendCString) {
// does contain a NULL in the referenced string.
encoder.AppendCString(StringRef("\0", 1));
ASSERT_EQ(encoder.GetData(), ArrayRef<uint8_t>({0x00, 0x00}));
- // Append a string where the StringRef doesn't contain a NULL termination
- // and verify the NULL terminate gets added
+ // Append a string where the StringRef doesn't contain a null termination
+ // and verify the null terminator gets added
encoder.AppendCString(StringRef("hello"));
ASSERT_EQ(encoder.GetData(),
ArrayRef<uint8_t>({0x00, 0x00, 'h', 'e', 'l', 'l', 'o', 0x00}));
- // Append a string where the StringRef does contain a NULL termination and
+ // Append a string where the StringRef does contain a null termination and
// verify only one NULL is added
encoder.AppendCString(StringRef("world", 6));
ASSERT_EQ(encoder.GetData(),
diff --git a/lldb/unittests/Utility/DataExtractorTest.cpp b/lldb/unittests/Utility/DataExtractorTest.cpp
index 87f8dcba10ec4c..05156591b05f5a 100644
--- a/lldb/unittests/Utility/DataExtractorTest.cpp
+++ b/lldb/unittests/Utility/DataExtractorTest.cpp
@@ -158,7 +158,7 @@ TEST(DataExtractorTest, PeekCStr) {
EXPECT_EQ("", E.PeekCStr(4));
EXPECT_EQ(std::nullopt, E.PeekCStr(5));
- // The result is NULL terminated, so data() is a valid C string.
+ // The result is null-terminated, so data() is a valid C string.
EXPECT_STREQ("foo", E.PeekCStr(1)->data());
}
>From 20447fa5461caac5438bb381a5d5c675a7030a00 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Sat, 19 Sep 2026 15:53:03 -0700
Subject: [PATCH 2/2] Fix more instances
---
lldb/include/lldb/Target/Process.h | 10 +++++-----
lldb/include/lldb/Target/Target.h | 11 +++++------
lldb/include/lldb/Utility/ConstString.h | 2 +-
lldb/include/lldb/Utility/DataEncoder.h | 8 ++++----
lldb/include/lldb/Utility/DataExtractor.h | 6 +++---
.../ObjectFile/Minidump/MinidumpFileBuilder.cpp | 6 +++---
.../ObjectFile/Minidump/MinidumpFileBuilder.h | 7 +++----
lldb/source/Utility/DataExtractor.cpp | 6 +++---
lldb/source/Utility/Stream.cpp | 2 +-
lldb/unittests/Utility/DataEncoderTest.cpp | 14 +++++++-------
10 files changed, 35 insertions(+), 37 deletions(-)
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index e7d832da8d2402..daef77e83b3b42 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -1692,11 +1692,11 @@ class Process : public std::enable_shared_from_this<Process>,
/// Read a null-terminated C string from memory
///
- /// This function will read a cache page at a time until the NULL
- /// C string terminator is found. It will stop reading if the NULL
- /// termination byte isn't found before reading \a cstr_max_len bytes, and
- /// the results are always guaranteed to be null-terminated (at most
- /// cstr_max_len - 1 bytes will be read).
+ /// This function will read a cache page at a time until the null
+ /// terminator is found. It will stop reading if the null terminator isn't
+ /// found before reading \a cstr_max_len bytes, and the results are always
+ /// guaranteed to be null-terminated (at most cstr_max_len - 1 bytes will be
+ /// read).
size_t ReadCStringFromMemory(lldb::addr_t vm_addr, char *cstr,
size_t cstr_max_len, Status &error);
diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h
index 7df591e028f192..7e141ffdf2ce16 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -1383,12 +1383,11 @@ class Target : public std::enable_shared_from_this<Target>,
/// Read a null-terminated string from memory
///
- /// This function will read a cache page at a time until a NULL string
- /// terminator is found. It will stop reading if an aligned sequence of NULL
- /// termination \a type_width bytes is not found before reading \a
- /// cstr_max_len bytes. The results are always guaranteed to be NULL
- /// terminated, and that no more than (max_bytes - type_width) bytes will be
- /// read.
+ /// This function will read a cache page at a time until a null terminator
+ /// is found. It will stop reading if an aligned null terminator of \a
+ /// type_width bytes is not found before reading \a cstr_max_len bytes. The
+ /// results are always guaranteed to be null-terminated, and that no more
+ /// than (max_bytes - type_width) bytes will be read.
///
/// \param[in] addr
/// The address to start the memory read.
diff --git a/lldb/include/lldb/Utility/ConstString.h b/lldb/include/lldb/Utility/ConstString.h
index f5a9da52a5483c..b2d56bffcefbc2 100644
--- a/lldb/include/lldb/Utility/ConstString.h
+++ b/lldb/include/lldb/Utility/ConstString.h
@@ -217,7 +217,7 @@ class ConstString {
///
/// \return
/// Returns the number of bytes that this string occupies in
- /// memory, not including the null termination byte.
+ /// memory, not including the null terminator.
size_t GetLength() const;
/// Clear this object's state.
diff --git a/lldb/include/lldb/Utility/DataEncoder.h b/lldb/include/lldb/Utility/DataEncoder.h
index 0f0a2dc378d5a1..c1317f63e3d72f 100644
--- a/lldb/include/lldb/Utility/DataEncoder.h
+++ b/lldb/include/lldb/Utility/DataEncoder.h
@@ -149,8 +149,8 @@ class DataEncoder {
/// Append bytes to the end of the owned data.
///
/// Append the bytes contained in the string reference. This function will
- /// not append a null termination character for a C string. Use the
- /// AppendCString function for this purpose.
+ /// not append a null terminator for a C string. Use the AppendCString
+ /// function for this purpose.
///
/// \param data
/// A string reference that contains bytes to append.
@@ -167,8 +167,8 @@ class DataEncoder {
/// Append a C string to the end of the owned data.
///
/// Append the bytes contained in the string reference along with an extra
- /// null termination character if the StringRef bytes doesn't include one as
- /// the last byte.
+ /// null terminator if the StringRef bytes doesn't include one as the last
+ /// byte.
///
/// \param data
/// A string reference that contains bytes to append.
diff --git a/lldb/include/lldb/Utility/DataExtractor.h b/lldb/include/lldb/Utility/DataExtractor.h
index 6fd317b7210031..33c98206c9b9d9 100644
--- a/lldb/include/lldb/Utility/DataExtractor.h
+++ b/lldb/include/lldb/Utility/DataExtractor.h
@@ -283,7 +283,7 @@ class DataExtractor {
/// Returns a pointer to a C String from the data at the offset pointed to
/// by \a offset_ptr. A variable length null-terminated C string will be
/// extracted and the \a offset_ptr will be updated with the offset of the
- /// byte that follows the null terminator byte.
+ /// byte that follows the null terminator.
///
/// \param[in,out] offset_ptr
/// A pointer to an offset within the data that will be advanced
@@ -318,8 +318,8 @@ class DataExtractor {
/// A pointer to the C string value in the data. If the offset
/// pointed to by \a offset_ptr is out of bounds, or if the
/// offset plus the length of the field is out of bounds, or if
- /// the field does not contain a null terminator byte, nullptr will
- /// be returned.
+ /// the field does not contain a null terminator, nullptr will be
+ /// returned.
const char *GetCStr(lldb::offset_t *offset_ptr, lldb::offset_t len) const;
/// Extract \a length bytes from \a *offset_ptr.
diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
index 80f62d8d4e5687..b0b146b5ba6244 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
@@ -227,7 +227,7 @@ Status MinidumpFileBuilder::AddSystemInfo() {
Status WriteString(const std::string &to_write,
lldb_private::DataBufferHeap *buffer) {
Status error;
- // let the StringRef eat also null termination char
+ // let the StringRef eat also the null terminator
llvm::StringRef to_write_ref(to_write.c_str(), to_write.size() + 1);
llvm::SmallVector<llvm::UTF16, 128> to_write_utf16;
@@ -239,8 +239,8 @@ Status WriteString(const std::string &to_write,
return error;
}
- // size of the UTF16 string should be written without the null termination
- // character that is stored in 2 bytes
+ // size of the UTF16 string should be written without the null terminator
+ // that is stored in 2 bytes
llvm::support::ulittle32_t to_write_size(to_write_utf16.size_in_bytes() - 2);
buffer->AppendData(&to_write_size, sizeof(llvm::support::ulittle32_t));
diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
index 46b20f90138fe5..689b5a5e441b38 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
@@ -35,10 +35,9 @@
#include "llvm/BinaryFormat/Minidump.h"
#include "llvm/Object/Minidump.h"
-// Write std::string to minidump in the UTF16 format(with null termination char)
-// with the size(without null termination char) preceding the UTF16 string.
-// Empty strings are also printed with zero length and just null termination
-// char.
+// Write std::string to minidump in the UTF16 format(with null terminator)
+// with the size(without null terminator) preceding the UTF16 string.
+// Empty strings are also printed with zero length and just a null terminator.
lldb_private::Status WriteString(const std::string &to_write,
lldb_private::DataBufferHeap *buffer);
diff --git a/lldb/source/Utility/DataExtractor.cpp b/lldb/source/Utility/DataExtractor.cpp
index 0d707f6f76d538..8552b810a60c82 100644
--- a/lldb/source/Utility/DataExtractor.cpp
+++ b/lldb/source/Utility/DataExtractor.cpp
@@ -696,7 +696,7 @@ DataExtractor::CopyByteOrderedData(offset_t src_offset, offset_t src_len,
// Extracts a variable length null-terminated C string from the data at the
// offset pointed to by "offset_ptr". The "offset_ptr" will be updated with
-// the offset of the byte that follows the null terminator byte.
+// the offset of the byte that follows the null terminator.
//
// If the offset pointed to by "offset_ptr" is out of bounds, or if "length" is
// non-zero and there aren't enough available bytes, nullptr will be returned
@@ -717,8 +717,8 @@ const char *DataExtractor::GetCStr(offset_t *offset_ptr) const {
//
// If the offset pointed to by "offset_ptr" is out of bounds, or if the offset
// plus the length of the field is out of bounds, or if the field does not
-// contain a null terminator byte, nullptr will be returned and "offset_ptr"
-// will not be updated.
+// contain a null terminator, nullptr will be returned and "offset_ptr" will
+// not be updated.
const char *DataExtractor::GetCStr(offset_t *offset_ptr, offset_t len) const {
const char *cstr = reinterpret_cast<const char *>(PeekData(*offset_ptr, len));
if (cstr != nullptr) {
diff --git a/lldb/source/Utility/Stream.cpp b/lldb/source/Utility/Stream.cpp
index 5209df574e80ca..d93cdafa52f196 100644
--- a/lldb/source/Utility/Stream.cpp
+++ b/lldb/source/Utility/Stream.cpp
@@ -144,7 +144,7 @@ size_t Stream::PrintfVarArg(const char *format, va_list args) {
llvm::SmallString<1024> buf;
VASprintf(buf, format, args);
- // Include the null termination byte for binary output
+ // Include the null terminator for binary output
size_t length = buf.size();
if (m_flags.Test(eBinary))
++length;
diff --git a/lldb/unittests/Utility/DataEncoderTest.cpp b/lldb/unittests/Utility/DataEncoderTest.cpp
index 8b169c33949ae0..882a0af5078622 100644
--- a/lldb/unittests/Utility/DataEncoderTest.cpp
+++ b/lldb/unittests/Utility/DataEncoderTest.cpp
@@ -136,21 +136,21 @@ TEST(DataEncoderTest, AppendCString) {
// Make sure default constructed StringRef appends nothing
encoder.AppendCString(StringRef());
ASSERT_EQ(encoder.GetData(), ArrayRef<uint8_t>({}));
- // Make sure empty StringRef appends a NULL character since the StringRef
- // doesn't contain a NULL in the referenced string.
+ // Make sure empty StringRef appends a null character since the StringRef
+ // doesn't contain a null in the referenced string.
encoder.AppendCString(StringRef(""));
ASSERT_EQ(encoder.GetData(), ArrayRef<uint8_t>({0x00}));
- // Make sure empty StringRef appends only one NULL character if StringRef
- // does contain a NULL in the referenced string.
+ // Make sure empty StringRef appends only one null character if StringRef
+ // does contain a null in the referenced string.
encoder.AppendCString(StringRef("\0", 1));
ASSERT_EQ(encoder.GetData(), ArrayRef<uint8_t>({0x00, 0x00}));
- // Append a string where the StringRef doesn't contain a null termination
+ // Append a string where the StringRef doesn't contain a null terminator
// and verify the null terminator gets added
encoder.AppendCString(StringRef("hello"));
ASSERT_EQ(encoder.GetData(),
ArrayRef<uint8_t>({0x00, 0x00, 'h', 'e', 'l', 'l', 'o', 0x00}));
- // Append a string where the StringRef does contain a null termination and
- // verify only one NULL is added
+ // Append a string where the StringRef does contain a null terminator and
+ // verify only one null terminator is added
encoder.AppendCString(StringRef("world", 6));
ASSERT_EQ(encoder.GetData(),
ArrayRef<uint8_t>({0x00, 0x00, 'h', 'e', 'l', 'l', 'o', 0x00,
More information about the lldb-commits
mailing list