Skip to content

Commit ea06ef5

Browse files
committed
meta: drop support for lldb 3.8
PR-URL: #263 Reviewed-By: Joyee Cheung <[email protected]>
1 parent c7ede80 commit ea06ef5

File tree

8 files changed

+8
-336
lines changed

8 files changed

+8
-336
lines changed

README.md

+1-6
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,6 @@ The following subcommands are supported:
230230
findjsobjects -- List all object types and instance counts grouped by typename and sorted by instance count. Use
231231
-d or --detailed to get an output grouped by type name, properties, and array length, as well as
232232
more information regarding each type.
233-
With lldb < 3.9, requires the `LLNODE_RANGESFILE` environment variable to be set to a file
234-
containing memory ranges for the core file being debugged.
235-
There are scripts for generating this file on Linux and Mac in the scripts directory of the llnode
236-
repository.
237233
findrefs -- Finds all the object properties which meet the search criteria.
238234
The default is to list all the object properties that reference the specified value.
239235
Flags:
@@ -341,7 +337,7 @@ TEST_LLDB_BINARY=`which lldb-4.0` npm run test-all
341337
342338
* `LLNODE_DEBUG=true` to see additional debug info from llnode
343339
* `TEST_LLNODE_DEBUG=true` to see additional debug info coming from the tests
344-
* `LLNODE_CORE=/path/to/core/dump LLNODE_NODE_EXE=/path/to/node LLNODE_NO_RANGES=true`
340+
* `LLNODE_CORE=/path/to/core/dump LLNODE_NODE_EXE=/path/to/node`
345341
to use a prepared core dump instead of generating one on-the-fly when running
346342
the tests.
347343
@@ -360,7 +356,6 @@ To debug `test/scan-test.js` with a prepared core dump:
360356
LLNODE_DEBUG=true TEST_LLNODE_DEBUG=true \
361357
LLNODE_CORE=/path/to/core/dump/of/inspect/scenario.js \
362358
LLNODE_NODE_EXE=/path/to/node \
363-
LLNODE_NO_RANGES=true \
364359
node test/scan-test.js
365360
```
366361

scripts/macho2segments.js

-78
This file was deleted.

scripts/otool2segments.py

-43
This file was deleted.

scripts/readelf2segments.py

-43
This file was deleted.

src/llnode.cc

-9
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ bool BacktraceCmd::DoExecute(SBDebugger d, char** cmd,
8383
}
8484
}
8585

86-
#ifdef LLDB_SBMemoryRegionInfoList_h_
8786
// Heuristic: a PC in WX memory is almost certainly a V8 builtin.
8887
// TODO(bnoordhuis) Find a way to map the PC to the builtin's name.
8988
{
@@ -95,7 +94,6 @@ bool BacktraceCmd::DoExecute(SBDebugger d, char** cmd,
9594
continue;
9695
}
9796
}
98-
#endif // LLDB_SBMemoryRegionInfoList_h_
9997

10098
// C++ stack frame.
10199
SBStream desc;
@@ -445,13 +443,6 @@ bool PluginInitialize(SBDebugger d) {
445443
"name and sorted by instance count. Use -d or --detailed to "
446444
"get an output grouped by type name, properties, and array "
447445
"length, as well as more information regarding each type.\n"
448-
#ifndef LLDB_SBMemoryRegionInfoList_h_
449-
"Requires `LLNODE_RANGESFILE` environment variable to be set "
450-
"to a file containing memory ranges for the core file being "
451-
"debugged.\n"
452-
"There are scripts for generating this file on Linux and Mac "
453-
"in the scripts directory of the llnode repository."
454-
#endif // LLDB_SBMemoryRegionInfoList_h_
455446
);
456447

457448
SBCommand settingsCmd =

src/llscan.cc

+4-110
Original file line numberDiff line numberDiff line change
@@ -1420,48 +1420,22 @@ bool LLScan::ScanHeapForObjects(lldb::SBTarget target,
14201420
// Reload process anyway
14211421
process_ = target.GetProcess();
14221422

1423-
// Need to reload memory ranges (though this does assume the user has also
1424-
// updated
1425-
// LLNODE_RANGESFILE with data for the new dump or things won't match up).
1423+
// Need to reload memory regions.
14261424
if (target_ != target) {
1427-
ClearMemoryRanges();
14281425
ClearMapsToInstances();
14291426
ClearReferences();
14301427
target_ = target;
14311428
}
14321429

1433-
#ifndef LLDB_SBMemoryRegionInfoList_h_
1434-
/* Fall back to environment variable containing pre-parsed list of memory
1435-
* ranges. */
1436-
if (nullptr == ranges_) {
1437-
const char* segmentsfilename = getenv("LLNODE_RANGESFILE");
1438-
1439-
if (segmentsfilename == nullptr) {
1440-
result.SetError(
1441-
"No memory range information available for this process. Cannot scan "
1442-
"for objects.\n"
1443-
"Please set `LLNODE_RANGESFILE` environment variable\n");
1444-
return false;
1445-
}
1446-
1447-
if (!GenerateMemoryRanges(target, segmentsfilename)) {
1448-
result.SetError(
1449-
"No memory range information available for this process. Cannot scan "
1450-
"for objects.\n");
1451-
return false;
1452-
}
1453-
}
1454-
#endif // LLDB_SBMemoryRegionInfoList_h_
1455-
14561430
/* If we've reached here we have access to information about the valid memory
1457-
* ranges in the process and can scan for objects.
1431+
* regions in the process and can scan for objects.
14581432
*/
14591433

14601434
/* Populate the map of objects. */
14611435
if (mapstoinstances_.empty()) {
14621436
FindJSObjectsVisitor v(target, this);
14631437

1464-
ScanMemoryRanges(v);
1438+
ScanMemoryRegions(v);
14651439
}
14661440

14671441
return true;
@@ -1539,25 +1513,14 @@ inline static ByteOrder GetHostByteOrder() {
15391513
return u.b == 1 ? ByteOrder::eByteOrderBig : ByteOrder::eByteOrderLittle;
15401514
}
15411515

1542-
void LLScan::ScanMemoryRanges(FindJSObjectsVisitor& v) {
1543-
bool done = false;
1544-
1516+
void LLScan::ScanMemoryRegions(FindJSObjectsVisitor& v) {
15451517
const uint64_t addr_size = process_.GetAddressByteSize();
15461518
bool swap_bytes = process_.GetByteOrder() != GetHostByteOrder();
15471519

15481520
// Pages are usually around 1mb, so this should more than enough
15491521
const uint64_t block_size = 1024 * 1024 * addr_size;
15501522
unsigned char* block = new unsigned char[block_size];
15511523

1552-
#ifndef LLDB_SBMemoryRegionInfoList_h_
1553-
MemoryRange* head = ranges_;
1554-
1555-
while (head != nullptr && !done) {
1556-
uint64_t address = head->start_;
1557-
uint64_t len = head->length_;
1558-
head = head->next_;
1559-
1560-
#else // LLDB_SBMemoryRegionInfoList_h_
15611524
lldb::SBMemoryRegionInfoList memory_regions = process_.GetMemoryRegions();
15621525
lldb::SBMemoryRegionInfo region_info;
15631526

@@ -1571,7 +1534,6 @@ void LLScan::ScanMemoryRanges(FindJSObjectsVisitor& v) {
15711534
uint64_t address = region_info.GetRegionBase();
15721535
uint64_t len = region_info.GetRegionEnd() - region_info.GetRegionBase();
15731536

1574-
#endif // LLDB_SBMemoryRegionInfoList_h_
15751537
/* Brute force search - query every address - but allow the visitor code to
15761538
* say how far to move on so we don't read every byte.
15771539
*/
@@ -1614,7 +1576,6 @@ void LLScan::ScanMemoryRanges(FindJSObjectsVisitor& v) {
16141576
}
16151577

16161578
if (increment == 0) {
1617-
done = true;
16181579
break;
16191580
}
16201581
}
@@ -1623,73 +1584,6 @@ void LLScan::ScanMemoryRanges(FindJSObjectsVisitor& v) {
16231584
delete[] block;
16241585
}
16251586

1626-
1627-
/* Read a file of memory ranges parsed from the core dump.
1628-
* This is a work around for the lack of an API to get the memory ranges
1629-
* within lldb.
1630-
* There are scripts for generating this file on Mac and Linux stored in
1631-
* the scripts directory of the llnode repository.
1632-
* Export the name or full path to the ranges file in the LLNODE_RANGESFILE
1633-
* env var before starting lldb and loading the llnode plugin.
1634-
*/
1635-
bool LLScan::GenerateMemoryRanges(lldb::SBTarget target,
1636-
const char* segmentsfilename) {
1637-
std::ifstream input(segmentsfilename);
1638-
1639-
if (!input.is_open()) {
1640-
return false;
1641-
}
1642-
1643-
uint64_t address = 0;
1644-
uint64_t len = 0;
1645-
1646-
MemoryRange** tailptr = &ranges_;
1647-
1648-
lldb::addr_t address_byte_size = target.GetProcess().GetAddressByteSize();
1649-
1650-
while (input >> std::hex >> address >> std::hex >> len) {
1651-
/* Check if the range is accessible.
1652-
* The structure of a core file means if you check the start and the end of
1653-
* a range then the middle will be there, ranges are contiguous in the file,
1654-
* but cores often get truncated due to file size limits so ranges can be
1655-
* missing or truncated. Sometimes shared memory segments are omitted so
1656-
* it's also possible an entire section could be missing from the middle.
1657-
*/
1658-
lldb::SBError error;
1659-
1660-
target.GetProcess().ReadPointerFromMemory(address, error);
1661-
if (!error.Success()) {
1662-
/* Could not access first word, skip. */
1663-
continue;
1664-
}
1665-
1666-
target.GetProcess().ReadPointerFromMemory(
1667-
(address + len) - address_byte_size, error);
1668-
if (!error.Success()) {
1669-
/* Could not access last word, skip. */
1670-
continue;
1671-
}
1672-
1673-
MemoryRange* newRange = new MemoryRange(address, len);
1674-
1675-
*tailptr = newRange;
1676-
tailptr = &(newRange->next_);
1677-
}
1678-
return true;
1679-
}
1680-
1681-
1682-
void LLScan::ClearMemoryRanges() {
1683-
MemoryRange* head = ranges_;
1684-
while (head != nullptr) {
1685-
MemoryRange* range = head;
1686-
head = head->next_;
1687-
delete range;
1688-
}
1689-
ranges_ = nullptr;
1690-
}
1691-
1692-
16931587
void LLScan::ClearMapsToInstances() {
16941588
TypeRecord* t;
16951589
for (auto entry : mapstoinstances_) {

0 commit comments

Comments
 (0)