From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19528 invoked by alias); 13 Nov 2013 06:48:38 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 19513 invoked by uid 89); 13 Nov 2013 06:48:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RDNS_NONE,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-wi0-f170.google.com Received: from Unknown (HELO mail-wi0-f170.google.com) (209.85.212.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 13 Nov 2013 06:48:36 +0000 Received: by mail-wi0-f170.google.com with SMTP id f4so1020724wiw.1 for ; Tue, 12 Nov 2013 22:48:27 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.180.39.140 with SMTP id p12mr19378157wik.12.1384325307585; Tue, 12 Nov 2013 22:48:27 -0800 (PST) Received: by 10.216.167.200 with HTTP; Tue, 12 Nov 2013 22:48:27 -0800 (PST) In-Reply-To: References: Date: Wed, 13 Nov 2013 06:48:00 -0000 Message-ID: Subject: Re: back into the thread.... From: Phi Debian To: Sterling Augustine Cc: Mark Manning , gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes X-SW-Source: 2013-11/txt/msg00058.txt.bz2 Hi All, Off topic about gdb discution > if (posix_memalign((void **) &dst, 4096*8, EXEC_BYTES) != 0) { > printf("can't allocate.\n"); > exit (-1); > } > if (mprotect(dst, EXEC_BYTES, PROT_READ|PROT_WRITE|PROT_EXEC) != 0) { > printf("can't mprotect\n"); > exit (-1); > } > memcpy(dst, bytes, EXEC_BYTES); > > return_val = dst(test_val); The above code as very little chance to execute on modernn architecture, at least with architecture with separate icache and dcache. The memcpy fill the dcache, the dst() read the icache, since the caches are not flushed in between, the dst() will execute garbage (well instruction living there before). As far as GDB is concerned, it should be able to single step in any memory area that is declared 'executable' > Also, the "can not access addres zero" error is totally bogus, Not if you consider your single step execute garbage instruction. Cheers, Phi