qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-arm] Regarding some issues with gdb


From: Sayandeep Saha
Subject: Re: [Qemu-arm] Regarding some issues with gdb
Date: Thu, 9 Aug 2018 07:36:11 +0530

I tried this thing by modifying the permission of the ELF. Precisely, I used the flags -Wl, -N during compilation and also used static linking. Also, I tried objcopy --writable-text and modified the write permission of the .text section of the ELF. But that did not worked. Is there any other thing to try with?

On Thu, Aug 9, 2018, 12:23 AM Peter Maydell <address@hidden> wrote:
On 8 August 2018 at 17:50, Sayandeep Saha <address@hidden> wrote:
> I successfully made all these changes on my X86-64 Intel machine. However,
> for ARM I tried with QEMU. The test case was a simple C program for
> calculating factorials using loops. I ran the following commands:
>
> Compilation:
> arm-linux-gnueabi-gcc -g -static -Xlinker -N -mthumb -masm-syntax-unified
> factorial.c -o factorial
>
> Run:
> qemu-arm -g 1234 -L /usr/arm-linux-gnueabihf/ ./factorial
>
> Next, I invoked gdb-multiarch from another shell to debug the program.
>
>
> However, when I try to change some instruction using "set" command of GDB,
> it says "The memory location cannot be accessed".
> Surprisingly, I can print the already existing contents of those memory
> locations using gdb's print command. Also, I could modify register values
> successfully.
>
> I am really confused and wander whether it is possible to change memory
> contents within QEMU, or not. If it is possible, what is the step by step
> procedure for that.

I don't think that this should vary between guest architectures.
Is the memory area you are trying to modify actually writable?
If it is part of the ELF executable you are running, then it
might depend on what the memory permissions the ELF file sets up
are (ie if it's read-only). I haven't checked that.

thanks
-- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]