From 07dff29d4af8af693a5b8bd1442d5b57a7812de8 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sat, 29 Jan 2022 09:50:15 -0800 Subject: [PATCH] guest-gdb: remove redundant error-checking --- applets/compiler_vm/guest/bin/guest-gdb | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/applets/compiler_vm/guest/bin/guest-gdb b/applets/compiler_vm/guest/bin/guest-gdb index 38dfe45a..520e70f3 100755 --- a/applets/compiler_vm/guest/bin/guest-gdb +++ b/applets/compiler_vm/guest/bin/guest-gdb @@ -302,7 +302,6 @@ sub get_backtrace($context) { foreach my $output (@$console) { last if $output->{_type} eq RESULT; - #0 0x0000555555555995 in bar () at prog3.c:18\n $output->{_text} =~ /in (\w+) (.*) at/; push @backtrace, { func => $1, args => $2 }; } @@ -375,11 +374,6 @@ sub cmd_gdb($context, $command) { my $text = ''; foreach my $output (@$console) { - if ($output->{_class} eq 'error') { - print_gdb_output($context, $output->{msg}); - last; - } - last if $output->{_type} eq RESULT; $text .= "$output->{_text}\n"; } @@ -393,11 +387,6 @@ sub cmd_ptype($context, $args) { my $text = ''; foreach my $output (@$console) { - if ($output->{_class} eq 'error') { - print_gdb_output($context, $output->{msg}); - last; - } - last if $output->{_type} eq RESULT; if ($output->{_text} =~ /type\s*=\s*(.*)/) { @@ -415,11 +404,6 @@ sub cmd_whatis($context, $args) { my $console = gdb_send_and_read_console($context, "whatis $args"); foreach my $output (@$console) { - if ($output->{_class} eq 'error') { - print_gdb_output($context, $output->{msg}); - next; - } - last if $output->{_type} eq RESULT; if ($output->{_text} =~ /type\s*=\s*(.*)/) { @@ -432,11 +416,6 @@ sub cmd_print($context, $args) { my $console = gdb_send_and_read_console($context, "print $args"); foreach my $output (@$console) { - if ($output->{_class} eq 'error') { - print_gdb_output($context, $output->{msg}); - next; - } - last if $output->{_type} eq RESULT; if ($output->{_text} =~ /^\$\d+\s*=\s*(.*)/) { @@ -652,10 +631,10 @@ sub run_program($context) { sub main { # first command-line argument can override file to debug - my $prog = $ARGV[0] // 'prog'; + my $prog = $ARGV[0] // './prog'; # start gdb and grab references to its input and output streams - open2(my $out, my $in, "LIBC_FATAL_STDERR=1 MALLOC_CHECK_=1 gdb -i mi3 -q -nx ./$prog"); + open2(my $out, my $in, "LIBC_FATAL_STDERR=1 MALLOC_CHECK_=1 gdb -i mi3 -q -nx $prog"); my $context = { gdb_output => $out, # gdb output stream