Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Andrew Greenlaw <andrewg@agere.com>
Cc: gdb@sources.redhat.com
Subject: Re: "Cannot access memory at address 0x175f80"
Date: Fri, 26 Sep 2003 17:50:00 -0000	[thread overview]
Message-ID: <20030926174934.GB23276@nevyn.them.org> (raw)
In-Reply-To: <3F747A00.3090302@agere.com>

On Fri, Sep 26, 2003 at 01:40:16PM -0400, Andrew Greenlaw wrote:
>  Hi.  I'm debugging a C++ tool (called apple) that's loaded as a 
> dynamic library into a C - or C++ program (called orange) .  Apple is 
> compiled with g++ 3.3.1, binutils 2.14, and debugging symbols are 
> enabled.  Orange is a big unknown (meaning:  I don't know how it was 
> compiled) and it has no debugging symbols.  The gdb version is 5.3
> 
>    Here are the flags used to compile Apple:
> # -gdwarf-2 -g3 used to enable stepping through macro execution under 
> gdb 5.3  The explanation's under gdb 5.3 release notes.
>    Compile:g++  -std=c++98 -Wall -DLINUX -gdwarf-2 -g3      -D__USE_GNU 
> -D_GNU_SOURCE -fPIC file_name.cpp
> 
> 
>    Link:
>    g++ -shared $(LIBS) $(OBJSCHEF)  $(PLIOBJSVCS_PLI) 
> InterfaceObjectVCS_PLI.o -o $@    -lc   gdwarf-2 -g3 -fPIC
> g++  -MD -std=c++98  -shared -lc -gdwarf-2 -g3  -fPIC <object files>  -o 
> libapple.so   
> 
>    When I go to debug apple, I run "gdb <program name>", then use the 
> "add-symbol-file <apple's path & filename> -readnow" gdb comman to load 
> the symbols from apple.  From there, I can set breakpoints in C++ class 
> methods, no problem.  But, there is 1 function (so, non-OO code), where 
> if I try to set a breakpoint, I get the following:
> 
>    (gdb) break nc_signal_raised
> Cannot access memory at address 0x175f80
> 
>    If I do an "nm" on the library, I get:
>    00175f80 T nc_signal_raised
> 
>    Indicating that the address read by gdb is correct.

Unlikely, since the library is not loaded at a base address of 0.

>    On a related, but less important note, when use ddd to debug & go to 
> a source file, I always get:  "<src_file_name>" is at address 0x10f5f0 
> <part_of_src_file_name> but contains no code.
> 
>    And yet I can set breakpoints or step through the code.  What's 
> going on?
> 
>    Any help you can offer will be appreciated.  I've been working on 
> this for 2 weeks, read every posting or piece of documentation I can 
> find.  I'm at my wits' end!

Why are you using add-symbol-file?  Is the loader not done as a dlopen,
i.e. are you dealing with something that has its own dynamic loader? 
If it's dlopen'd, gdb should automatically handle it.

It seems unlikely that add-symbol-file without specifying a text offset
is right, too.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2003-09-26 17:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-26 17:46 Andrew Greenlaw
2003-09-26 17:50 ` Daniel Jacobowitz [this message]
2003-09-26 18:39   ` Andrew Greenlaw
2003-09-26 18:39     ` Daniel Jacobowitz

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=20030926174934.GB23276@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=andrewg@agere.com \
    --cc=gdb@sources.redhat.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