c - Pointer Value in Struct Changing Without Reassigning -


i'm getting following output gdb:

(gdb) print tid->rvm $28 = (rvm_t) 0x605010 (gdb) step 306     rlog->entries[i].sizes[num - 1] = size; (gdb) step 307 } (gdb) print tid->rvm $29 = (rvm_t) 0x64 (gdb) print tid $30 = (trans_t) 0x607b50 

this code tid structure:

struct _trans_t {     rvm_t rvm;               int numsegs;            segment_t* segments; }; 

the rvm_t rvm struct containing metadata recoverable virtual memory pager.

i don't believe allowed post full function code happening, because university assignment, can see single line of code change occurs, rlog->entries[i].sizes[num - 1] = size;. there no reference value changed. have use ugly typedefing pointers structs thing. assignment submission server contains header file as-is , can't edit it.

my question heck can cause this. tid passed parameter function rvm_about_to_modify(trans_t tid, void *segbase, int offset, int size). struct member rvm never touched inside function , can see step sequence has address 0x605010, correct address, , 1 line later, without reference either tid struct or rvm member, pointer changes address 0x64. actual tid pointer has not changed. keeps address 0x607b50 throughout.

i'm complete @ loss here , can't figure out cause tid->rvm change value without ever being touched. can tell, 0x64 address of interrupt vector table entry keyboard status register. appreciated.

edit:

here's requested updates. value of 0, value of num 1, value of rlog 0x607b30. rlog->entries[0] entry changes data segment name "testseg", size 10000 bytes, updatesize 300 bytes, numupdates 1, , pointers arrays of offsets, sizes, , data. rlog->entries[0].sizes[0] 100. data pointer 0x6051f0.

since cannot post full code, cannot explain in detail. however, assertion "tid->rvm [changes] value without ever being touched" self-contradictory. can structure member tid->rvm not changed via structure pointer tid, by thread being debugged.

supposing structure not live in shared memory , process single-threaded, possible conclusion tid->rvm or partially aliased rlog->entries[i].sizes[num - 1]. is, memory left-hand side of second expression refers overlaps first refers. there several ways happen, among them:

  • the tid and/or rlog pointer points wrong place
  • the current value of i outside bounds of array rlog->entries
  • the expression num - 1 outside bounds of array rlog->entries[i].sizes

those no means possibilities, ones among can guessed limited amount of code presented.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

node.js - How to abort query on demand using Neo4j drivers -