test with Epeck

This commit is contained in:
Laurent Rineau 2025-11-10 10:51:00 +01:00
parent 786107ea05
commit b8af35ac1d
3 changed files with 121 additions and 2 deletions

View File

@ -163,8 +163,8 @@ struct CDT_options
bool debug_geometric_errors = false; bool debug_geometric_errors = false;
bool debug_polygon_insertion = false; bool debug_polygon_insertion = false;
bool use_finite_edges_map = false; bool use_finite_edges_map = false;
bool use_epeck_for_normals = false; bool use_epeck_for_normals = true;
bool use_epeck_for_Steiner_points = false; bool use_epeck_for_Steiner_points = true;
bool call_is_valid = true; bool call_is_valid = true;
bool bisect_failures = false; bool bisect_failures = false;
double vertex_vertex_epsilon = 0.; // 1e-14; double vertex_vertex_epsilon = 0.; // 1e-14;

View File

@ -0,0 +1,36 @@
// Copyright (c) 2025 GeometryFactory Sarl (France)
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s) : Laurent Rineau
//
//
// GDB Pretty Printer Auto-load Header
//
// This header embeds a .debug_gdb_scripts section that tells GDB to
// automatically load CGAL pretty printers when debugging.
//
// Include this file in any CGAL executable or library to enable
// auto-loading of the gdb pretty printers.
#ifndef CGAL_GDB_AUTOLOAD_H
#define CGAL_GDB_AUTOLOAD_H
#if defined(__ELF__) && (defined(__GNUC__) || defined(__clang__))
// ELF format (Linux, BSD) with GCC or Clang
// Use inline assembly to embed the .debug_gdb_scripts section
__asm__(
".pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n"
".byte 1\n" // Python script marker
".asciz \"share/gdb/auto-load/cgal_printers.py\"\n"
".popsection\n"
);
#endif // __ELF__
#endif // CGAL_GDB_AUTOLOAD_H

View File

@ -0,0 +1,83 @@
"""
CGAL GDB Pretty Printers
This module provides pretty printers for common CGAL types to make
debugging more convenient.
Auto-loaded via .debug_gdb_scripts section.
"""
import gdb
import re
class PointC3Printer:
"""Pretty printer for CGAL::PointC3<*> types"""
def __init__(self, val):
self.val = val
def to_string(self):
try:
# Navigate through the nested structure:
# ((((pa).base).base)._M_elems)[0]
base1 = self.val['base']
base2 = base1['base']
elems = base2['_M_elems']
# Extract coordinates
x = float(elems[0])
y = float(elems[1])
z = float(elems[2])
return f"PointC3({x}, {y}, {z})"
except (AttributeError, gdb.MemoryError, RuntimeError) as e:
return f"PointC3(<error: {e}>)"
def children(self):
"""Show individual coordinates"""
try:
base1 = self.val['base']
base2 = base1['base']
elems = base2['_M_elems']
yield 'x', elems[0]
yield 'y', elems[1]
yield 'z', elems[2]
except (AttributeError, gdb.MemoryError, RuntimeError):
pass
def display_hint(self):
return 'array'
def cgal_lookup_function(val):
"""Lookup function to register CGAL pretty printers"""
typename = str(val.type.strip_typedefs())
# Match CGAL::PointC3<anything>
if re.match(r'^CGAL::PointC3<.*>$', typename):
return PointC3Printer(val)
return None
# Register the pretty printer globally
# When auto-loaded via .debug_gdb_scripts, use global registration
objfile = gdb.current_objfile()
if objfile:
# Loaded for specific objfile
gdb.printing.register_pretty_printer(
objfile,
cgal_lookup_function,
replace=True
)
else:
# Loaded globally (e.g., via source command)
gdb.printing.register_pretty_printer(
gdb,
cgal_lookup_function,
replace=True
)
print(f"CGAL pretty printers loaded (objfile: {objfile})")