Hi Tao,
Sorry to be a bother, but the author of this patch changed again.
Maybe while rebasing and editing the patch series, this might have
happened, thanks for sending out this series again though.
Thanks,
Aditya Gupta
On 29/07/24 16:14, Tao Liu wrote:
Currently for most gdb_interface call, in which a non-null file pointer
is passed, GDB's output stream is replaced with the passed file pointer
Due to this, 'info threads', which is a gdb passthrough, doesn't print any
thread, after support was added to get registers from crash_target:
crash> info threads
Id Target Id Frame
This empty output of 'info threads' was due to a subtle bug in
gdb_interface.
After this gdb passthrough is run, 'datatype_info' is called, with file
pointer set to null_fp (pointing to /dev/null). And after
'datatype_info' returns, any output by gdb goes to /dev/null, and hence
the output is lost.
Fix this by restoring the original output streams, after gdb_interface
has handled the output
After this patch:
crash> info threads
Id Target Id Frame
* 1 2131 bash 0xc000000000051e40 in crash_fadump (regs=0x0, str=0xc000000002c60510 <buf> "sysrq triggered crash") at arch/powerpc/kernel/fadump.c:735
Cc: Sourabh Jain <sourabhjain@xxxxxxxxxxxxx>
Cc: Hari Bathini <hbathini@xxxxxxxxxxxxx>
Cc: Mahesh J Salgaonkar <mahesh@xxxxxxxxxxxxx>
Cc: Naveen N. Rao <naveen.n.rao@xxxxxxxxxxxxxxxxxx>
Cc: Lianbo Jiang <lijiang@xxxxxxxxxx>
Cc: HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab@xxxxxxx>
Cc: Tao Liu <ltao@xxxxxxxxxx>
Cc: Alexey Makhalov <alexey.makhalov@xxxxxxxxxxxx>
Signed-off-by: Aditya Gupta <adityag@xxxxxxxxxxxxx>
Signed-off-by: Tao Liu <ltao@xxxxxxxxxx>
---
gdb-10.2.patch | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/gdb-10.2.patch b/gdb-10.2.patch
index 3694b13..0bed96a 100644
--- a/gdb-10.2.patch
+++ b/gdb-10.2.patch
@@ -16118,3 +16118,56 @@ exit 0
subclass (SYMBOL_NONE)
{
/* We can't use an initializer list for members of a base class, and
+--- gdb-10.2/gdb/ui-file.h.orig
++++ gdb-10.2/gdb/ui-file.h
+@@ -195,6 +195,7 @@ public:
+
+ bool can_emit_style_escape () override;
+
++ FILE *get_stream(void);
+ /* Sets the internal stream to FILE, and saves the FILE's file
+ descriptor in M_FD. */
+ void set_stream (FILE *file);
+--- gdb-10.2/gdb/ui-file.c.orig
++++ gdb-10.2/gdb/ui-file.c
+@@ -161,6 +161,12 @@ stdio_file::~stdio_file ()
+ fclose (m_file);
+ }
+
++FILE*
++stdio_file::get_stream(void)
++{
++ return m_file;
++}
++
+ void
+ stdio_file::set_stream (FILE *file)
+ {
+--- gdb-10.2/gdb/symtab.c.orig
++++ gdb-10.2/gdb/symtab.c
+@@ -6964,8 +6964,12 @@ void
+ gdb_command_funnel_1(struct gnu_request *req)
+ {
+ struct symbol *sym;
++ FILE *original_stdout_stream = nullptr;
++ FILE *original_stderr_stream = nullptr;
+
+ if (req->command != GNU_VERSION && req->command != GNU_USER_PRINT_OPTION) {
++ original_stdout_stream = (dynamic_cast< stdio_file * >gdb_stdout)->get_stream();
++ original_stderr_stream = (dynamic_cast< stdio_file * >gdb_stderr)->get_stream();
+ (dynamic_cast<stdio_file *>gdb_stdout)->set_stream(req->fp);
+ (dynamic_cast<stdio_file *>gdb_stderr)->set_stream(req->fp);
+ }
+@@ -7068,6 +7072,12 @@ gdb_command_funnel_1(struct gnu_request *req)
+ req->flags |= GNU_COMMAND_FAILED;
+ break;
+ }
++
++ /* Restore the streams gdb output was using */
++ if (original_stdout_stream)
++ (dynamic_cast<stdio_file *>gdb_stdout)->set_stream(original_stdout_stream);
++ if (original_stderr_stream)
++ (dynamic_cast<stdio_file *>gdb_stderr)->set_stream(original_stderr_stream);
+ }
+
+ /*
--
Crash-utility mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxxxxxx
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines: https://github.com/crash-utility/crash/wiki