Subject: 26.3; GDB doesn't draw breakpoints with <MULTIPLE> addresses/locations

From: Niall Ryan <[email-masked]>
Date: Sat, 29 May 2021 17:54:07 +0100

------
Bug Description:

Issue:
'gdb' with gdb-many-windows, fails to draw breakpoints in the bar

on the left of each window if the gdb breakpoint has <MULTIPLE>
addresses/multiple locations.

<MULTIPLE> addresses can occur if a shared library breakpoint is set.

The issue appears to manifest in the function gdb-place-breakpoints()

- For each breakpoint, the function uses
        (bindat-get-field breakpoint 'line)
   to determine the linenumber of the breakpoint
- However, this fails for breakpoints as the line field (if
   present), is at a lower level of the list tree, in one of the items in
   the sublist "locations"

Example:

Note: I am creating these breakpoints as follows. On gdb
startup, the shared library symbols are loaded and set with:
- add-symbol-file -readnow handmade.so
- b handmade.cpp:224
The breakpoint will initially be drawn in the relevant buffer

The value of gdb-breakpoint-list is at first:

((#1="1"
(number . #1#)
(type . "breakpoint")
(disp . "keep")
(enabled . "y")
(addr . "0x000000000000c168")
(func . "GameUpdateAndRender(game_memory*, game_input*, 
game_render_commands*)")
(file . "../cpp/code/handmade.cpp")
(fullname . "/home/niall/software/handmadehero/sdl/cpp/code/handmade.cpp")
(line . "224")
(thread-groups "i1")
(times . "0")
(original-location . "handmade.cpp:224")))

(bindat-get-field breakpoint 'line) initially succeeds and the
breakpoint is drawn.

However, on running the program, once the shared library is actually

loaded, the value of gdb-breakpoint-list becomes

((#1="1"
(number . #1#)
(type . "breakpoint")
(disp . "keep")
(enabled . "y")
(addr . "")
(times . "1")
(original-location . "handmade.cpp:224")
(locations
((number . "1.1")
(enabled . "y")
(addr . "")
(pending . "handmade.cpp:224")
(thread-groups "i1"))
((number . "1.2")
(enabled . "y")
(addr . "0x00007ffff7f4e168")
(func . "GameUpdateAndRender(game_memory*, game_input*, 
game_render_commands*)")
(file . "../cpp/code/handmade.cpp")
(fullname . "/home/niall/software/handmadehero/sdl/cpp/code/handmade.cpp")
(line . "224")
(thread-groups "i1")))))

And (bindat-get-field breakpoint 'line) fails,
and the breakpoint is no longer drawn (it is initially wiped in 
gdb-place-breakpoints)

I hope this helps someone.

Niall

P.S.

I am not well expierienced with lisp, so apologies for any terminology 
errors.

-----------------------------End Bug description-------

In GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.14)
of 2020-03-26, modified by Debian built on lcy01-amd64-020
Windowing system distributor 'The X.Org Foundation