CLanguageExpressionEvaluator:
- Add tokenizer handling for operators . and ->.
- Rework _ParseIdentifier() to work recursively if it sees a deref
operator immediately following the current token. This allows
one to refer to the value of structure/class members in an
expression.
* UI still needs some tweaking
* The Services tab has a list of services. This currently include DNS
and will soon also include the services listed in xinetd.
* The DNS tab allows to manage DNS servers (settings can't be saved yet)
- If the current frame belongs to a class function, and the requested name
doesn't match that of any of the parameters/local variables, attempt to
find it in the member list as well.
It previously shared the same generated MBR header with bin/writembr,
but they have incompatible needs. The intel partitioning add-on only
wants the MBR code, while writembr wants the whole sector.
Build the desired version of the MBR separately for each target instead
of sharing a single header.
The compile flags were set so that only the boot code itself would be
produced, excluding the (dummy) partition table and signature. The code
in writembr still assumed that the MBR would be 512 bytes however and
therefore access the data array out of bounds.
Fix flags to produce the full 512 byte MBR sector and add a
STATIC_ASSERT so that the size assumption is checked on compilation.
Also fix a typo in mbr.nasm, mostly to trigger re-generation of the
MBR data that one would otherwise need to remove manually...
The two out of bounds array accesses were pointed out by CID 1249923 and
CID 1249924, the insufficiently large target buffer of the memcpy by
CID 1249901.
General:
- Resolving variable values requires both a stack frame and a CPU state.
Adjust all interfaces and callers accordingly.
ExpressionEvaluationJob:
- Pass additional parameters needed for variable value resolution.
- If variable resolution is desired, ExpressionEvaluationJob now
creates a temporary ValueNodeManager for that purpose.
- If the expression parser returns a value node pointer that needs
to be resolved, schedule a corresponding job and wait.
CLanguageExpressionEvaluator:
- Clean up some leftovers that were preventing variable names from being
handled properly in some cases.
- Implement handling of identifier names. These are now looked up against
the value node graph of the active node manager, and if found, corresponding
values are retrieved. If the value has not yet been resolved, an exception
is thrown to ask that to be done.
This gets value resolution working for basic local variables and function
parameters, and consequently, #9712. Structure/class members and/or pointer
indirection aren't yet handled.
With packagefs potentially opening quite a few packages the default of
256 slots is a bit tight. It's 4096 now, which should be safe for a
while, but we might want to consider resizing the table dynamically and
probably even switching to another algorithm for allocating the slots.
Should fix#11328.
- Extend CliContext::Event to be able to store expression
event results.
- Extend CliContext to watch for team expression events and
handle them accordingly.
Factor out message constant for expression evaluation completion,
as multiple places will be using that.
ExpressionEvaluationWindow:
- Check for expression match immediately in listener hook, and
don't bother dispatching to the message loop in such a case.
Simplifies some of the other code.
InspectorWindow / WatchPromptWindow:
- Rather than attempting to evaluate an expression directly,
we now defer to the async interface. Clean up and adjust accordingly.
TeamWindow:
- Adjust window creation calls due to parameter changes.
This leaves only the CLI dump memory command to be adapted.
* VMArea::AddWaiterIfWired(): Replace the ignoreRange argument by a
flags argument and introduce (currently only) flag
IGNORE_WRITE_WIRED_RANGES. If specified, ranges wired for writing
are ignored. Ignoring just a single specified range doesn't cut it
in vm_soft_fault(), and there aren't any other users of that feature.
* vm_soft_fault(): When having to unmap a page of a lower cache, this
page cannot be wired for writing. So we can safely ignore all
writed-wired ranges, instead of just our own. We even have to do that
in case there's another thread that concurrently tries to write-wire
the same page, since otherwise we'd deadlock waiting for each other.
* Remove useless BBox
* Use unicode symbols for play/stop buttons instead of a label
* Since the buttons are smaller, put them on the same line as the file
selector.
As Axel pointed out, B_BAD_DATA is not the correct code here. B_BUSY
could be used but I wantd a code different from the existing one for
"partition already being initialized".
- ExpressionEvaluationWindow now uses the aforementioned
request interface to ask the debugger core to perform evaluation
on its behalf, rather than doing so itself directly.
The remaining users of the expression evaluator will be adjusted in
following commits.
- Add UserInterfaceListener hook to request expression evaluation.
- Add corresponding events/handlers in Team and TeamDebugger.
These allow callers to request evaluation of expressions by the
debugger core's worker threads with asynchronous notifications of
results. While not strictly necessary right now, this paves the way
for further changes to come, as handling of variables will
potentially require resolving their values if they haven't been
already, and this shouldn't be done from user interface threads.
When we encounter a wired page that we'd have to unmap to map our newly
allocated one, we need to get rid of the latter before unlocking
everything and waiting for the wired page. Otherwise we'd leave things
in an inconsistent state (a page from an upper cache shadowing a mapped
page from a lower cache).
... in case we'd need to unmap a page that is wired.
Fixes the immediate issue of #10977. There's a problem remaining (as
discussed in comment 1): If two threads want to wire the same page at
the same time (which led to the assertion being triggered), they will
now deadlock, waiting for each other to remove the pre-registered
VMAreaWiredRange.
The thread that is being [un]scheduled already has its time_lock locked
in {stop|continue}_cpu_timers(). When updating the TeamTimeUserTimer,
the team is asked for its cpu time. Team::CPUTime() then iterates the
threads of the team and locks the time_lock of the thread again.
This workaround passes a possibly locked thread through the relevant
functions so Team::CPUTime() can decide whether or not a thread it
iterates needs to be locked or not.
This works around #11032 and its duplicates #11314 and #11344.
when uninitializing a partition or a disk (removing the partition
table), check that all partitions from that table are unmounted, as they
are about to become invalid.
Fixes#8827.
- Allows one to choose the type which the current expression
should be evaluated as.
- Don't attempt to evaluate expression if the input field is
currently empty.
- Remove dependency on MAPM/ExpressionParser. Consequently also adjust
CliDumpMemoryCommand, InspectorWindow and WatchPromptWindow to use
CLanguageExpressionEvaluator for address input evaluation.
CLanguageExpressionEvaluator:
- Revise to make use of Number class rather than MAPM. In the process,
implement support for bitwise operators.
SourceLanguage/CLanguageFamily/CLanguageExpressionEvaluator:
- Adjust interface for expression evaluation to allow specifying the
type to evaluate the expression as. Adjust implementing classes
accordingly.
ExpressionEvaluationWindow:
- Adjust to new expression interface. For now defaults to 64-bit integer
type, UI for type selection to be added.
- This class abstracts out the underlying type of a value, and handles
all the basic mathematical logical operators accordingly. Replaces
the MAPM type previously used for these respective operations.
The language and formatting conventions can now only be set when
creating the objects. This removed the needs for locking them when
formatting to avoid some other thread changing the format while it's
being used.
Adjust tests and DeskBar TimeView to the API changes.
- CLanguageExpressionEvaluator now handles all the basic logical
comparison operators. Bitwise operators still to come, as some
of those may possibly require modifications to the MAPM library.
- Separate operator parsing out into its own function, and refactor
it to handle multi-character operators. These aren't yet handled
by the parser itself though.
- Using BMessenger as an indirect lock is unnecessary, as
BLooper::Lock() checks if the current looper is valid via the global
looper list directly.
- Fix race conditions. When asked to show various subwindows, lock them
before calling Activate(), as the window could otherwise potentially
quit in between us checking pointer validity and calling Activate().
- _GetActiveSourceLanguage() needs to acquire a reference to the language
object in the case where it's retrieved from the active source code.
Otherwise, an unbalanced release would take place when creating the
expression window, leading to crashes.
Thanks to Stephan for reviewing.
Not yet visible. But the package list area in the main window has a card
layout now and a second (hidden) page for featured packages. Which packages
are visible there will depend on the prominence value from the web-app
and other parameters later (suggestions based on packages already installed
and user-ratings). At the moment, there is no mechanism for updating the
package list when package info is retrieved asynchronously, even from the
cache. Also, the view should switch to the list when searching and perhaps
in other situations as well, like selecting a category or when no packages
would be featured. And clicking featured packages does not yet select them in
the info area...
Currently a vertically scrollable container for views which are similar
to the title area in the package info view (and share most code, but it
will diverge later on). Untested and not yet used.
Package contents are scanned to find deskbar links. If a package has less
than four links, they will be offered in separate "Open <link name>" buttons
in the package info area. Usually, this results in one button to open the
main application from the package. If the heuristic proves to be not good
enough, this could be improved of course.
The "2nd" assert that we always ran into was due to bootloader mappings
still being active after VM init. Turns out we missed a call in the
architecture specific code for cleaning this up.
Many thanks to Ingo for spending the time to figure this out!
- Adjust expression window interface so it can report being closed
to TeamWindow or whoever else invokes it.
- Add a menu item to Tools to request expression evaluation. This
now attempts to get the expression evaluator for the current language,
and subsequently opens the expression evaluation window with it.
With these changes, basic numerical expression evaluation works.
Resolution of variable values and condition operators aren't yet
handled.
- Add override for EvaluateExpression(), and hook it up to
CLanguageExpressionEvaluator. Note that for the moment it assumes
the expression will result in an integer value.
When a file descriptor is closed between being selected and adding the
select info to its IO context, the select info needs to be cleaned up.
This is done by deselect_select_infos() which unconditionally also put
the select_sync associated with the infos. In this special case we do
not yet hold a reference to the select_sync however, so avoid putting
the corresponding sync object.
Fixes#11098, #10763 and #10230.
Note that double clicking a .hpkg in one of the packages folders will
not yet have a sensible result. I think it should open the regular
HaikuDepot with the full packages list, default to show installed packages
only and pre-select the package that was double clicked. It would be tricky
however if more than one installed package file is opened at once.
* Add CommonOptions class and add an instance to Command. It supports a
debug level.
* full-sync, install, search, uninstall, update: Add option --debug.
This allows getting some debug output from the solver in cases where
the result seems weird.
The idea is to parse packages for Deskbar links and offer to "open" them
once they are installed. The added functionality is not yet complete and
will eventually figure out the file system location of a package and parse
the contents. I am mainly pushing this since my git-foo is limited and
I want to push the fix for the discovered deadlock.
When the package list was refreshed while package info was still being
pulled from the web app, calling Model::Clear() with the model lock already
held could lead to a dead-lock: The package populator could block on the
model lock to update information, while StopPopulatingAllPackages() waited
for the thread to exit, but held the lock that the thread was blocking on.
So call StopPopulatingAllPackages() before grabbing the lock and calling
Clear() in MainWindow::_RefreshPackageList().
QEMU was crashing since when setting the DSS divider we were _clearing_
the TV divider, and QEMU did not check for a divide by zero.
This "fixes" the QEMU crash and gets us a working framebuffer on Beagle ;)
- Adds a stripped down version of ExpressionParser from libshared,
which will eventually be modified to support various other capabilities
needed for debug expressions. Not yet used or complete.
* Added VFS helper function check_access_permissions() that combines
several partially correct versions to the one true version (tm).
* All but BFS (since recently) missed the S_IXOTH for root on directories,
and all but packagefs missed proper group handling.
When the address is not page aligned, not only adjust the address
to start mapping, but also take the "overflow" on the last page
into account.
This makes the bootloader boot again ;)
And move the (new) checkmarks into the Options menu. This makes them less
easy to discover, but cleans up the UI, especially since the options to show
development and source code packages are not very important for most users.
There is now a right-aligned second menu bar for the account management.
The menu label is what was previously shown underneath the search terms field.
The menu items have moved from the Tools menu into the new user menu. This
means the login/logout functionality is directly available where the login
info is shown in the UI when you click it.
* When you change the current working directory, you actually
should have the permission to enter that directory.
* This gives us a 0.04% better score on the perl test suite :-)