From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 39236 invoked by alias); 26 Mar 2015 16:48:33 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 39209 invoked by uid 48); 26 Mar 2015 16:48:33 -0000 From: "mail at cristos dot x25.pl" To: gdb-prs@sourceware.org Subject: [Bug gdb/18168] New: "set write on" or "--write" corrupt the binary file Date: Thu, 26 Mar 2015 16:52:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: mail at cristos dot x25.pl X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-q1/txt/msg00499.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=18168 Bug ID: 18168 Summary: "set write on" or "--write" corrupt the binary file Product: gdb Version: HEAD Status: NEW Severity: critical Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: mail at cristos dot x25.pl Created attachment 8213 --> https://sourceware.org/bugzilla/attachment.cgi?id=8213&action=edit the hexdumps of a binary file before and after executing commands in the description When enabling binary patching via "set write on" command or "--write" command line switch, the exectuable loaded becomes corrupted. Try executing: $ gdb --write a_binary_file (gdb)quit # ./a_binary_file bash: ./a_binary_file: cannot execute binary file: Exec format error Careful examination of the binary shows this: # file ./a_binary_file a_binary_file: data # readelf -a ./a_binary_file readelf: Error: Not an ELF file - it has the wrong magic bytes at the start Attached are the hexdumps of the files before and after executing "gdb --write" and quitting gdb immediately -- You are receiving this mail because: You are on the CC list for the bug.