Questions tagged [memory-address]
A number used to indicate a particular location in computer's memory. May also refer to how to access these addresses in memory.
1,797
questions
0
votes
1
answer
59
views
I am unable to access a memory address given in a string
So my problem is that i have to read the content of a file into the buffer (that is a void*).
I searched a lot and I can't find any information about converting the memory address in the string to an ...
1
vote
1
answer
42
views
A weird question about fork() and physical address in Linux
A professor who teaches Linux sent his students this weird question...
The weird thing is that, this program will give an output where the parent process and the child process will get the same ...
0
votes
1
answer
95
views
Why is the address of the variable changing here?
I am experimenting with pointers to get a better grip of it and I encountered this situation here:
I declared a variable var and two pointers. I was printing var's address to compare it with the two ...
1
vote
1
answer
43
views
Array subscripting and pointer arithmetics in C give different result
I am getting different memory address (invalid one) when trying to obtain the address of the value located inside of an array when using array subscript syntax as opposed to when using pointer ...
0
votes
1
answer
33
views
Page table in memory addressing vs page table in virtual memory
memory addressing = concept in which when os gives cpu a process to execute, it allocates a portion of ram for that process and cpu generates virtual addresses for that portion. the mapping between ...
0
votes
1
answer
77
views
Initialise type from address
I want to initialise a type from a System.address. For example :
generic
type T_Generic is private;
package MyPackage is
G_Addr : System.Address;
procedure Register (myAddr : System....
0
votes
0
answers
65
views
Datasheet says EEPROM address is 0xA0 but it worked for me on 0x50. Is there a particular reason to right-shift bits?
I read the device data of the SFP Optical Transceiver module using it's EEPROM. This image shows that the EEPROM's address is 0xA0, but it didn't work for me. It worked when I entered the address as ...
0
votes
0
answers
32
views
What would be the hexadecimal representation of the largest memory address in a memory consisting of 4MB if each cell had a one-byte capacity?
What would be the hexadecimal representation of the largest memory address in a memory consisting of 4MB if each cell had a one-byte capacity?
Since 4MB is equal to 4*1,000,000 Bytes, can I assume ...
0
votes
0
answers
20
views
What are "Global Pages" for? (Intel x86 processors) [duplicate]
Disclaimer: this is a repost from superuser, due to a comment that the question might be more suitable for Stack Overflow.
In Intel Software Developer's Manual (Intel 64 and IA-32 Architectures ...
1
vote
1
answer
163
views
Why does 0x not appear when I print a memory address in C?
I'm trying to print a memory address in C, this is the code I'm using
#include <stdio.h>
int main() {
int v = 10;
printf("Address of the v: %p\n",&v);
return 0;
}
...
0
votes
1
answer
88
views
How to assign an Address, contained inside a string, to a pointer in C
I am currently trying to develop a Linux Ubuntu Kernel Module (as part of my task), which is basically installs a watchpoint on address, specified as a string parameter *(char ) to the module.
...
0
votes
0
answers
44
views
Memory address printed in c++ not hexadecimal for a char [duplicate]
Here is a Minimum Reproducible Example:
#include <iostream>
#include <string>
int main()
{
int givenInt;
float givenFloat;
double givenDouble ;
std::string givenString;
...
-1
votes
1
answer
94
views
passing buffer pointers to read accelerometer data results in 2 out of 3 correct readings
I am working with accelerometers and reading FIFO data. Writing code in C/C++, Platformio Arduino framework for esp32. I created some functions to access FIFO data of all 3 axis:
void Get_FIFO_data_16(...
0
votes
4
answers
131
views
Does the address & operator return a pointer in C?
The IMB documentation says : "The & (address) operator yields a pointer to its operand. The operand must be an lvalue, a function designator, or a qualified name. It cannot be a bit field&...
-2
votes
2
answers
54
views
Is dereferencing a variable address the same as dereferencing a variable of type pointer that contains that address?
Consider this code :
int main(){
int a = 10;
int* p = &a;
//case 1
*(&a);
*p;
//case 2
*((&a) + 1);
*( p + 1 );
}
Are the two forms the same ?
...
1
vote
1
answer
77
views
Is the identifier of a C array converted to a pointer to the first element of the array or to the address of the first element of the array?
A C book says "When an array identifier appears in an expression, the type of the identifier is converted from "array of T' to "pointer to T," and the value of the identifier is ...
-3
votes
2
answers
49
views
Does the original list decrease in size when I convert a list to a queue and poll?
Assume I have an array list like
List<Integer> list = [1,2,3,4]; // ignore the syntax here
Then I convert the collection to a queue
Queue<Integer> queue = new LinkedList(list);
Then I do
...
0
votes
0
answers
25
views
Python display "Memory Address not Object List"?
I am trying to output conflict between class of class scheduling problem using hill climbing algorithm, but it keep showing memory address in the second column when method "conflict....
0
votes
1
answer
94
views
Define address depending on target
I have a gpr project with 2 targets :
mySources := "My project files"
case Rules.Target is
when "CASE1" =>
mySources := "File1" & mySources
when ...
-2
votes
3
answers
96
views
How two different values can store in one memory space in C language? [closed]
In the below code in 7th and 8th line the variables are taking same address space but in 9th and 10th line I can see the values are different. and I compared the address as well and it's showing same ...
-1
votes
1
answer
78
views
How to display a C++ char variable's memory address? [duplicate]
While practicing with C++, I tried to display a char variable's address with the & operator, but I see a meaningless line of characters instead of a memory address.
Below is the complete program:
#...
-3
votes
2
answers
89
views
C++ Pass-by-value, shouldn't the memory_addresses of the two variables be copied and binded into different places?
I'm practicing C++, and facing the Pass-by-value/reference topic. What I learned from BroCode is that, when we call a swap function by the parameters' value, both of their memory_addresses will be ...
0
votes
1
answer
172
views
Adding Offset to Address in C# results in different Address than in Cheat Engine
I followed a tutorial on how to find offsets for a specific value of a game in Cheat Engine. I found the offset and now i want to read it in C#.
"ac-client.exe" = 0x00400000
If i put the ...
0
votes
0
answers
29
views
Force an external function to be at a specified address on MSVC
My plan is to patch an xbox 360 game, at first by simply overwriting the function's bytes. With ghidra I decompiled a simple function that I can recompile to the exact same assembly (using cl.exe /c /...
2
votes
0
answers
56
views
cmpl of a constant to the value in the register looks correct but fails
I am debugging some assembly code and have a comparison that fails even though the constant value of 1 is equal to the value in the register it is being compared to.
Here is the compare:
=> ...
1
vote
1
answer
51
views
How to print a string from address and size
I want to print a string from address by for loop.
Below is the code that I wrote, but it gives different results when running normally and when debugging.
How can I print each char of str ...
1
vote
1
answer
124
views
Getting absolute address of data in shellcode
Here's my shellcode:
xor rax, rax
xor rdi, rdi
xor rsi, rsi
xor rdx, rdx
; getting address of `pathname`
mov rdi, [something]
mov al, 59
mov rdi, rsp
syscall
...
1
vote
1
answer
60
views
Why address difference between Unicode is incorrect here? [duplicate]
Look at the code below,
#include<Windows.h>
#include<tchar.h>
int main()
{
TCHAR szStr[] = TEXT("C++中文你好");
printf("sizeof(szStr) = %u\n", sizeof(szStr)); //16
...
0
votes
0
answers
30
views
OriginalFirstThunk in memory
I understand the point of IAT/IDT/ INT and dynamically loaded DLLs at runtime. The OriginalFirstThunk in the Import Directory table refers to the function names stored (in the case of an ordinal) in ...
0
votes
1
answer
117
views
Get source location for address at runtime using debug information
In my C program, I have an instruction pointer that points to some address in virtual memory, e.g., a function pointer.
I would like to map this address to the corresponding source location (file path,...
1
vote
1
answer
83
views
What does this code printing addresses on the stack mean?
I did this trying to understand addresses in Rust. It was part of a more complicated experiment. But
first, I'd like to understand this.
fn main () {
let mut b = 3;
println!("in main ...
0
votes
0
answers
90
views
Direct Mapping of 8GByte memory with 64-bit addressable word size
The question: A computer has 8 GByte of memory with 64-bit addressable word sizes. Each block of memory stores 16 words. The computer has a direct-mapping cache of 128 blocks
Calculate the tag bits, ...
1
vote
1
answer
76
views
How to align memory address of Windows x64 C++ global variable
I want the address of the global variable I create to be a multiple of 0x1000.
sample
char alignstr[0x100] = "this is align string";
int main()
{
printf("var address = [%p]", &...
0
votes
1
answer
60
views
Are `.text` and `.data` really the same?
In the documentation for the Linux syscall ptrace, I saw the following text:
--snip--
Linux does not have separate text and data address space, so
--snip--
To what extent is this really the case? ...
0
votes
1
answer
39
views
Unexpected .data memory address in MIPS, can't print proper asciiz character
I'm trying to print an array with its characters separated by a comma, for example: {1, 2, 3...} To achieve this I declared a variable separator: .asciiz ", " in my .data section of the code....
1
vote
0
answers
113
views
visualization of pointers in memory
Being a beginner in C, I was aware that pointers are a special data type used to store the address of a data type. If I calculate size of any pointer in my PC (64-bit OS) it's 8 bytes.
In memory ...
1
vote
2
answers
123
views
Why does printf changes the address of a function pointer?
Adressing operator inside the printf changes the address of the function pointer from a regular adress to 0x1000. Why this happens and what does it mean ?
#include <stdio.h>
int main()
{
int ...
0
votes
1
answer
23
views
Python Nested Lists: Referenced vs. Copied/Created Elements
Python Nested Lists: Referenced vs. Copied/Created Elements
Hey there,
I'm struggling to understand when Python nested lists reference elements and when they copy or create them. For instance, this ...
-1
votes
1
answer
104
views
How to interpret "ln" cmd output (WinDbg)?
I'm trying to find where the app faulted using 'ln' cmd which is normally supposed to help with that. 47a6c6 is the fault offset reported in the logs. I'm just wondering what I have to do with that ...
1
vote
1
answer
67
views
RAM address pins and data output for byte and word level addresses
I'm wondering if RAM is typically byte or word level addressed, and I think the answers about it I can find are contradictory. I'm aware different RAM might have different designs, and just wonder in ...
-1
votes
1
answer
107
views
runtime error: member access within misaligned address (leetcode 2nd question)
I have been trying to solve leetcode 2nd problem "Add two numbers" using "C" as the programming language. The problem question is as below.
You are given two non-empty linked ...
-1
votes
1
answer
134
views
PTRACE_TRACEME - Operation not permitted error?
I try to develop my own debugger.
I used in child space the code:
//child process asks the OS kernel to let its parent trace it
if (ptrace(PTRACE_TRACEME, 0, NULL, NULL) == -1) {
perror("...
1
vote
1
answer
68
views
Can't assign a variable to the desired memory location
I'm new to assembly. I'm trying to move some numbers into the memory locatons starting from 0800:0010 but couldn't figure it out.
Here's the code:
.data
NUM0 DB 00H
NUM1 DB 22H
NUM2 DB ...
0
votes
0
answers
29
views
Why this problem occurs? or Is it even a problem? [duplicate]
#include<iostream>
using namespace std;
int main()
{
char a[5];
cout << sizeof(a) << endl <<&a[0] << endl <<&a[1] << endl <<&a[2] &...
0
votes
0
answers
20
views
Finding address location with jump instruction [duplicate]
Assume Loop is at location 0xAB94258 and at 0xAB894264 we have a j loop instruction. How can we know the value of the label 'Loop'?
i tried switching it to binary and shifting right twice "target ...
3
votes
3
answers
88
views
How does subtracting an address reference work?
I think the value of z should be 40 because a[5] has 20 elements, and the space between it and a[3] also has 20 elements. However, the actual value of z is 2.
Can anyone explain this concept?
#include ...
0
votes
2
answers
91
views
How to define a new debugflag in gem5?
gem5 version:v21.2.0.0,add a new debugflag in src/mem/cache/SConscript,
recompile with scons/build/ARM/gem.opt,
and in build/ARM/debug file still don't have new debugflag.hh
in this version, how to ...
-5
votes
1
answer
99
views
What does a period do between a variable and an array? [duplicate]
I'm learning C and trying to understand what the period "." is doing with the variables x and a; what is this operation called, and what does it do?
Here is the full code:
#include <stdio....
0
votes
0
answers
24
views
How do memory addresses function in relation to the cache?
In my computer systems class, we are learning about cache memories, unfortunately I was sick for 5 days, so I missed a few days of class and am kinda lost. The following question is from a homework ...
0
votes
1
answer
60
views
Jump addressing from PC to a target [duplicate]
Suppose we needed to jump to the memory address 0xAE87698C.
If the current PC value is 0xAF70018B show the j instruction to perform the jump
(display it as both a 32-bit binary number and as an ...