From: Aditya Kamath1 <Aditya.Kamath1@ibm.com>
To: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
"tom@tromey.com" <tom@tromey.com>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] Modify align-c/align-c++ test case for AIX
Date: Wed, 15 Mar 2023 11:52:25 +0000 [thread overview]
Message-ID: <CH2PR15MB3544BE6DD1900E5FC3468664D6BF9@CH2PR15MB3544.namprd15.prod.outlook.com> (raw)
In-Reply-To: <3636157c35660e96f2da98eb70cbac597d0a092c.camel@de.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 3473 bytes --]
Hi Ulrich, Tom and community,
>I don't think the problem is the ptrace call itself, it looks
>more like that the *address* is incorrect.
>It would be good to understand a bit better why this is happening.
>I thought on AIX global variables should reside in the TOC section,
>so I thought we should be able to get their address ...
>Can you look into more detail how the address of the
>global_variable symbol is being determined, and why
>we end up with an invalid value (0xffffffff)?
So my understanding is as follows. When we run the p global_variable command we call functions in the order print_command-> print_command_1-> print_value-> value::record_latest-> value::fetch_lazy-> value::fetch_lazy_memory-> read_value_memory…
In read_value_memory () we call target_xfer_partial() where we come rs6000-aix-target’s xfer partial. Since the read_buf value is set we call the ptrace call
buffer.word = rs6000_ptrace32 (PT_READ_I, pid,
(int *)(uintptr_t)rounded_offset,
0, NULL);
This set errno to 5.
Then the following value is returned.
if (errno)
return TARGET_XFER_EOF;
Then we go to read_value_memory () where these lines execute
else if (status == TARGET_XFER_EOF)
memory_error (TARGET_XFER_E_IO, memaddr + xfered_total);
In memory_error () we hit err=TARGET_XFER_E_IO in the switch case and print cannot access memory at 0xffffff.
>why
>we end up with an invalid value (0xffffffff)?
After we come out of xfer_partial from rs6000-aix-nat.c in read_value_memory () since we got TARGET_XFER_EOF so it executes
“else if (status == TARGET_XFER_EOF)
memory_error (TARGET_XFER_E_IO, memaddr + xfered_total);”
This ( memaddr + xfered_total ) is responsible for it. Memaddr was 18446744073709551615. This is itself FFFFFFFFFFFFFFFF.
This got assigned at CORE_ADDR addr = address (); in value::fetch_lazy_memory ()..
In the CORE_ADDR
value::address ()
the return value
is m_location.address + m_offset = -1 and that is 0xffffff in 2’s complement.
So this is what is happening.
Kindly let me know what you think about this and also about the fix I suggested to the align test case with the patch attached in the previous email sent by me.
Thanks and regards,
Aditya.
From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Date: Monday, 13 March 2023 at 7:40 PM
To: gdb-patches@sourceware.org <gdb-patches@sourceware.org>, Aditya Kamath1 <Aditya.Kamath1@ibm.com>, tom@tromey.com <tom@tromey.com>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] Modify align-c/align-c++ test case for AIX
Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:
>(gdb) p global_variable
>ret = -1
>ret = -1
>Cannot access memory at address 0xffffffff
>
>This ret = -1 is a printf(“ret = %d\n”, ret) statement I have
>used within my rs6000-aix-nat.c code to check what my ptrace call returns..
I don't think the problem is the ptrace call itself, it looks
more like that the *address* is incorrect.
It would be good to understand a bit better why this is happening.
I thought on AIX global variables should reside in the TOC section,
so I thought we should be able to get their address ...
Can you look into more detail how the address of the
global_variable symbol is being determined, and why
we end up with an invalid value (0xffffffff)?
Bye,
Ulrich
next prev parent reply other threads:[~2023-03-15 11:52 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 8:57 Aditya Kamath1
2023-03-10 14:46 ` Tom Tromey
2023-03-13 13:04 ` Aditya Kamath1
2023-03-13 14:10 ` Ulrich Weigand
2023-03-15 11:52 ` Aditya Kamath1 [this message]
2023-03-15 12:45 ` Tom Tromey
2023-03-16 7:01 ` Aditya Kamath1
2023-03-17 17:06 ` Ulrich Weigand
2023-03-17 22:03 ` Tom Tromey
2023-03-21 7:01 ` Aditya Kamath1
2023-03-21 7:41 ` Ulrich Weigand
2023-03-21 11:05 ` Pedro Alves
2023-03-21 14:17 ` Tom Tromey
2023-03-21 14:26 ` Ulrich Weigand
2023-03-29 11:28 ` Aditya Kamath1
2023-03-29 13:36 ` Pedro Alves
2023-03-31 12:29 ` Aditya Kamath1
2023-04-04 13:24 ` Aditya Kamath1
2023-04-05 16:33 ` Pedro Alves
2023-04-06 13:15 ` Aditya Kamath1
2023-04-06 16:18 ` Pedro Alves
-- strict thread matches above, loose matches on Subject: below --
2023-03-10 8:56 Aditya Kamath1
2023-03-10 10:08 ` Aditya Kamath1
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CH2PR15MB3544BE6DD1900E5FC3468664D6BF9@CH2PR15MB3544.namprd15.prod.outlook.com \
--to=aditya.kamath1@ibm.com \
--cc=Ulrich.Weigand@de.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=sangamesh.swamy@in.ibm.com \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).