[Barrelfish-users] Debugging symbols

Baumann Andrew andrewb at inf.ethz.ch
Mon Jun 4 19:59:58 CEST 2012


Hi Patrik,

The fundamental problem I think you're having is that you're trying to use a system-wide GDB interface (e.g. qemu) to debug a single application, where GDB doesn't see or know about the context switches. So when you set your breakpoint, you've probably enabled it in some other program that happened to be the one running at the time, not in netd. I'm not aware of any mechanism that will help you use GDB this way -- at best, you can use it to inspect memory or look at stack traces when something faults. If you want to place a breakpoint in a specific program, the easiest thing to do is probably going to be manually inserting a breakpoint (e.g. int 3) in that program's code and recompiling it.

Andrew

-----Original Message-----
From: Patrik Eklöf [mailto:peklof at kth.se] 
Sent: Monday, 04 June, 2012 10:44
To: Peter Simon
Cc: barrelfish-users at lists.inf.ethz.ch; Kornilios Kourtis
Subject: Re: [Barrelfish-users] Debugging symbols

OK, so I got it working with gdb now.
But I can't seem to get it to break at the point I want it to. It's the same problem I faced before.
I included the gdb snippet I worked with. I made some mistakes along the way, but I think it shows how I did it.

(gdb) symbol-file ~/bf_symbols/netd
Reading symbols from /afs/isk.kth.se/home/p/peklof/bf_symbols/netd...done.
(gdb) dir ~/source/
Source directories searched: /afs/isk.kth.se/home/p/peklof/source:$cdir:$cwd
(gdb) l
58      */
59
60
61      /****************************************************************************
62       * netd main function
63       ***************************************************************************/
64      void netif_debug_print_list(void);
65
66      int main(int argc, char **argv)
67      {
(gdb) s
306             wrapper_send_sp_notification_from_app(b);
(gdb) l
301
302         if (spp_send->notify_other_side != 0) {
303
304             // It seems that there we should send a notification to other side
305             spp_send->notify_other_side = 0;
306             wrapper_send_sp_notification_from_app(b);
307         }
308
309         // check and process any tx_done's
310         sp_process_tx_done(false);
(gdb) break idc_barrelfish.c:304
Breakpoint 1 at 0x41f809: file ../source/lib/lwip/src/barrelfish/idc_barrelfish.c, line 304.
(gdb) c
Continuing.

Breakpoint 1, idc_send_packet_to_network_driver (p=0x0)
    at ../source/lib/lwip/src/barrelfish/idc_barrelfish.c:305
305             spp_send->notify_other_side = 0;
(gdb) l
300         assert(spp_send != NULL);
301
302         if (spp_send->notify_other_side != 0) {
303
304             // It seems that there we should send a notification to other side
305             spp_send->notify_other_side = 0;
306             wrapper_send_sp_notification_from_app(b);
307         }
308
309         // check and process any tx_done's
(gdb) break ../source/usr/netd/idc_barrelfish.c:304
Breakpoint 2 at 0x4028d0: file ../source/usr/netd/idc_barrelfish.c, line 304.
(gdb) c
Continuing.

Breakpoint 1, idc_send_packet_to_network_driver (p=0x0)
    at ../source/lib/lwip/src/barrelfish/idc_barrelfish.c:305
305             spp_send->notify_other_side = 0;
(gdb) delete 1
(gdb) c
Continuing.
Remote communication error: Connection reset by peer.
(gdb)

Yet, it did not stop at idc_barrelfish.c:304 (setup_dhcp_timer(); in my source for anyone wondering).
It went all the way to the fish prompt without stopping.

Any ideas?

Regards,
Patrik Eklöf
Student at ICT, Master of Science in Engineering Education, IT Programme, KTH, Kista

________________________________________
From: Simon Peter [speter at inf.ethz.ch]
Sent: Monday, June 04, 2012 16:39
To: Patrik Eklöf
Cc: Kornilios Kourtis; barrelfish-users at lists.inf.ethz.ch
Subject: Re: [Barrelfish-users] Debugging symbols

How do you know you're debugging /sbin/netd?

A common problem we faced with simulator debugging is that the debugger
does not know it is debugging user code multiplexed by an operating
system, so it would just stop at the specified location whenever the
instruction pointer ends up there.

A good way to check is to look at your stack. Does it show a valid call
chain for the binary you expect to debug?

Simon

On 04.06.2012 13:45, Patrik Eklöf wrote:
> Well, I haven't been able to fully get symbolic debugging to work, so I can't say specifics I am missing which I need, but I have noticed some symbols missing, so I am going to use them as an example.
>
> At address 0x00000000004028d1, /source/usr/netd/idc_barrelfish.c seems to be loaded (so /sbin/netd then).
> The very first assembly instruction I see is call 0x46d270, which jumps into some unknown location.
>
> [cpu0] cs:0x000000000046d270 p:0x0005be6270  push rbp
> interdisp_ump_send_handler () in interdisp_flounder_bindings.c
> simics>  whereis -d 0x000000000046d270
> Address 0x46d270 is not in any known location.
>
> At this point, it seems to mess up. It LOOKS like some information is missing, but I can't be sure, so I figured I'd ask.
> I can't see any source for this location and I seem to be unable to get any information about what source file and line it's associated with.
> At this point, symbolic debugging just breaks down. It stops working correctly.
>
> I haven't yet tried gdb, however (have not been able to get it to read symbols from the binaries; it complains it can't read them).
> This is sort of a little game where I have to find out if the culprit is the simulator or the OS.
> So this may be a little premature, and if so, I apologize.
>
> Regards,
> Patrik Eklöf
> Student at ICT, Master of Science in Engineering Education, IT Programme, KTH, Kista
>
> ________________________________________
> From: Kornilios Kourtis [kornilios.kourtis at inf.ethz.ch]
> Sent: Monday, June 04, 2012 13:03
> To: Patrik Eklöf
> Cc: barrelfish-users at lists.inf.ethz.ch
> Subject: Re: [Barrelfish-users] Debugging symbols
>
> Hi Patrik,
>
> On Mon, Jun 04, 2012 at 08:29:08AM +0000, Patrik Eklöf wrote:
>> Hi all,
>>
>> I am trying to get debugging symbols for entire Barrelfish in order to
>> debug in more easily.  I managed to load symbols from all the
>> executables in /sbin, but it doesn't seem to be all of them. Some are
>> missing, such as the libraries (reent is one of them, I think).  So my
>> questions are as follows: Do I have to do something more in order to
>> produce debugging symbols for all the source code than just compiling
>> Barrelfish with the default settings?  What other files, if any, should
>> I load symbols from, other than /sbin in order to get all the debugging
>> symbols for the entire BF?
>
> Since in barrelfish libraries are not dynamically loaded, all debugging
> symbols should be in the binaries themselves. What are the symbols you
> seem to be missing?
>
> cheers,
> Kornilios.
>
>
> --
> Kornilios Kourtis
>
> _______________________________________________
> Barrelfish-users mailing list
> Barrelfish-users at lists.inf.ethz.ch
> https://lists.inf.ethz.ch/mailman/listinfo/barrelfish-users


_______________________________________________
Barrelfish-users mailing list
Barrelfish-users at lists.inf.ethz.ch
https://lists.inf.ethz.ch/mailman/listinfo/barrelfish-users



More information about the Barrelfish-users mailing list