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

gdb and binutils branch master updated. b94ade42840d1b0fbf818db49d98da9ba80c1d53


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  b94ade42840d1b0fbf818db49d98da9ba80c1d53 (commit)
      from  d495ab0d843def702a6641fa4fc31708d7fc97b1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b94ade42840d1b0fbf818db49d98da9ba80c1d53

commit b94ade42840d1b0fbf818db49d98da9ba80c1d53
Author: Pierre Langlois <pierre.langlois@embecosm.com>
Date:   Tue May 20 15:13:20 2014 +0100

    Invalidate a register in cache when a remote target failed to write it.
    
    As shown by the bug report, GDB crashes when the remote target was unable to
    write to a register (the program counter) with the 'P' packet. This was reported
    for AVR but can be reproduced on any architecture with a gdbserver that fails to
    handle a 'P' packet.
    
    Issue
    =====
    
    This GDB session was done with a custom gdbserver patched to send an error
    packet when trying to set the program counter with a 'P' packet:
    
    ~~~
    (gdb) file Debug/ATMega2560-simple-program.elf
    Reading symbols from Debug/ATMega2560-simple-program.elf...done.
    (gdb) target remote :51000
    Remote debugging using :51000
    0x00000000 in __vectors ()
    (gdb) load
    Loading section .text, size 0x1fc lma 0x0
    Start address 0x0, load size 508
    Transfer rate: 248 KB/sec, 169 bytes/write.
    (gdb) b main
    Breakpoint 1 at 0x164: file .././ATMega2560-simple-program.c, line 39.
    (gdb) c
    Continuing.
    
    Program received signal SIGTRAP, Trace/breakpoint trap.
    main () at .././ATMega2560-simple-program.c:42
    42		DDRD |= LED0_MASK;// | LED1_MASK;
    (gdb) info line 43
    Line 43 of ".././ATMega2560-simple-program.c" is at address 0x178 <main+40> but contains no code.
    (gdb) set $pc=0x178
    Could not write register "PC2"; remote failure reply 'E00'
    (gdb) info registers pc
    pc             0x178	0x178 <main+40>
    (gdb) s
    ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed.
    A problem internal to GDB has been detected,
    further debugging may prove unreliable.
    Quit this debugging session? (y or n)
    ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed.
    A problem internal to GDB has been detected,
    further debugging may prove unreliable.
    Create a core file of GDB? (y or n)
    ~~~
    
    We can see that even though GDB reports that writing to the register failed, the
    register cache was updated:
    
    ~~~
    (gdb) set $pc=0x178
    Could not write register "PC2"; remote failure reply 'E00'
    (gdb) info registers pc
    pc             0x178	0x178 <main+40>
    ~~~
    
    The root of the problem is of course in the gdbserver but I thought GDB should
    keep a register cache consistent with the hardware even in case of a failure.
    
    Changes
    =======
    
    This patch adds routines to add a regcache_invalidate cleanup to the current
    chain.
    
    We can then register one before calling target_store_registers. This way if the
    target throws an error, the register we wanted to write to will be invalidated
    in cache. If target_store_registers succeeds, we can discard the new cleanup.
    
    2014-06-12  Pierre Langlois  <pierre.langlois@embecosm.com>
    
    	* regcache.c (struct register_to_invalidate): New structure.
    	(do_register_invalidate, make_cleanup_regcache_invalidate): New
    	functions.
    	(regcache_raw_write): Call make_cleanup_regcache_invalidate.

-----------------------------------------------------------------------

Summary of changes:
 gdb/ChangeLog  |    7 +++++++
 gdb/regcache.c |   43 ++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 47 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
gdb and binutils


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