title: How do I get gdb to tell me memory characteristics a given address
body: <p>I have a gdb session for a core and it indicates that there's a segfault in a dereference of a pointer when reading one of its members.  The pointer is non-null in value.  I assume this means that the memory address was not accessible to the process. How do I get this information from a postmortem gdb session of the core?</p>
  
  <p>For instance, given the following program:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int
  main(int argc, char* argv[])
  {
      int *ptr = new int(5);
      cout &lt;&lt; "I can access it here: " &lt;&lt; *ptr &lt;&lt; endl;
  
      delete ptr;
  
      cout &lt;&lt; "But I shouldn't do so here: " &lt;&lt; *ptr &lt;&lt; endl;
      return 0;
  }
  </code></pre>
  
  <p>If I debug this program with gdb:</p>
  
  <pre><code>$ g++ -g -Wall test.cc -o test
  $ gdb ./test
  (gdb) b 13
  ...
  Breakpoint 1 at 0x400943: file test.cc, line 13.
  (gdb) run
  Starting program: /usr/home/nfs/bneradt/test/test
  I can access it here: 5
  
  Breakpoint 1, main (argc=1, argv=0x7fffffffe348) at test.cc:13
  13          cout &lt;&lt; "But I shouldn't do so here: " &lt;&lt; *ptr &lt;&lt; endl;
  (gdb)
  </code></pre>
  
  <p>What kind of memory information can I get from ptr?  Can I determine that ptr points to freed memory?  Since in the core I'm debugging (not in the toy test binary above) I got a seg fault dereferencing - i.e., reading from, not writing to - a pointer, I suppose the original memory location got paged out and therefore wasn't process-accessible memory?  Can I determine that from the gdb session?</p>