This is the mail archive of the gdb-patches@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]

[commit] Fix crash at gdbtui startup


Pierre Muller wrote:

>   gdbtui generates an internal error
> due to a call to paddress with NULL gdbarch
> in tui_make_status_line.

Oops.

>   Shouldn't paddress simply use sizeof(CORE_ADDR) if gdbarch is NULL?

I think in this case the reason we don't know the architecture
associated with the PC is that we don't know the PC in the first
place!   The code currently simply displays "0x0" because that's
what the data structure is initialized with.

IMO we should be displaying "??" if we don't know the PC, just as
we do in the line number field if we don't know a line number.

The following patch implements this and fixes the crash.
Checked in to mainline.

Bye,
Ulrich


ChangeLog:

	* tui/tui-stack.c (tui_make_status_line): Display PC as ?? if unknown.

Index: gdb/tui/tui-stack.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-stack.c,v
retrieving revision 1.31
diff -c -p -r1.31 tui-stack.c
*** gdb/tui/tui-stack.c	2 Jul 2009 17:21:10 -0000	1.31
--- gdb/tui/tui-stack.c	8 Jul 2009 12:00:19 -0000
*************** tui_make_status_line (struct tui_locator
*** 103,109 ****
  
    /* Translate PC address.  */
    pc_out = tui_sfileopen (128);
!   fputs_filtered (paddress (loc->gdbarch, loc->addr), pc_out);
    pc_buf = tui_file_get_strbuf (pc_out);
    pc_width = strlen (pc_buf);
    
--- 103,110 ----
  
    /* Translate PC address.  */
    pc_out = tui_sfileopen (128);
!   fputs_filtered (loc->gdbarch? paddress (loc->gdbarch, loc->addr) : "??",
! 		  pc_out);
    pc_buf = tui_file_get_strbuf (pc_out);
    pc_width = strlen (pc_buf);
    





-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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