This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug python/12127] gdb with python support still get crash on showing uninitialized local variables


http://sourceware.org/bugzilla/show_bug.cgi?id=12127

--- Comment #5 from asmwarrior <asmwarrior at gmail dot com> 2013-05-07 06:16:45 UTC ---
 gdb/python/py-prettyprint.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c
index b50e757..e0dd92b 100644
--- a/gdb/python/py-prettyprint.c
+++ b/gdb/python/py-prettyprint.c
@@ -332,7 +332,9 @@ print_string_repr (PyObject *printer, const char *hint,
       gdbpy_extract_lazy_string (py_str, &addr, &type,
                      &length, &encoding);

-      local_opts.addressprint = 0;
+      if (length > local_opts.print_max)
+        length = local_opts.print_max;
+          local_opts.addressprint = 0;
       val_print_string (type, encoding, addr, (int) length,
                 stream, &local_opts);
     }

-------------------------
The above patch fix the crash problem, but I'm not sure it was good or just a
workaround.

Yuanhui Zhang

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]