aboutsummaryrefslogtreecommitdiff
path: root/gdb/tracectf.c
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2023-05-31 20:57:01 +0100
committerAndrew Burgess <aburgess@redhat.com>2023-07-07 15:20:28 +0100
commit7d8708653dc05075b926a61303abd96c3f746e25 (patch)
tree3c870846cc8569562128ffff7c82d8cc0128bc76 /gdb/tracectf.c
parent1a36815e2f1ad39acf894660759cf1a0bef39fcc (diff)
downloadgdb-7d8708653dc05075b926a61303abd96c3f746e25.zip
gdb-7d8708653dc05075b926a61303abd96c3f746e25.tar.gz
gdb-7d8708653dc05075b926a61303abd96c3f746e25.tar.bz2
gdb: remove last alloca call from printcmd.c
This commit removes the last alloca call from printcmd.c. This is similar to the patches I originally posted here: https://inbox.sourceware.org/gdb-patches/cover.1677533215.git.aburgess@redhat.com/ However, this change was not included in that original series. The original series received push back because it was thought that replacing alloca with a C++ container type would introduce unnecessary malloc/free overhead. However, in this case we are building a string, and (at least for GCC), the std::string type has a small string optimisation, where small strings are stored on the stack. And in this case we are building what will usually be a very small string, we're just constructing a printf format specifier for a hex value, so it'll be something like '%#x' -- though it could also have a width in there too -- but still, it should normally fit within GCCs small string buffer. So, in this commit, I propose replacing the use of alloca with a std::string. This shouldn't result (normally) in any additional malloc or free calls, so should be similar in performance to the original approach. There should be no user visible differences after this commit.
Diffstat (limited to 'gdb/tracectf.c')
0 files changed, 0 insertions, 0 deletions