Here is the python entry point:
cpp_rebuilder_dir = PurePosixPath(os.path.dirname(rb.__file__), 'bin')
cpp_rebuilder_parser = str(cpp_rebuilder_dir / self.cpp_binary_name)
command_line = [
cpp_rebuilder_parser,
"--securities-file", json_file,
"--output-filename", self.output_filename,
"--workdir", work_dir,
"--row-group-size", "64",
"--compression", "ZSTD",
]
ret = subprocess.run(command_line)
The above runs some cpp code:
int main(int argc, char *argv[]) {
auto rc = StatusCode::OK;
rc = ProcessArgs(argc, argv);
std::cout << "DONE" << std::endl;
logger::init_logger("cbbo");
if(rc == StatusCode::OK) {
std::cout << "inside if statement" << std::endl;
logger::stdout->warn("Status is okay and we are inside if statement");
auto outfilepath = boost::filesystem::path{workdir} / output_filename;
if(!boost::filesystem::exists(outfilepath) || replace) {
try {
auto files_it = all_files.begin();
auto meta_it = all_meta.begin();
// SHARED THE WRITE FOR ALL THE ITERATIONS TO WRITE ON THE SAME FILE
auto writer_ = std::make_shared<rebuilder::ParquetWriter>(output_filename, 10, 64, rebuilder::Compression::ZSTD);
// EACH ENTRY, it is a "group belonging to a primary" saved above, so iterate over it
while (files_it != all_files.end() and meta_it != all_meta.end()) {
auto files = *files_it++;
auto meta = *meta_it++;
logger::stdout->warn("We are inside the while loop");
// Create the output BBO generator
cbbo::BBOGenerator generator(files, outfilepath.string(), workdir, sample_interval_ns, dual_listed_only, allow_zero_sizes, writer_);
// Take the first as primary here
const auto & primary_file = files.begin();
logger::stdout->warn("has hit file begin");
// Loop over each value in meta vector i.e. each ticker and listings
for(const auto & entry : meta) {
logger::stdout->warn("INSIDE FOR LOOP");
// Select on listing id
....
std::raise(SIGINT);
// Add meta to generator for this listing
generator.AddMeta(rebuilder::Meta_t{
primary_file->data_file,
entry.ticker,
entry.exchange_ticker,
entry.listing_ids.front(),
entry.currency,
primary_file->mic,
entry.iso_exchange_code,
{},
{},
global.tz_offset_change,
global.tz_offset_time,
global.tz_offset_before,
global.tz_offset_after,
global.trade_date_timestamp
});
logger::stdout->warn("After generator.AddMeta");
The above crashes with:
malloc(): invalid size (unsorted)
And I am trying to figure out where and why it is crashing. With some logging I can see this crashes at generator.AddMeta(rebuilder::Meta_t{
But I want to debug and see why.
Any ideas how I can set a breakpoint in the cpp code?
Apologies if this is basic, I have a Python background, and in Python I would normally jsut set breakpoint()
in the code and execute the code in terminal and it would break at the point.