I use electron/build_tools to build electron and run e init --root=~/electron --bootstrap testing; e debug.(e debug runs local Electron build inside of lldb.)
Set a breakpoint by (lldb) br set --file archive.cc --line 155
Print any variable in this file, eg p header ,p size but return error.
Run frame variable , frame variable -g but no value return.
(lldb) br set --file archive.cc --line 155
(lldb) r
Process 30523 launched: '/Users/electron/src/out/Testing/Electron.app/Contents/MacOS/Electron' (x86_64)
Electron Framework was compiled with optimization - stepping may behave oddly; variables may not be available.
Process 30523 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100352d90 Electron Framework`::Init() at archive.cc:155:63 [opt]
152 }
153
154 base::PickleIterator header_pickle(
-> 155 base::Pickle(reinterpret_cast<const char*>(file_.data() + 8), size));
156 std::string header;
157 if (!header_pickle.ReadString(&header)) {
158 LOG(ERROR) << "Failed to read header string at '" << path_.value() << "'";
Target 0: (Electron) stopped.
(lldb) frame variable
(lldb) p file_
error: <user expression 21>:1:1: use of undeclared identifier 'file_'
file_
^
(lldb) p size
error: <user expression 23>:1:1: reference to overloaded function could not be resolved; did you mean to call it?
size
^~~~
note: possible target for call
Related
I'm new to GTK4, an open source toolkit for C++ binding. I want to send text from current TextView buffer (from a saved file) to a PDF file using GTK libraries (gtkmm4), but couldn't get anything printed out.
This is the code I have started from reading the documentation:
void MainWindow:export_note() {
auto op = Gtk::PrintOperation::create();
// setup op
cout << save_file_path << endl;
string content = editor.get_buffer()->get_text();
ofstream out(work_dir + save_file_path);
out << content;
out.close();
curr_state = edit_file;
op->set_export_filename("test.pdf");
auto res = op->run(Gtk::PrintOperation::Action::EXPORT);
return;
}
This only exports to a blank PDF, but I'm expecting text to show up on PDF.
It looks like you are not using any binary application to attempt conversion from text to text/pdf or more commonly binary application/pdf. You cannot simply stuff text data into a container called Test.pdf
There are simple means to convert Text to PDF, traditionally by using PostScript Printer files, but more commonly recently using a PDF printer driver direct
so start at the most basic level Hello World needs a file something like this, where the body is built up from stacked vectors or font labelled strings at X&Y co-ordinates.
Test.pdf
%PDF-1.1
%âãÏÓ
1 0 obj<</Type/Catalog/Pages 2 0 R>>endobj
2 0 obj<</Type/Pages/Kids [3 0 R]/Count 1/MediaBox [0 0 594 792]>>endobj
3 0 obj<</Type/Page/Parent 2 0 R/Resources<</Font<</F1<</Type/Font/Subtype/Type1/BaseFont/Helvetica>>>>>>/Contents 4 0 R>>endobj
4 0 obj<</Length 81
>>
stream
BT /F1 18 Tf 036 740 Td (Hello) Tj ET
BT /F1 18 Tf 036 720 Td (World!) Tj ET
endstream
endobj xref
0 5
0000000000 65535 f
0000000019 00000 n
0000000063 00000 n
0000000137 00000 n
0000000267 00000 n
trailer<</Root 1 0 R /Size 5>>startxref
399 %%EOF
I have the following query,
CREATE OR REPLACE TRIGGER display_salary_changes
BEFORE INSERT ON marks
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
DECLARE
sal_diff number;
BEGIN
sal_diff:=:NEW.sub1-:OLD.sub1;
dbms_output.put_line('Old salary: ' || :OLD.sub1);
dbms_output.put_line('New salary: ' || :NEW.sub1);
dbms_output.put_line('Salary difference: ' || sal_diff);
END;
When I try to run this it throws,
ORA-04098: trigger 'PRAS.B' is invalid and failed re-validation
NAME TYPE SEQUENCE LINE POSITION TEXT ATTRIBUTE MESSAGE_NUMBER
B TRIGGER 1 9 38 PLS-00201: identifier 'OLD.SUB1' must be declared ERROR 201
B TRIGGER 2 9 2 PL/SQL: Statement ignored ERROR 0
B TRIGGER 3 10 41 PLS-00201: identifier 'NEW.SUB1' must be declared ERROR 201
B TRIGGER 4 10 2 PL/SQL: Statement ignored ERROR 0
Running llc --debug, the output for instruction selection pattern matching is quite unreadable on its own. Here's some example output:
ISEL: Starting pattern match on root node: t7: i8,ch = load<LD1[%1](dereferenceable)> t0, t2, undef:i16
Initial Opcode index to 581
TypeSwitch[i8] from 590 to 593
Match failed at index 595
Continuing at 624
Match failed at index 626
Continuing at 662
Match failed at index 667
Continuing at 754
TypeSwitch[i8] from 761 to 764
Morphed node: t7: i8,ch = LPMRdZ<Mem:LD1[%1](dereferenceable)> t2, t0
What do does numbers mean? How do I use that output? In particular, I'd like to see which instruction patterns were tried (linked to my TargetInstrInfo.td file), in what order, and what sub-patterns matched or failed.
I've found that the LLVM build process uses Target/MyArch/MyArchInstrInfo.td to generate, among other things, a MyArchGenDAGISel.inc file. The numbers in the debug messages correspond to tags in that file; for example, here's the relevant part for the example in my question. It gives pretty much exactly the kind of information I was hoping for.
/*581*/ OPC_RecordMemRef,
/*582*/ OPC_RecordNode, // #0 = 'ld' chained node
/*583*/ OPC_Scope, 39, /*->624*/ // 3 children in Scope
/*585*/ OPC_RecordChild1, // #1 = $memri
/*586*/ OPC_CheckPredicate, 1, // Predicate_unindexedload
/*588*/ OPC_CheckPredicate, 2, // Predicate_load
/*590*/ OPC_SwitchType /*2 cases */, 14, MVT::i8,// ->607
/*593*/ OPC_CheckPatternPredicate, 0, // (Subtarget->hasSRAM())
/*595*/ OPC_CheckComplexPat, /*CP*/0, /*#*/1, // SelectAddr:$memri #2 #3
/*624*/ /*Scope*/ 37, /*->662*/
/*625*/ OPC_MoveChild1,
/*626*/ OPC_CheckOpcode, TARGET_VAL(AVRISD::WRAPPER),
/*662*/ /*Scope*/ 125, /*->788*/
/*663*/ OPC_RecordChild1, // #1 = $src
/*664*/ OPC_Scope, 88, /*->754*/ // 2 children in Scope
/*666*/ OPC_MoveChild1,
/*667*/ OPC_CheckOpcode, TARGET_VAL(ISD::Constant),
/*754*/ /*Scope*/ 32, /*->787*/
/*755*/ OPC_CheckChild1Type, MVT::i16,
/*757*/ OPC_CheckPredicate, 1, // Predicate_unindexedload
/*759*/ OPC_CheckPredicate, 2, // Predicate_load
/*761*/ OPC_SwitchType /*2 cases */, 10, MVT::i8,// ->774
/*764*/ OPC_CheckPatternPredicate, 0, // (Subtarget->hasSRAM())
/*766*/ OPC_EmitMergeInputChains1_0,
/*767*/ OPC_MorphNodeTo1, TARGET_VAL(AVR::LDRdPtr), 0|OPFL_Chain|OPFL_MemRefs,
MVT::i8, 1/*#Ops*/, 1,
// Src: (ld:i8 i16:i16:$ptrreg)<<P:Predicate_unindexedload>><<P:Predicate_load>> - Complexity = 4
// Dst: (LDRdPtr:i8 i16:i16:$ptrreg)
I have a global function in a long run program :
int test()
{
int a = 12;
int c = 10;
printf("a=%d",a);
a += c ;
printf("a=%d", a);
return a;
}
I debug the program and break, then issue the following command:
(lldb) call test()
a=12a=22(int) $0 = 22
(lldb)
I want it to break in test() method every line after I hit call test(), not just return the result immediately. Anyone knows how to do it ?
------------------------------------ Answer Below ------------------------------------
#Jason Molenda 's answer is the right answer,use expr -i0 -- test() instead of call test():
(lldb) b test
Breakpoint 1: 4 locations.
(lldb) expr -i0 -- test()
error: Execution was interrupted, reason: breakpoint 1.1.
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.
(lldb)
Now it break in test(), but raise an error!!! How to avoid the error ?
The expression command in lldb (call is an alias for expression) takes a dozen or so options, one of them being whether lldb should stop on a breakpoint while executing the expression, --ignore-breakpoints false, or -i false, or -i 0.
(lldb) br s -n printf
Breakpoint 2: where = libsystem_c.dylib`printf, address = 0x00007fff89ee7930
(lldb) expr -- (void)printf("hi\n")
hi
(lldb) expr -i0 -- (void)printf("hi\n")
error: Execution was interrupted, reason: breakpoint 2.1.
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.
Process 15259 stopped
* thread #1: tid = 0xf0daf, 0x00007fff89ee7930 libsystem_c.dylib`printf, queue = 'com.apple.main-thread', stop reason = breakpoint 2.1
#0: 0x00007fff89ee7930 libsystem_c.dylib`printf
libsystem_c.dylib`printf:
-> 0x7fff89ee7930: pushq %rbp
0x7fff89ee7931: movq %rsp, %rbp
0x7fff89ee7934: pushq %r15
0x7fff89ee7936: pushq %r14
(lldb)
There was some thought put in to the default behavior (whether to stop on a breakpoint or not), and this seemed the behavior most people would expect.
As I said, the call command is just an alias for expression. If you want to change the behavior of it, you can overwrite the alias with one of your own. e.g. command alias call expr -i false -- will do the trick. You can put this in your ~/.lldbinit file and you'll be set.
It's not a joke? Just checked standard breakpoint to be sure:
(gdb) b test
Breakpoint 2 at 0x400671: file t.c, line 6.
(gdb) call test()
Breakpoint 2, test () at t.c:6
6 printf("a\n");
Additional uncaught exception thrown while handling exception.
Original
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal8new.users' doesn't exist: SELECT u.*, s.* FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = :sid; Array ( [:sid] => jTk-DdIj4XlzQsnH86R22ktqje2PUFx7RcfnngiQJJg ) in Drupal\Core\Database\Connection->query() (line 569 of /var/www/drupal8new/core/lib/Drupal/Core/Database/Connection.php).
Drupal\Core\Database\Connection->query('SELECT u.*, s.* FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = :sid', Array)
Drupal\Core\Session\SessionHandler->read('IIBgOUpsx2qnDOPFcwY_1VKaZrjxC48SVzaOOoKEi78')
Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler->read('IIBgOUpsx2qnDOPFcwY_1VKaZrjxC48SVzaOOoKEi78')
Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy->read('IIBgOUpsx2qnDOPFcwY_1VKaZrjxC48SVzaOOoKEi78')
session_start()
Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start()
Drupal\Core\Session\SessionManager->start()
Drupal\Core\Session\SessionManager->initialize()
Drupal\Core\Authentication\Provider\Cookie->authenticate(Object)
Drupal\Core\Authentication\AuthenticationManager->authenticate(Object)
Drupal\Core\Session\AccountProxy->getAccount()
Drupal\Core\Session\AccountProxy->id()
Drupal\Core\Logger\LoggerChannel->log(6, '%module module installed.', Array)
watchdog('system', '%module module installed.', Array, 6)
Drupal\Core\Extension\ModuleHandler->install(Array, )
drupal_install_system(Array)
install_base_system(Array)
install_run_task(Array, Array)
install_run_tasks(Array)
install_drupal()
Additional
RuntimeException: Failed to start the session: already started by PHP. in Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() (line 134 of /var/www/drupal8new/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php).
Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start()
Drupal\Core\Session\SessionManager->start()
Drupal\Core\Session\SessionManager->initialize()
Drupal\Core\Authentication\Provider\Cookie->authenticate(Object)
Drupal\Core\Authentication\AuthenticationManager->authenticate(Object)
Drupal\Core\Session\AccountProxy->getAccount()
Drupal\Core\Session\AccountProxy->id()
Drupal\Core\Logger\LoggerChannel->log(3, '%type: !message in %function (line %line of %file).', Array)
watchdog('php', '%type: !message in %function (line %line of %file).', Array, 3)
_drupal_log_error(Array, 1)
_drupal_exception_handler(Object)
How to fix this erro