[PATCH 0/4] Some alloca removal and a printf bug fix
Andrew Burgess
aburgess@redhat.com
Thu Jun 1 09:27:49 GMT 2023
I previously posted this series in an attempt to remove lots of alloca use:
https://inbox.sourceware.org/gdb-patches/cover.1677533215.git.aburgess@redhat.com/
there was some push back against that complete series, however, I
think the problem that was pointed out doesn't apply to one of the
original patches, so this series started with me trying to upstream
that one patch (this is patch #2 in this series).
However, while reviewing the patch again I spotted a bug I'd
introduced. Which means we have a gap in our testing, as the bug was
not exposed during testing. So I started to write a test, and hit
another bug (not one introduced by me), this is fixed in patch #1 in
this series.
My original series didn't remove all the uses of alloca from
printcmd.c, I don't recall why. But on review it's actually pretty
easy to remove the final alloca from printcmd.c, so that's what
patch #3 in this series does.
And finally, while working on patch #2 I realised that a badly formed
inferior (e.g. one that needed debugging due to memory corruption)
could cause GDB to try and allocate a huge ammount of memory,
potentially crashing GDB. This is mitigated in patch #4.
---
Andrew Burgess (4):
gdb: fix printf of wchar_t early in a gdb session
gdb: remove two uses of alloca from printcmd.c
gdb: remove last alloca call from printcmd.c
gdb: check max-value-size when reading strings for printf
gdb/c-lang.c | 3 -
gdb/gdbtypes.c | 11 ++-
gdb/gdbtypes.h | 14 ++-
gdb/printcmd.c | 102 +++++++++++++---------
gdb/testsuite/gdb.base/printcmds.c | 2 +
gdb/testsuite/gdb.base/printcmds.exp | 5 ++
gdb/testsuite/gdb.base/printf-wchar_t.c | 28 ++++++
gdb/testsuite/gdb.base/printf-wchar_t.exp | 32 +++++++
gdb/testsuite/lib/gdb.exp | 30 +++++++
gdb/value.c | 10 ++-
gdb/value.h | 5 ++
11 files changed, 192 insertions(+), 50 deletions(-)
create mode 100644 gdb/testsuite/gdb.base/printf-wchar_t.c
create mode 100644 gdb/testsuite/gdb.base/printf-wchar_t.exp
base-commit: e9683acf5e51c2bac8aa68d30d9ac3683dddcc7d
--
2.25.4
More information about the Gdb-patches
mailing list