@@ -248,6 +248,23 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
248248 // / Returns a pointer to the new location.
249249 lldb::BreakpointLocationSP AddLocation (const Address &addr,
250250 bool *new_location = nullptr );
251+ // / Add a `facade` location to the breakpoint's collection of facade locations.
252+ // / This is only meant to be called by the breakpoint's resolver.
253+ // / Facade locations are placeholders that a scripted breakpoint can use to
254+ // / represent the stop locations provided by the breakpoint. The scripted
255+ // / breakpoint should record the id of the facade location, and provide
256+ // / the description of the location in the GetDescription method
257+ // / To emulate hitting a facade location, the breakpoint's WasHit should
258+ // / return the ID of the facade that was "hit".
259+ // /
260+ // / \param[out] new_location
261+ // / Set to \b true if a new location was created, to \b false if there
262+ // / already was a location at this Address.
263+ // / \return
264+ // / Returns a pointer to the new location.
265+ lldb::BreakpointLocationSP AddFacadeLocation ();
266+
267+ lldb::BreakpointLocationSP GetFacadeLocationByID (lldb::break_id_t );
251268
252269 // / Find a breakpoint location by Address.
253270 // /
@@ -268,27 +285,36 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
268285 // / there is no breakpoint location at that address.
269286 lldb::break_id_t FindLocationIDByAddress (const Address &addr);
270287
271- // / Find a breakpoint location for a given breakpoint location ID.
288+ // / Find a breakpoint location for a given breakpoint location ID. If there
289+ // / are Facade Locations in the breakpoint, the facade locations will be
290+ // / searched instead of the "real" ones.
272291 // /
273292 // / \param[in] bp_loc_id
274293 // / The ID specifying the location.
294+ // /
295+ // / \param[in] use_facade
296+ // / If \b true, then prefer facade locations over "real" ones if they exist.
297+ // /
275298 // / \return
276299 // / Returns a shared pointer to the location with ID \a bp_loc_id. The
277300 // / pointer
278301 // / in the shared pointer will be nullptr if there is no location with that
279302 // / ID.
280- lldb::BreakpointLocationSP FindLocationByID (lldb::break_id_t bp_loc_id);
303+ lldb::BreakpointLocationSP FindLocationByID (lldb::break_id_t bp_loc_id, bool use_facade = true );
281304
282305 // / Get breakpoint locations by index.
283306 // /
284307 // / \param[in] index
285308 // / The location index.
286309 // /
310+ // / \param[in] use_facade
311+ // / If \b true, then prefer facade locations over "real" ones if they exist.
312+ // /
287313 // / \return
288314 // / Returns a shared pointer to the location with index \a
289315 // / index. The shared pointer might contain nullptr if \a index is
290316 // / greater than then number of actual locations.
291- lldb::BreakpointLocationSP GetLocationAtIndex (size_t index);
317+ lldb::BreakpointLocationSP GetLocationAtIndex (size_t index, bool use_facade = true );
292318
293319 // / Removes all invalid breakpoint locations.
294320 // /
@@ -409,9 +435,12 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
409435 // / Return the number of breakpoint locations that have resolved to actual
410436 // / breakpoint sites.
411437 // /
438+ // / \param[in] use_facade
439+ // / If \b true, then prefer facade locations over "real" ones if they exist.
440+ // /
412441 // / \return
413442 // / The number locations resolved breakpoint sites.
414- size_t GetNumResolvedLocations () const ;
443+ size_t GetNumResolvedLocations (bool use_facade = true ) const ;
415444
416445 // / Return whether this breakpoint has any resolved locations.
417446 // /
@@ -421,9 +450,12 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
421450
422451 // / Return the number of breakpoint locations.
423452 // /
453+ // / \param[in] use_facade
454+ // / If \b true, then prefer facade locations over "real" ones if they exist.
455+ // /
424456 // / \return
425457 // / The number breakpoint locations.
426- size_t GetNumLocations () const ;
458+ size_t GetNumLocations (bool use_facade = true ) const ;
427459
428460 // / Put a description of this breakpoint into the stream \a s.
429461 // /
@@ -529,6 +561,20 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
529561 m_name_list.erase (name_to_remove);
530562 }
531563
564+ enum TypeDisplay {
565+ eDisplayFacade = 1 ,
566+ eDisplayReal = 1 << 1 ,
567+ eDisplayHeader = 1 << 2
568+ };
569+
570+ void GetDescriptionForType (Stream *s, lldb::DescriptionLevel level,
571+ uint8_t display_type, bool show_locations);
572+
573+ bool HasFacadeLocations () {
574+ return m_facade_locations.GetSize () != 0 ;
575+ }
576+
577+
532578public:
533579 bool MatchesName (const char *name) {
534580 return m_name_list.find (name) != m_name_list.end ();
@@ -657,6 +703,8 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
657703 BreakpointOptions m_options; // Settable breakpoint options
658704 BreakpointLocationList
659705 m_locations; // The list of locations currently found for this breakpoint.
706+ BreakpointLocationCollection m_facade_locations;
707+
660708 std::string m_kind_description;
661709 bool m_resolve_indirect_symbols;
662710
0 commit comments