This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug python/19288] need a way to see if an address is covered by some existing object


https://sourceware.org/bugzilla/show_bug.cgi?id=19288

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
This worked ok for me, but it's a big hack.

static PyObject *
gdbpy_text_address_claimed (PyObject *self, PyObject *args)
{
  gdb_py_ulongest pc;
  struct objfile *objfile;
  struct obj_section *osect;

  if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc))
    return NULL;

  ALL_OBJSECTIONS (objfile, osect)
  {
    /* Only process each object file once, even if there's a separate
       debug file.  */
    if (objfile->separate_debug_objfile_backlink)
      continue;

    if (obj_section_addr (osect) <= pc && pc < obj_section_endaddr (osect))
      {
        Py_RETURN_TRUE;
      }
  }

  Py_RETURN_FALSE;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]