Преглед изворни кода

Libraries: Unbreak building with extra debug macros

Ben Wiederhake пре 5 година
родитељ
комит
d8e22fedc3

+ 4 - 3
Libraries/LibELF/DynamicLoader.cpp

@@ -35,7 +35,9 @@
 #include <string.h>
 #include <sys/mman.h>
 
-#define DYNAMIC_LOAD_DEBUG
+#ifndef DYNAMIC_LOAD_DEBUG
+#    define DYNAMIC_LOAD_DEBUG
+#endif
 //#define DYNAMIC_LOAD_VERBOSE
 
 #ifdef DYNAMIC_LOAD_VERBOSE
@@ -82,8 +84,7 @@ DynamicLoader::DynamicLoader(const char* filename, int fd, size_t size)
 
     auto* elf_header = (Elf32_Ehdr*)m_file_mapping;
 
-    if (!validate_elf_header(*elf_header, m_file_size) ||
-        !validate_program_headers(*elf_header, m_file_size, (u8*)m_file_mapping, m_file_size, m_program_interpreter)) {
+    if (!validate_elf_header(*elf_header, m_file_size) || !validate_program_headers(*elf_header, m_file_size, (u8*)m_file_mapping, m_file_size, m_program_interpreter)) {
         m_valid = false;
     }
 }

+ 1 - 1
Libraries/LibELF/DynamicObject.cpp

@@ -263,7 +263,7 @@ const DynamicObject::Symbol DynamicObject::HashSection::lookup_symbol(const char
         auto symbol = m_dynamic.symbol(i);
         if (strcmp(name, symbol.name()) == 0) {
 #ifdef DYNAMIC_LOAD_DEBUG
-            dbgprintf("Returning dynamic symbol with index %d for %s: %p\n", i, symbol.name(), symbol.address());
+            dbgprintf("Returning dynamic symbol with index %u for %s: %p\n", i, symbol.name(), symbol.address().as_ptr());
 #endif
             return symbol;
         }

+ 1 - 1
Libraries/LibELF/Image.cpp

@@ -271,7 +271,7 @@ const Image::RelocationSection Image::Section::relocations() const
         return static_cast<const RelocationSection>(m_image.section(0));
 
 #ifdef Image_DEBUG
-    dbgprintf("Found relocations for %s in %s\n", name(), relocation_section.name());
+    dbgprintf("Found relocations for %s in %s\n", name().to_string().characters(), relocation_section.name().to_string().characters());
 #endif
     return static_cast<const RelocationSection>(relocation_section);
 }

+ 3 - 3
Libraries/LibELF/Loader.cpp

@@ -87,10 +87,10 @@ bool Loader::layout()
         }
         if (program_header.type() != PT_LOAD)
             return;
-#ifdef Loader_DEBUG
-        kprintf("PH: V%p %u r:%u w:%u\n", program_header.vaddr().get(), program_header.size_in_memory(), program_header.is_readable(), program_header.is_writable());
-#endif
 #ifdef KERNEL
+#    ifdef Loader_DEBUG
+        kprintf("PH: V%p %u r:%u w:%u\n", program_header.vaddr().get(), program_header.size_in_memory(), program_header.is_readable(), program_header.is_writable());
+#    endif
         if (program_header.is_writable()) {
             auto* allocated_section = alloc_section_hook(
                 program_header.vaddr(),

+ 4 - 3
Libraries/LibGfx/Painter.cpp

@@ -1349,7 +1349,7 @@ void Painter::draw_quadratic_bezier_curve(const IntPoint& control_point, const I
 
 void Painter::for_each_line_segment_on_elliptical_arc(const FloatPoint& p1, const FloatPoint& p2, const FloatPoint& center, const FloatPoint radii, float x_axis_rotation, float theta_1, float theta_delta, Function<void(const FloatPoint&, const FloatPoint&)>& callback)
 {
-    if (can_approximate_elliptical_arc(p1, p2, center, radii, x_axis_rotation, theta_1, theta_delta))  {
+    if (can_approximate_elliptical_arc(p1, p2, center, radii, x_axis_rotation, theta_1, theta_delta)) {
         callback(p1, p2);
     } else {
         split_elliptical_arc(p1, p2, center, radii, x_axis_rotation, theta_1, theta_delta, callback);
@@ -1568,8 +1568,9 @@ void Painter::fill_path(Path& path, Color color, WindingRule winding_rule)
 
 #ifdef FILL_PATH_DEBUG
     size_t i { 0 };
-    for (auto& segment : segments)
-        draw_line(segment.from, segment.to, Color::from_hsv(++i / segments.size() * 360.0, 1.0, 1.0), 1);
+    for (auto& segment : segments) {
+        draw_line(Point<int>(segment.from), Point<int>(segment.to), Color::from_hsv(++i / segments.size() * 360.0, 1.0, 1.0), 1);
+    }
 #endif
 }
 

+ 3 - 3
Libraries/LibJS/Runtime/Object.cpp

@@ -387,7 +387,7 @@ bool Object::define_property(const StringOrSymbol& property_name, const Object&
         }
 
 #ifdef OBJECT_DEBUG
-        dbg() << "Defining new property " << property_name << " with accessor descriptor { attributes=" << attributes << ", "
+        dbg() << "Defining new property " << property_name.to_display_string() << " with accessor descriptor { attributes=" << attributes << ", "
               << "getter=" << getter.to_string_without_side_effects() << ", "
               << "setter=" << setter.to_string_without_side_effects() << "}";
 #endif
@@ -409,7 +409,7 @@ bool Object::define_property(const StringOrSymbol& property_name, const Object&
         return {};
 
 #ifdef OBJECT_DEBUG
-    dbg() << "Defining new property " << property_name << " with data descriptor { attributes=" << attributes
+    dbg() << "Defining new property " << property_name.to_display_string() << " with data descriptor { attributes=" << attributes
           << ", value=" << (value.is_empty() ? "<empty>" : value.to_string_without_side_effects()) << " }";
 #endif
 
@@ -512,7 +512,7 @@ bool Object::put_own_property(Object& this_object, const StringOrSymbol& propert
         metadata = shape().lookup(property_name);
 
 #ifdef OBJECT_DEBUG
-        dbg() << "Reconfigured property " << property_name << ", new shape says offset is " << metadata.value().offset << " and my storage capacity is " << m_storage.size();
+        dbg() << "Reconfigured property " << property_name.to_display_string() << ", new shape says offset is " << metadata.value().offset << " and my storage capacity is " << m_storage.size();
 #endif
     }
 

+ 6 - 2
Libraries/LibVT/Terminal.cpp

@@ -706,8 +706,12 @@ void Terminal::execute_escape_sequence(u8 final)
     dbgprintf("\n");
     for (auto& line : m_lines) {
         dbgprintf("Terminal: Line: ");
-        for (int i = 0; i < line.m_length; i++) {
-            dbgprintf("%c", line.characters[i]);
+        for (int i = 0; i < line.length(); i++) {
+            u32 codepoint = line.code_point(i);
+            if (codepoint < 128)
+                dbgprintf("%c", (char)codepoint);
+            else
+                dbgprintf("<U+%04x>", codepoint);
         }
         dbgprintf("\n");
     }

+ 1 - 1
Libraries/LibWeb/OutOfProcessWebView.cpp

@@ -109,7 +109,7 @@ void OutOfProcessWebView::notify_server_did_paint(Badge<WebContentClient>, i32 s
 void OutOfProcessWebView::notify_server_did_invalidate_content_rect(Badge<WebContentClient>, [[maybe_unused]] const Gfx::IntRect& content_rect)
 {
 #ifdef DEBUG_SPAM
-    dbg() << "server did invalidate content_rect: " << content_rect << ", current shbuf_id=" << m_bitmap->shbuf_id();
+    dbg() << "server did invalidate content_rect: " << content_rect << ", current front_shbuf_id=" << m_front_bitmap->shbuf_id() << ", current back_shbuf_id=" << m_back_bitmap->shbuf_id();
 #endif
     request_repaint();
 }